<nobitanobi>
Is it correct that whenever a class is defined, all the method cache gets invalidated?
hahuang65 has joined #ruby
<jhass>
it was at least, not sure if recent rubies changed something in that regard
<nobitanobi>
jhass: I am asking this because I know OpenStruct.new invalidates the method cache, so I decided to just create a class that sets instance variables. But apparently it also invalidates the cache
bgmarx has quit [Remote host closed the connection]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
mark[oz] has joined #ruby
<jhass>
well yeah, which is why those DCI via extend approaches never got popular
nettoweb has quit [Max SendQ exceeded]
<nobitanobi>
I guess I am missing the point here though. This is just if we are defining the class in run time though (that the cache gets invalidated)
<nobitanobi>
right?
<jhass>
well, being a bit nitpicky pays of here
nettoweb has joined #ruby
<jhass>
so in Ruby there's only parse time and runtime
commondream has quit [Remote host closed the connection]
<jhass>
and runtime starts already after the AST was build, it starts right as your class definitions get run
dgutierrez1287 has quit [Remote host closed the connection]
<jhass>
class Foo is pretty much just sugar for Foo = Class.new
nettoweb has quit [Max SendQ exceeded]
dgutierrez1287 has joined #ruby
mrsolo has joined #ruby
sevenseacat has joined #ruby
<nobitanobi>
ohm
symm- has joined #ruby
<jhass>
so, as your program enters runtime all your classes get defined and the toplevel code gets run, that's where method caches start to build up usually
nettoweb has joined #ruby
dfockler has quit []
<jhass>
you run into trouble if after that initial phase you continue to define classes
<nobitanobi>
jhass: having that said, in terms of performance, for this example: https://gist.github.com/novito/4906339fca5aa24cf235, the first approach (using a private class), would be more performant, because it does not invalidate the cache correct?
nettoweb has quit [Max SendQ exceeded]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
yeah
nettoweb has joined #ruby
<nobitanobi>
interesting. thanks!
<jhass>
though to say it again I didn't check if recent versions changed something about that, like busting only local caches instead of all of them
nettoweb has quit [Max SendQ exceeded]
fgo has quit [Ping timeout: 265 seconds]
nettoweb has joined #ruby
nettoweb has quit [Max SendQ exceeded]
IanVorn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nettoweb has joined #ruby
MatthewsFace has quit [Remote host closed the connection]
nettoweb has quit [Max SendQ exceeded]
x0f has quit [Ping timeout: 264 seconds]
MatthewsFace has joined #ruby
nettoweb has joined #ruby
noethics has joined #ruby
nettoweb has quit [Max SendQ exceeded]
jmhmccr has joined #ruby
<discord>
if I have an array of strings, is there an easy way to pass it as arguments to an external program?
NeverDie has joined #ruby
charliesome has quit [Quit: zzz]
x0f has joined #ruby
<jhass>
discord: sure, check Kernel#system's array form and more documentation for the arguments it takes at Kernel#spawn
<baweaver>
Probably as JSON
jacor has quit [Read error: Connection reset by peer]
jacor has joined #ruby
ReK2 has quit [Remote host closed the connection]
MatthewsFace has quit [Ping timeout: 244 seconds]
<discord>
baweaver: lol
<discord>
jhass: thanks, having a look
<drbrain>
Array form is the best form
charliesome has joined #ruby
mdz_ has joined #ruby
<eam>
be careful, array form can still create a shell if the array has one element
Cache_Money has joined #ruby
_seanc_ has joined #ruby
datanois1 has joined #ruby
fmcgeough has joined #ruby
<discord>
eam: ? Not sure I'm understanding how to pass an array from the documentation
baweaver has quit [Remote host closed the connection]
yaogwai has joined #ruby
FernandoBasso has quit [Quit: WeeChat 1.2]
<drbrain>
discord: what did you try?
bigkevmcd has joined #ruby
<discord>
just reading still
mdz_ has quit [Ping timeout: 252 seconds]
Fooster has quit [Ping timeout: 244 seconds]
<Ox0dea>
discord: Why not just splat it?
endash has quit [Quit: endash]
<drbrain>
yep ↑ is how you do it
laurentide has joined #ruby
fujimura has joined #ruby
bb010g has joined #ruby
jcromar__ has quit [Ping timeout: 246 seconds]
vikaton has joined #ruby
victorkohl has quit []
<Ox0dea>
>> [1].cycle.last
<ruboto>
Ox0dea # => undefined method `last' for #<Enumerator: [1]:cycle> (NoMethodError) ...check link for more (https://eval.in/377984)
<Ox0dea>
Kinda seems like that should work.
mark[oz] has quit [Remote host closed the connection]
fgo has joined #ruby
robustus has quit [Ping timeout: 255 seconds]
criosphinx has joined #ruby
jackjackdripper1 has joined #ruby
fujimura has quit [Ping timeout: 265 seconds]
symbol has joined #ruby
<discord>
Ox0dea: thanks!
symbol has quit [Client Quit]
robustus|Off has joined #ruby
mark[oz] has joined #ruby
robustus|Off is now known as robustus
shock_one has joined #ruby
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dnlbyl has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blue_deref has joined #ruby
mark[oz] has quit [Remote host closed the connection]
jgt1 has quit [Ping timeout: 276 seconds]
charliesome has quit [Quit: zzz]
oo_ has joined #ruby
jackjackdripper has quit [Ping timeout: 246 seconds]
TheHodge has quit [Quit: Connection closed for inactivity]
ecksit has joined #ruby
<ecksit>
join #rubyonrails
shock_one has quit [Ping timeout: 265 seconds]
<discord>
eam: what problem does that address?
ecksit has left #ruby [#ruby]
<eam>
discord: it's a method that takes an array of tokenized args and runs them, guaranteed to avoid spawning a shell to tokenize
<eam>
handles corner cases such as spaces in filenames
nickfausnight has quit [Quit: Connection closed for inactivity]
psy_ has quit [Ping timeout: 265 seconds]
bruno- has joined #ruby
CloCkWeRX1 has joined #ruby
psy_ has joined #ruby
postmodern has quit [Ping timeout: 264 seconds]
mrmargolis has joined #ruby
revoohc has joined #ruby
serivich has quit [Ping timeout: 244 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawel2 has quit [Quit: WeeChat 1.2]
felixjet has joined #ruby
Cache_Money has quit [Quit: Cache_Money]
<discord>
eam: I was using something like system("/path/to/command",*Array), and Array is never empty. This looks different then what you are discussing.
felixjet_ has quit [Read error: Connection reset by peer]
bruno- has quit [Ping timeout: 246 seconds]
ur5us has quit [Read error: No route to host]
ur5us_ has joined #ruby
<eam>
that should be fine, mine is more general
mark[oz] has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
vdamewood has quit [Quit: Life beckons.]
<drbrain>
Ox0dea: #cycle never stops, so there is no last thing
mark[oz] has joined #ruby
ur5us_ has quit [Remote host closed the connection]
stardiviner has quit [Ping timeout: 256 seconds]
paulcsmith has joined #ruby
Lucky__ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hahuang65 has quit [Ping timeout: 256 seconds]
mary5030 has joined #ruby
tvw has quit [Remote host closed the connection]
mark[oz] has quit [Remote host closed the connection]
serivich has joined #ruby
edwinvdgraaf has quit [Ping timeout: 255 seconds]
nb_bez___ has joined #ruby
charliesome has joined #ruby
nertzy has quit [Quit: This computer has gone to sleep]
kies has joined #ruby
tkuchiki has joined #ruby
hackeron has quit [Ping timeout: 272 seconds]
rodfersou has quit [Remote host closed the connection]
<Ox0dea>
drbrain: Right, but the "last" thing could nevertheless be inferred in that particular case.
deric_skibotn has quit [Ping timeout: 252 seconds]
<Radar>
That would require special-case knowledge of the object that the Enumerator is for.
<drbrain>
Ox0dea: ah, right, unfortunately ruby isn't yet that smart
n80 has quit [Quit: n80]
tkuchiki has quit [Remote host closed the connection]
<Ox0dea>
drbrain: Nor GHC, for what it's worth.
coderjk has joined #ruby
<drbrain>
I wonder if prolog can do that
tds5016 has quit [Ping timeout: 246 seconds]
coderjk has quit [Client Quit]
Yiota has joined #ruby
<drbrain>
… I suppose it also depends on if you think of "last" as "end of the enumeration" or not
djbkd has quit [Remote host closed the connection]
hackeron has joined #ruby
<sweeper>
whoa dbrain is here
rubie has quit [Remote host closed the connection]
GriffinHeart has joined #ruby
codelurker has joined #ruby
ght has joined #ruby
djbkd has joined #ruby
mark[oz] has joined #ruby
Lucky__ has joined #ruby
<drbrain>
I have rearranged my windows so I can see activity across all the IRC servers I have connected
omegahm has joined #ruby
bricker has quit [Ping timeout: 276 seconds]
nobitanobi has quit [Remote host closed the connection]
n3vtelen has quit [Remote host closed the connection]
rubie has quit [Remote host closed the connection]
willharr_ has joined #ruby
mercwithamouth has quit [Ping timeout: 265 seconds]
Limix has quit [Quit: Limix]
rubie has joined #ruby
bronson has quit [Remote host closed the connection]
furoido has joined #ruby
<furoido>
anyone familiar with wordmove gem?
yaogwai has joined #ruby
fujimura has quit [Ping timeout: 250 seconds]
fgo has quit [Ping timeout: 264 seconds]
fabrice31 has joined #ruby
Channel6 has quit [Quit: Leaving]
fmcgeough has quit [Quit: fmcgeough]
Rodya_ has joined #ruby
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
edwinvdgraaf has joined #ruby
fabrice31 has quit [Ping timeout: 256 seconds]
Papierkorb has quit [Quit: ArchLinux completes an endless loop faster than any other distro!]
Fooster has joined #ruby
vin` has joined #ruby
Vile` has quit [Remote host closed the connection]
jpfuentes2 has joined #ruby
edwinvdgraaf has quit [Ping timeout: 258 seconds]
x1337807x has joined #ruby
phutchins has quit [Ping timeout: 265 seconds]
Vile` has joined #ruby
tubuliferous_ has quit [Ping timeout: 252 seconds]
mary5030 has quit [Remote host closed the connection]
affenhoden has left #ruby [#ruby]
fmcgeough has joined #ruby
Palmer11 has left #ruby [#ruby]
fmcgeough has quit [Client Quit]
affenhoden has joined #ruby
bahar has joined #ruby
Rodya_ has quit [Quit: Leaving...]
gix has quit [Ping timeout: 258 seconds]
mrsolo has quit [Quit: This computer has gone to sleep]
tkuchiki has joined #ruby
djbkd has quit [Quit: My people need me...]
jackjackdripper1 has joined #ruby
mrmargolis has quit [Remote host closed the connection]
bogdanteleaga has quit [Ping timeout: 258 seconds]
Limix has joined #ruby
jackjackdripper has quit [Ping timeout: 244 seconds]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
revoohc has quit [Quit: revoohc]
PlasmaStar has quit [Ping timeout: 256 seconds]
gix has joined #ruby
<drbrain>
sweeper: no
PlasmaStar has joined #ruby
fgo has joined #ruby
Seanzie has joined #ruby
bogdanteleaga has joined #ruby
vin` has quit [Ping timeout: 256 seconds]
affenhoden has quit [Quit: leaving]
towski__ has quit [Remote host closed the connection]
iamjarvo has joined #ruby
iamjarvo has quit [Max SendQ exceeded]
iamjarvo has joined #ruby
GriffinHeart has quit [Remote host closed the connection]
commondream has joined #ruby
chrishough has quit [Ping timeout: 246 seconds]
mdz_ has joined #ruby
iamninja has quit [Read error: Connection reset by peer]
iamninja has joined #ruby
symm- has quit [Ping timeout: 264 seconds]
vin` has joined #ruby
commondream has quit [Ping timeout: 244 seconds]
mdz_ has quit [Ping timeout: 246 seconds]
Limix has quit [Quit: Limix]
nofxx has joined #ruby
RegulationD has joined #ruby
nofxx__ has quit [Quit: Leaving]
Spami has joined #ruby
greenride has joined #ruby
darkf has joined #ruby
<greenride>
Can someone suggest a guide for stepping through Ruby C code? I'd like to step through OpenSSL:Cipher.update.
bahar has quit [Ping timeout: 258 seconds]
shazaum_ has quit [Quit: This computer has gone to sleep]
axilla has quit [Ping timeout: 265 seconds]
skade has joined #ruby
<bnagy>
most of that stuff vanishes into openssl pretty fast
davedev2_ has quit [Ping timeout: 252 seconds]
<bnagy>
imho just modify the ruby and use printf debugging to get the ruby side, but the real C side you'll need a debugger
RegulationD has quit [Ping timeout: 245 seconds]
MatthewsFace has joined #ruby
pengin has joined #ruby
bruno- has joined #ruby
bahar has joined #ruby
pcfreak30 has quit [Ping timeout: 265 seconds]
Fooster has quit [Ping timeout: 265 seconds]
moretti has joined #ruby
agilenav has joined #ruby
commondream has joined #ruby
<greenride>
bnagy: I'm just wondering if there's a guide that allows one to do the following: 1.) Instruct rbenv to compile Ruby with debugging symbols. 2.) Use some IDE to insert breakpoints. 3.) Use gdb to debug.
krz has joined #ruby
jerematic has joined #ruby
<bnagy>
ok. No idea.
c_nick has joined #ruby
agilenav has quit [Client Quit]
<bnagy>
that won't help you debug openssl though :)
davedev24_ has joined #ruby
jerematic has quit [Read error: Connection reset by peer]
agilenav has joined #ruby
jerematic has joined #ruby
<greenride>
The bug is probably of my creation. I just want to see exactly what the inputs and outputs from OpenSSL are.
<c_nick>
how to group array items such that all types can be obtained viz ['a1','a2',a3'] => should give a
bruno- has quit [Ping timeout: 256 seconds]
<Ox0dea>
greenride: Are you quite sure Ruby isn't already exposing sufficient information?
<noethics>
greenride, is this web ssl?
<greenride>
No openssl
<noethics>
yeah.. i mean are you using it for http encryption
<noethics>
or something else
<bnagy>
greenride: ok well as I said, imho you'd be better off debugging the openssl code not the ruby code
vin` has quit [Remote host closed the connection]
<bnagy>
all that method does is shim ossl_cipher_update_long
<bnagy>
so all you'll see in the ruby is conversion to RSTRING etc
<noethics>
most things you can test with openssl command line in verbose mode
<noethics>
unless youre sure it's your ruby code
<greenride>
noethics: How do I test openssl in verbose mode?
<noethics>
greenride, depends how you're using openssl
agilenav has quit [Client Quit]
<greenride>
noethics: I'm creating a decipher object using OpenSSL:Cipher.new. Then, I'm setting some values and calling cipher.update
<greenride>
This is all Ruby code.
failshell has joined #ruby
<greenride>
When called, cipher.update is decrypting incorrectly.
<noethics>
greenride, find out what the equivalent of whatever you're doing is on the command line
<noethics>
and try doing it manually
pengin has quit [Remote host closed the connection]
<noethics>
to see if it's your code or our keys or whatever
<noethics>
your*
michael_mbp has quit [Excess Flood]
balazs has joined #ruby
<bnagy>
the openssl cipher API is such a shitshow :(
<greenride>
noethics: That's what I'm trying to do. One step exists between where I'm at and passing command line arguments to OpenSSL.
<noethics>
i've never used it
rbowlby has joined #ruby
<bnagy>
it's basically the same as using the openssl C api
<bnagy>
which is also a shitshow
<greenride>
bnagy: Good to know.
David_H__ has quit []
GriffinHeart has joined #ruby
<greenride>
To determine what Openssl is being passed, I need to determine what the Ruby C code for OpenSSL::Cipher's instance method update is passing OpenSSL.
<greenride>
That's why I need to debug the Ruby code.
<greenride>
The Ruby C code.
<noethics>
it seems like you don't really know what you're doing
<noethics>
go look at the source and see what it does
jerematic has quit [Remote host closed the connection]
<greenride>
I want to validate with a debugger
<greenride>
My C is a bit rusty.
<bnagy>
so it literally just casts to char* and sends it
<bnagy>
why are you against breaking on ossl_cipher_update_long?
<greenride>
bnagy: Don't know how to do it.
<bnagy>
that way you'll actually for real get what openssl is seeing
<greenride>
bnagy: bad reason
<greenride>
bnagy: bad reason = my reason was bad
bronson has joined #ruby
centrx has quit [Quit: Shutting down, Please wait...]
hahuang65 has joined #ruby
<greenride>
bnagy: To break on ossl_cipher_update_long, I need to build openssl with debug symbols and break on it.
<bnagy>
look, shoot me if I'm wrong but I am very confident that the bug is just with your ruby
<bnagy>
why do you need debug symbols?
<bnagy>
it's an export
Limix has joined #ruby
<greenride>
bnagy: I know the bug is 99.9999% with my Ruby code.
<bnagy>
I'm staring at this source and I can't think of anything weird ruby could possibly be doing to your input buffer
<bnagy>
a ruby string is just a raw byte array
<bnagy>
how about we play the "you describe the actual problem you're having" game instead?
<greenride>
When I type `decipher.update(my_string)`, what is argc, argv, and self that are passed to ossl_cipher_update?
Joufflu has joined #ruby
<bnagy>
c stuff
<bnagy>
they're just C's way of seeing the args you gave to the ruby method
<bnagy>
rb_scan_args(argc, argv, "11", &data, &str); pulls out the ruby args
<bnagy>
in = (unsigned char *)RSTRING_PTR(data); that casts your data arg to *char (byte array in C)
failshell has quit [Remote host closed the connection]
<bnagy>
ossl_cipher_update_long(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len)) that's the money shot
<greenride>
date = my_string in the example?
lordkryss has quit [Quit: Connection closed for inactivity]
bronson has quit [Ping timeout: 245 seconds]
vikaton has quit []
<bnagy>
yes
aaeron has quit [Quit: aaeron]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bnagy>
str is the (weirdly named) optional output buffer arg
<greenride>
bnagy: Now, I understand why you were talking about ossl_cipher_update_long. That method doesn't appear in the Ruby 1.9.3 version, which is what I was looking at.
<bnagy>
it doesn't? k lemme shift versions
zenguy_pc has quit [Read error: Connection reset by peer]
pepperbreath has joined #ruby
<greenride>
it's okay
dseitz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<greenride>
I'm actually using 2.1.6
<greenride>
But, I was looking at 1.9.3.
<greenride>
So, your link is better.
<bnagy>
oh EVP_CipherUpdate is probably just a wrapper
<greenride>
Right
jacobdam has joined #ruby
phutchins has joined #ruby
<noethics>
im just curious why youre using ssl?
<noethics>
whats the purpose
edwinvdgraaf has joined #ruby
jackjackdripper1 has quit [Quit: Leaving.]
<greenride>
So, what I need to know is what ctx, str, &out_len, in, and in_len are in Ruby variables.
<greenride>
noethics: encrypting data
<noethics>
well, yeah
<noethics>
why ssl though?
baweaver has joined #ruby
<greenride>
noethics: Actually, I'm writing specs for someone elses code
<noethics>
ic
pepperbreath1 has quit [Ping timeout: 264 seconds]
<bnagy>
fwiw if this is not for a school project or "fun" then you shouldn't be using openssl directly
<bnagy>
it's awful
<bnagy>
like very hard to use safely
<greenride>
Our code is a shitshow…
<bnagy>
oh
<jacobdam>
I am tracing a memory leak problem in ruby 2.1. There are some application objects are kept by an object RubyVM::Env. I am not sure what is RubyVM::Env. Anyone could explain to me what is RubyVM::Env?
<bnagy>
well in that case you're using the right lib!
<greenride>
It'll be refactored.
jpfuentes2 has joined #ruby
<greenride>
if the product is successful
<bnagy>
see if you can convince whomever to just use nacl
<bnagy>
please
<noethics>
or just rsa
<greenride>
nacl?
<bnagy>
=__= not rsa
nobitanobi has joined #ruby
<noethics>
wanna fight about it bnagy
<bnagy>
nacl is a good crypto lib
<greenride>
I'll look it up
<bnagy>
which is very hard to use wrong
<greenride>
Thanks for the advise.
<bnagy>
symmetric / asymmetric
<noethics>
you can implement your own rsa algo
<noethics>
in like 10 lines of code
<c_nick>
how to group array items such that all types can be obtained viz ['a1','a2',a3'] => should give a
braincra- has quit [Quit: bye bye]
<bnagy>
why was this child sent to plague me? What have I done?
deimos has quit [Remote host closed the connection]
bb010g has quit [Remote host closed the connection]
alol___ has quit [Remote host closed the connection]
zzak has quit [Remote host closed the connection]
charles81 has quit [Remote host closed the connection]
cstrahan has quit [Remote host closed the connection]
vcoinminer has quit [Remote host closed the connection]
skmp has quit [Remote host closed the connection]
jeregrine has quit [Remote host closed the connection]
cek has quit [Remote host closed the connection]
MiracleBlue has quit [Remote host closed the connection]
cardoni has quit [Remote host closed the connection]
alxndr has quit [Remote host closed the connection]
bjeanes has quit [Remote host closed the connection]
chrisseaton has quit [Remote host closed the connection]
maZtah has quit [Remote host closed the connection]
djbender has quit [Remote host closed the connection]
harleypig has quit [Remote host closed the connection]
featheryahn_ has quit [Remote host closed the connection]
mark[oz] has quit [Remote host closed the connection]
hellschreiber has quit [Remote host closed the connection]
adambeynon has quit [Remote host closed the connection]
bcavileer has quit [Remote host closed the connection]
manveru has quit [Remote host closed the connection]
firevolt has quit [Remote host closed the connection]
avdi has quit [Remote host closed the connection]
poikon has quit [Remote host closed the connection]
rfv has quit [Remote host closed the connection]
pusewicz has quit [Remote host closed the connection]
tonini has quit [Remote host closed the connection]
n1ftyn8 has quit [Remote host closed the connection]
frem has quit [Remote host closed the connection]
saintcajetan has quit [Remote host closed the connection]
huddy has quit [Remote host closed the connection]
grubernaut has quit [Remote host closed the connection]
Wobbley has quit [Remote host closed the connection]
brb3 has quit [Remote host closed the connection]
<c_nick>
:P
pizzaops has quit [Remote host closed the connection]
<bnagy>
c_nick: 'a' is not a type, it's a string prefix
phutchins has quit [Ping timeout: 245 seconds]
edwinvdgraaf has quit [Ping timeout: 264 seconds]
<noethics>
WHATS YOUR PROBLEM WITH RSA bnagy
<bnagy>
so many problems
<greenride>
bnagy: Do you know what ctx, str, &out_len, in, and in_len are in Ruby variables?
<c_nick>
bnagy, yes string prefix sorry
<noethics>
LIEK WHAT
AdamMeghji has quit [Remote host closed the connection]
rflot has quit [Remote host closed the connection]
neektza has quit [Remote host closed the connection]
PhilK has quit [Remote host closed the connection]
amitchellbullard has quit [Remote host closed the connection]
troter___ has quit [Remote host closed the connection]
mrsolow has quit [Read error: Connection reset by peer]
akahn has quit [Write error: Connection reset by peer]
dukedave has quit [Remote host closed the connection]
ballPointPenguin has quit [Remote host closed the connection]
Guest12375 has quit [Remote host closed the connection]
mroth has quit [Remote host closed the connection]
ramblinpeck_ has quit [Remote host closed the connection]
KnownSyntax has quit [Remote host closed the connection]
jrunning_ has quit [Remote host closed the connection]
petems has quit [Remote host closed the connection]
ckrailo has quit [Remote host closed the connection]
culturelabs has quit [Remote host closed the connection]
spastorino has quit [Remote host closed the connection]
<bnagy>
standard C api is like "here's some data, here's how long it is, here's where to put the output, here's a pointer to an int that you should fill in to tell me how long the output is"
<noethics>
bnagy, tell me why you think rsa is bad :(
<greenride>
bnagy: As far as I know, I'm passing at least iv, key, and my_string to the Ruby library. At least those three args and maybe more are passed to Openssl, right?
<c_nick>
noethics, suppose your array holds values like ARR1 AR2 ARR3 AR4 i want it to give ARR and AR
<bnagy>
greenride: no, the iv and key etc are used to create the context
<Ox0dea>
c_nick: What are some of your actual values?
<greenride>
bnagy: Is there an input other than iv, key, and my_string that comes from Ruby?
<bnagy>
noethics: it's hard to use correctly. People screw up the padding all the time.
braincrash has joined #ruby
<c_nick>
Ox0dea, here is my array ['WEST123','WEST234','WEST456','WEST567','STAR001','STAR002','STAR003','STAR004','STAR005','STAR006','FPG01','FPG02','FPG03','FPG04','FPG05','FPG06','BCG001','BCG002','BCG003']
<bnagy>
plus if you use e=3 there's hijinx
<greenride>
bnagy: Like me. I'm almost positive my issue is padding related.
<bnagy>
greenride: well that's why I asked a few times about your _actual_ problem rather than what you think will help you solve it
GriffinHeart has quit [Remote host closed the connection]
<greenride>
bnagy: Here's my actual problem. I'm writing specs. I monkey patched OpenSSL::Cipher with a class_eval within the specs. I monkey patched two methods. random_key and random_iv to return the same values every time. I made sure they are the correct number of bytes. I used these values for both the encryption and decryption. However, when I decrypt, I'm not getting the original values.
<greenride>
What do you mean by `just p decipher.key from ruby, and that should let you debug`?
bantic has joined #ruby
<bnagy>
then assuming your monkey patch is right then it will still work
mary5030 has quit [Remote host closed the connection]
<bnagy>
decipher.key = key <- change to decipher.key = cipher.random_key
<bnagy>
if it doesn't work, see what you're getting for decipher.key and why it's not the same as cipher.key
<bnagy>
you can do all of that from ruby
retornam has joined #ruby
<greenride>
bnagy: That's exactly what I did. I used the code on that page. If I don't Monkey patch random_iv and random_key. The code works. The object I get after encrypting and decrypting is identical to the original object.
vivekananda has joined #ruby
<greenride>
bnagy: After Monkey patching random_iv and random_key, the value I get is not identical to the original value.
<bnagy>
so check the keys
<greenride>
I checked their length.
<bnagy>
who cares what you're passing in update?
<bnagy>
if the keys aren't the same it's not going to work
<greenride>
The keys are identical.
moretti has quit [Quit: Leaving...]
<greenride>
iv and key
<bnagy>
I don't believe you :)
<greenride>
What I wonder is whether there is another random element that I'm not monkey patching.
affenhoden has quit [Quit: Leaving]
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mello has joined #ruby
mello has joined #ruby
affenhoden has joined #ruby
<greenride>
bnagy: I already checked four or five times because that's the first thing I suspected, but let me check again.
<bnagy>
how are you checking?
<bnagy>
gist your poc
<greenride>
I checked by inserting a debugger statement at every relevant point. This allowed me to test if the Monkey patch was working and to test if the key and iv were identical.
c_nick has quit [Quit: Ex-Chat]
<greenride>
I also converted the strings to a byte array using bytes.
<greenride>
And testing the numerical values.
nb_bez___ has quit [Quit: Connection closed for inactivity]
<bnagy>
show
<greenride>
Let me isolate the problem and create something that is easier to read.
krz has quit [Ping timeout: 264 seconds]
<greenride>
bnagy: As far as you know, iv and key are the only random elements. Correct?
djbkd has joined #ruby
<Ox0dea>
greenride: The universe is non-deterministic.
mdz_ has joined #ruby
ecksit has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<greenride>
Ox0dea: measurement is non-deterministic
<Ox0dea>
Aeyrix: Consider whether you should explicitly return a boolean value.
<sevenseacat>
that makes little sense
<Aeyrix>
Ox0dea: I do.
<sevenseacat>
the 'use unless if possible'
<Aeyrix>
Ox0dea: The method name is `authorized?`.
<Ox0dea>
Excellent.
<Aeyrix>
So, yes, I want to return a boolean only.
<noethics>
sevenseacat, how does it make little sense
<sevenseacat>
given we're talking about return values
<noethics>
if !a == unless a
<Aeyrix>
Jesus Christ
<Aeyrix>
that's not easy to read
<Aeyrix>
fairly sure you just broke like seven sacred tenets of Ruby
<noethics>
does return true unless a work?
<Aeyrix>
No, because then it won't return anything if a is true.
<Aeyrix>
It'll return nil.
<noethics>
o
<sevenseacat>
it'll return nil
<noethics>
TRU
<bnagy>
you can force a return of a bool with !!(thing)
<shevy>
he likes caps
<Ox0dea>
Aeyrix: noethics (and the style guide) recommend using "unless" instead of "if not".
<bnagy>
but it's ew
<Aeyrix>
;_;
<sevenseacat>
that i can agree with
baweaver_ has quit [Ping timeout: 256 seconds]
<noethics>
i am good at ruby
<noethics>
if you didnt know
kp666 has joined #ruby
<Aeyrix>
jej
<sevenseacat>
lol
bantic has joined #ruby
<baweaver>
What the hell did I just read?
<noethics>
honestly 99% of my ruby experience comes with rubuto
mrsolo has joined #ruby
<noethics>
baweaver, just go with it m8
* baweaver
shuffles on
charliesome has quit [Quit: zzz]
edwinvdgraaf has quit [Ping timeout: 256 seconds]
<noethics>
>> a = false; unless a;
<ruboto>
noethics # => /tmp/execpad-daa7afd7547e/source-daa7afd7547e:3: syntax error, unexpected keyword_rescue ...check link for more (https://eval.in/378016)
<noethics>
u fukin wut
<greenride>
bnagy: Here is a simple example reproducing the problem I'm experiencing. https://dpaste.de/6Xxx
<sevenseacat>
next
<Aeyrix>
> a = true; return !a;
<Aeyrix>
>> a = true; return !a;
<ruboto>
Aeyrix # => unexpected return (LocalJumpError) ...check link for more (https://eval.in/378017)
<Aeyrix>
Fuck you say?
<shevy>
hey workmad3 when you document your ruby code, do you use "honored" notation or "honoured", as example?
<Aeyrix>
o rite no def
balazs has joined #ruby
<noethics>
shevy is NSA
<noethics>
fishing for those location detes
commondream has quit [Remote host closed the connection]
<shevy>
noethics I need to find out whether I should drop support for british english
<Aeyrix>
lmao
mike1 has joined #ruby
<Aeyrix>
I use BritEng.
<Aeyrix>
:^)
commondream has joined #ruby
<shevy>
Aeyrix you are from the UK?
<Aeyrix>
Yes.
<shevy>
ok
stardiviner has joined #ruby
<sevenseacat>
I use whatever comes out of my keyboard at the time. never really thought about it.
MasterPiece has joined #ruby
mike1 has left #ruby ["WeeChat 0.4.3"]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<noethics>
sevenseacat, i take you for someone who doesn't use an oxford comma
<baweaver>
Not finding anything of note for getting two nodes
tsujp has quit [Quit: tsujp is snoozing]
polysics has quit [Remote host closed the connection]
<baweaver>
Unless it magically supports regex for paths
<sevenseacat>
I'mma bookmark that, every time nokogiri I have to hammer google
<sevenseacat>
*every time I use nokogiri
<baweaver>
same
GriffinHeart has quit [Remote host closed the connection]
<baweaver>
Though tenderlove is on, might put it by him.
MVPhelp has quit [Remote host closed the connection]
Limix has quit [Quit: Limix]
MVPhelp has joined #ruby
<Radar>
I think it's an on-purpose thing and the people who are sending us this XML file are idiots.
<sevenseacat>
plausible.
<baweaver>
I have very colorful words for people that use XML for responses, but I'll save that.
lsmola has joined #ruby
bMalum has joined #ruby
<baweaver>
One time I saw Java programmers trying to program using XML because it was 'more flexible'
_seanc_ has quit [Quit: _seanc_]
<baweaver>
Got an interesting look when I said just bite the bullet and learn LISP already
ndrei_ has quit [Ping timeout: 258 seconds]
<sevenseacat>
json or gtfo
ruby-lang084 has quit [Ping timeout: 246 seconds]
<baweaver>
yaml isn't horrid either, but slow on the parse
tenderlove has quit [Remote host closed the connection]
tenderlove has joined #ruby
apofis has joined #ruby
skade has joined #ruby
khebbie has joined #ruby
skade has quit [Client Quit]
datanois1 has joined #ruby
<Radar>
JSON or gtfo is also my opinion
Exponential has quit [Read error: Connection reset by peer]
Exponent_ has joined #ruby
<Radar>
Unfortunately these people are all Serious Business(tm) types and due to the fact that they wear suits to work every day they need to only use XML
<baweaver>
Well I have a solution for you Radar
<baweaver>
Both of you can get what you want
<baweaver>
Know how?
<Radar>
Use JSON? :D
multi_io has quit [Ping timeout: 264 seconds]
<Radar>
Or are you going to link to that JSON-as-XML service?
EllisTAA has quit [Quit: EllisTAA]
* baweaver
backspaces link
<baweaver>
....no
<sevenseacat>
hehe
oo_ has quit [Remote host closed the connection]
hahuang61 has joined #ruby
<noethics>
one of my clients uses a "web service" that uploads an xml document once a day via ftp to their server, containing ALL of their data. every time. it takes like a minute to parse
<baweaver>
Magic internet points make the world go round
allenn has joined #ruby
<Radar>
flughafen: not that awesome :)
fujimura has quit [Remote host closed the connection]
codecop has joined #ruby
* baweaver
has youtube videos of guitar/singing
GriffinHeart has quit [Remote host closed the connection]
* baweaver
still isn't that great
GriffinHeart has joined #ruby
<shevy>
hmm if I have a hash with 50 elements, and I wish to randomly pick 5 entries (key -> value pairs), what would be a good way? for an Array, I could use .sample 5x times
<flughafen>
hey Radar did you know baweaver won best in show at the midwest hackathon?
Kharma has quit [Remote host closed the connection]
mjc_ has quit [Remote host closed the connection]
frankS2 has quit [Read error: Connection reset by peer]
holsee_ has quit [Remote host closed the connection]
zipkid has quit [Remote host closed the connection]
chris-sonar has quit [Remote host closed the connection]
knowtheory has quit [Remote host closed the connection]
strmpnk has quit [Remote host closed the connection]
glowcoil has quit [Remote host closed the connection]
jlyndon has quit [Remote host closed the connection]
ggherdov has quit [Write error: Connection reset by peer]
HashNuke has quit [Remote host closed the connection]
cbetta has quit [Remote host closed the connection]
daxroc has quit [Remote host closed the connection]
whoojemaflip has quit [Remote host closed the connection]
Guest5307 has quit [Remote host closed the connection]
thesheff17 has quit [Remote host closed the connection]
jpinnix______ has quit [Remote host closed the connection]
jmcc has quit [Remote host closed the connection]
poguez_ has quit [Remote host closed the connection]
dmoe has quit [Remote host closed the connection]
bttf has quit [Write error: Broken pipe]
vikram___ has quit [Remote host closed the connection]
autrilla has quit [Remote host closed the connection]
jxf has quit [Remote host closed the connection]
pskosinski has quit [Remote host closed the connection]
bestie has quit [Remote host closed the connection]
alekst_ has quit [Remote host closed the connection]
<flughafen>
baweaver: i'll endorse you as legendary on linkedin
skandi has quit [Remote host closed the connection]
roqo has quit [Ping timeout: 248 seconds]
* baweaver
checks to see if he can add that as a skill
pengin has joined #ruby
shock_one has joined #ruby
hubcaps has joined #ruby
<flughafen>
we have linux in common
IanVorn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
fabrice31 has joined #ruby
<baweaver>
I end up in a lot of odd spots somehow. I mentioned offhandedly that I knew Scala and now I'm the one giving talks and presentations on it and usage in Spark.
roqo has joined #ruby
bMalum has quit [Quit: bMalum]
andikr has joined #ruby
<shevy>
Radar cool thanks
<shevy>
flughafen do you understand "Fettes Brot" in the song "nordish by nature"?
<baweaver>
US Hackathons are awesome though, top prizes normally walk off with ~$5000 in prizes
<baweaver>
redundant is redundant
<flughafen>
shevy: i'm looking at the lyrics now.
<flughafen>
kind of
<baweaver>
well if that's not a sign to go to sleep already
* sevenseacat
still watching videos
<shevy>
flughafen haha that's cheating! :D
<flughafen>
I will not take responsibility for sevenseacat losing productivity or not playing eso
<shevy>
"um die de Norden antokieken"
bMalum has joined #ruby
hahuang65 has joined #ruby
<flughafen>
i don't get antokieken?
sonOfRa has quit [Read error: Connection reset by peer]
DEA7TH_ has joined #ruby
mello has joined #ruby
mello has joined #ruby
jpinnix______ has joined #ruby
metallicrwr has joined #ruby
strmpnk has joined #ruby
blue_deref has quit [Quit: bbn]
fujimura has joined #ruby
tonini has joined #ruby
revath has joined #ruby
<shevy>
me neither
pengin has quit [Remote host closed the connection]
grubernaut has joined #ruby
<shevy>
without the lyrics I wouldn't understand anything, save for the "regular" german
Neomex_ has joined #ruby
yaogwai has quit [Ping timeout: 264 seconds]
glowcoil has joined #ruby
<shevy>
Ik krakeel veel platt in dat mikrofon
existensil has joined #ruby
ur5us has quit [Remote host closed the connection]
<shevy>
krakeel :D man ...
<shevy>
this is right from Cthulhu
[diecast] has joined #ruby
knowtheory has joined #ruby
yaogwai has joined #ruby
hahuang65 has quit [Ping timeout: 246 seconds]
kapowaz has joined #ruby
Guest85414______ has joined #ruby
Neomex has quit [Ping timeout: 258 seconds]
cbetta has joined #ruby
skyrocker has left #ruby [#ruby]
mello has quit [Ping timeout: 255 seconds]
sonOfRa has joined #ruby
ec has joined #ruby
mister_solo has joined #ruby
Hounddog has joined #ruby
jack_rabbit has quit [Ping timeout: 276 seconds]
troulouliou_dev has joined #ruby
astrobunny has joined #ruby
pmarreck has joined #ruby
<certainty>
so #ruby-lang is mostly dead?
<sevenseacat>
it redirects here now
<certainty>
flughafen: anzuschauen
<certainty>
sevenseacat: cool
tsujp has joined #ruby
hakunin has quit [Remote host closed the connection]
Iskarlar has joined #ruby
<apeiros>
certainty: s/mostly//, ftfy
<flughafen>
hey certainty
krainboltgreene has joined #ruby
hakunin has joined #ruby
spider-mario has quit [Remote host closed the connection]
im0b has joined #ruby
sinpai9090 has joined #ruby
tenderlove has quit [Ping timeout: 250 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mhoungbo has joined #ruby
Zai00 has joined #ruby
solars has joined #ruby
bMalum has quit [Quit: bMalum]
sinpai9090 has left #ruby [#ruby]
neersighted has joined #ruby
jlyndon has joined #ruby
jack_rabbit has joined #ruby
poikon has joined #ruby
<baweaver>
well, bed for me
<baweaver>
'night all
<havenwood>
g'night
blackmesa has joined #ruby
mister_s_ has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
sinpai9 has joined #ruby
baweaver has quit [Remote host closed the connection]
rubie has quit [Remote host closed the connection]
hanmac has quit [Ping timeout: 256 seconds]
krz has joined #ruby
HashNuke has joined #ruby
fabrice31 has quit [Remote host closed the connection]
sinpai9 has left #ruby [#ruby]
rubie has joined #ruby
whoojemaflip has joined #ruby
cardoni has joined #ruby
fabrice31 has joined #ruby
beneggett has quit [Quit: ...zzz ¯\_(ツ)_/¯ zzz...]
<shevy>
it's weird insofar that some people are like permanently connected; and some people log out when they sleep, and reconnect when they are awake again
<apeiros>
12:22 apeiros: and child processes only take over the main thread
<arup_r>
apeiros: if you have access remove the link..
<apeiros>
Darkwater: ^
<Darkwater>
it runs at least five times, but the data is only updated once, at the very beginning
<arup_r>
I wouldn't ever.
<apeiros>
arup_r: that's not possible in irc.
<arup_r>
ok..
<Darkwater>
hm, what do you mean?
<Darkwater>
I know for sure there's only one instance by the way
troulouliou_dev has joined #ruby
<Darkwater>
I log something on start, it's only logged once
<apeiros>
I don't know when/how passenger forks
phutchins has joined #ruby
<apeiros>
I'd log $$ for every request. or use ps. or top. or htop.
<apeiros>
I know it can do it after the start, given that it can preload a rails app. I'd assume it forks on rackapp.call
jamesbrink has joined #ruby
j4cknewt has quit [Ping timeout: 265 seconds]
rodfersou has quit [Quit: leaving]
lxsameer has joined #ruby
<Darkwater>
ah, logging pids is a good idea
railsraider has joined #ruby
<Darkwater>
though it shouldn't matter
n008f4g_ has quit [Ping timeout: 276 seconds]
<Darkwater>
hm, the start and loop log the same pid
<apeiros>
that's expected
<apeiros>
and the requests won't
<Darkwater>
the requests have another one
<Darkwater>
loop pid stays the same
<Darkwater>
hmm
pcfreak30 has joined #ruby
<apeiros>
and the requests don't have the loop either because as said, loop is in a thread which is not the main thread -> not carried over to children
epistrephein has quit []
sdothum has joined #ruby
<apeiros>
there's an after-fork hook/callback in passenger iirc
millerti has quit [Ping timeout: 258 seconds]
<apeiros>
so you can either start the loop in the children too, or you can use some sharing mechanism like memcached.
<jhass>
though I'd consider running whatever you do externally and communicate over a DB/file/socket/whatever
<adaedra>
I have a hash (i.e. { a: 1, b: 2, c: 3 }) and want to split it in two according to a list of keys to keep (so with [ :b ] would be { b: 2 } and { a: 1, c: 3 }). I have access to facets gem (so Hash#slice and Hash#slice!). What would be the best way of doing it?
<jhass>
isn't there Hash#partition?
<Darkwater>
I was almost going to extract it into a separate process like jhass suggests, but I jsut read about sinatra's configure block
<Darkwater>
gonna try that first
Guest30625 has joined #ruby
rushed has joined #ruby
<adaedra>
mmh
bluOxigen has joined #ruby
<Guest30625>
hey guys
<Guest30625>
i want to read a JSON file, modify the values from key:value pairs and post the change to a url
<Guest30625>
are there any ruby experts here? i'm looking for help on expressing a ruby code
<adaedra>
it's in Enumerable, so I guess I could work with it
chinmay_dd has joined #ruby
rodfersou has joined #ruby
<jhass>
well, yeah, need to_h the result
<adaedra>
thanks
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros>
jhass: that'd be what I called "sharing mechanism"
DaniG2k has quit [Quit: leaving]
CloCkWeRX has joined #ruby
<jhass>
apeiros: yeah, only read after :)
<Darkwater>
meh never mind, I'll just extract it
<Darkwater>
how should I run ruby daemons?
<Darkwater>
is there something like forever for nodejs?
<apeiros>
Darkwater: there's a daemonize gem
<jhass>
I'd use in order of preference: systemd, daemontools, your init system, eye, god, monit, bluepill
<Darkwater>
or is there a good way to start a daemon (if not already running) from my sinatra app?
jerematic has quit []
<apeiros>
and there's stuff in core by now to make daemonizing easier
<Guest30625>
hey guys could anyone help me think through resolving a coding problem in ruby?
<ljarvis>
?ask
<ruboto>
Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
<apeiros>
Guest30625: your question is vague. please provide more details.
<jhass>
meh, -1 to self daemoniziation
<Guest30625>
sure let me explain
<Darkwater>
still running upstart, and I'd rather not mess around with init systems right now
<jhass>
Darkwater: daemontools would be my choice then
yardenbar has joined #ruby
<Darkwater>
reminds me of a certain ISO mounting program :>
<Darkwater>
is it ruby-specific? no idea where to look because of that
<jhass>
talking about the djb stuff though ;)
<jhass>
no
yfeldblu_ has quit [Remote host closed the connection]
<ccooke>
jhass: don't say that name! ;-)
ylla has joined #ruby
chussenot has quit [Quit: chussenot]
<jhass>
heh, the attitude is meh but the stuff works
segfalt has quit [Quit: segfalt]
_ht has quit [Remote host closed the connection]
<ccooke>
Some of it works, although often not in ways I'd suggest.
<jhass>
and I do enjoy his talks :P
_ht has joined #ruby
tubuliferous_ has joined #ruby
failshell has joined #ruby
bkxd has joined #ruby
<ccooke>
The worst thing about djb is that he's actually made enough definitively positive contributions to outweigh his rather strange worldview and the mess of problems his software has caused :-)
<jhass>
hehe
ndrei has quit [Ping timeout: 258 seconds]
jds has quit [Quit: Connection closed for inactivity]
<ccooke>
(Particularly if you look at his contributions to security; he's worked on some important stuff)
<jhass>
anyway, I just replaced daemontools with systemd because systemd is easier to use, daemontools didn't fail on me once though
<ccooke>
But as a sysadmin, I will never forgive him for having to deal with qmail
khebbie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
that might be true
bluOxigen has quit []
lordkryss has quit [Quit: Connection closed for inactivity]
imperator has joined #ruby
ndrei has joined #ruby
<imperator>
good morning
<imperator>
is there a way to silence the output of gem update --system? I tried -q and --no-document, didn't seem to do it
sandstrom has quit [Quit: My computer has gone to sleep.]
tubuliferous_ has quit [Ping timeout: 265 seconds]
failshell has quit [Ping timeout: 264 seconds]
ItSANgo has joined #ruby
ur5us has quit [Remote host closed the connection]
<jhass>
well, then just >/dev/null I guess
<ljarvis>
redirect it
<ljarvis>
heh
oo_ has quit [Remote host closed the connection]
vdamewood has joined #ruby
afrianska has joined #ruby
barkerd427 is now known as zz_barkerd427
rikkipitt has joined #ruby
symm- has joined #ruby
tkuchiki has quit [Ping timeout: 272 seconds]
abirazor has joined #ruby
pepperbreath1 has joined #ruby
pepperbreath has quit [Ping timeout: 245 seconds]
* flughafen
hates it when the package is in your town but doesn't get out for delivery
poguez_ has quit [Quit: Connection closed for inactivity]
<adaedra>
heh
arup_r_ has joined #ruby
<flughafen>
they should lie to me and tell me it's somewhere else
<adaedra>
NO.
<adaedra>
You should suffer.
ndrei has quit [Ping timeout: 256 seconds]
<flughafen>
why meeee! why meeeee!
arup_r__ has joined #ruby
<adaedra>
I guess I'm the only one to get their deliveries in the 5 minutes I took going home to fetch something
arup_r has quit [Ping timeout: 264 seconds]
Rickmasta has joined #ruby
revath1 has joined #ruby
pepperbreath1 has quit [Ping timeout: 252 seconds]
pepperbreath has joined #ruby
<flughafen>
adaedra: do they not accept them for you at work?
auzty has quit [Ping timeout: 255 seconds]
<adaedra>
I was at school at this time
<flughafen>
i ship all my stuff to work minus the heavy stuff like kitty litter
bakednotfried has joined #ruby
arup_r_ has quit [Ping timeout: 246 seconds]
dalafa has joined #ruby
kerunaru has joined #ruby
afrianska has quit [Quit: Leaving]
astrobunny has joined #ruby
<Guest30625>
hey guys ..here's the challenge i would like to know if it's doable
<adaedra>
we have a fact for this extension thing?
bakednotfried has quit [Changing host]
bakednotfried has joined #ruby
astrobunny has quit [Ping timeout: 252 seconds]
<jhass>
?gist_usage
<ruboto>
To properly use gist, please enable syntax highlighting, either by choosing the language manually or by entering a proper filename. If you post multiple things, separate them into multiple files. If you have a Github account, please update your gist with new information instead of posting a new one.
<apeiros>
Guest30625: `replace the “value” data` - which value data?
<jhass>
well, if you're repeating that pattern all over again in your code there might a way to DRY it up, but judging on the single line you show that's as good as it gets
<jhass>
can't really say much with that amount of context, sorry
mdz_ has quit [Ping timeout: 264 seconds]
astrobunny has joined #ruby
<jhass>
oh, wait, you updated it m(
davidhq has joined #ruby
Xeago has quit [Remote host closed the connection]
zotherstupidguy has quit [Ping timeout: 255 seconds]
<jhass>
let's see
anisha has joined #ruby
aryaching has joined #ruby
failshell has joined #ruby
<sem__>
hello, I'm beginner and student . I've a personal project to improve my skills (ruby, sinatra) and I 've some difficulties to parse a json string. Can somone help me in private message ? Thx
zotherstupidguy has joined #ruby
torpor has joined #ruby
<Darkwater>
why private?
bahar has joined #ruby
mary5030 has joined #ruby
<torpor>
dumb ruby question: i want a buffer to be the sum total of three files using file.read .. how do i concatentate the reads from 3 different files?
<torpor>
file1 = FILE.open("file1.txt")
mary5030 has quit [Remote host closed the connection]
<torpor>
file2 = file.open("file2.txt")
Parker0 has quit [Read error: Connection reset by peer]
<torpor>
data = file1.read + file2.read
<torpor>
^^ is that how?
failshell has quit [Remote host closed the connection]
IanVorn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
IanVorn has joined #ruby
gamename has quit [Remote host closed the connection]
hahuang65 has joined #ruby
MasterPiece has quit [Remote host closed the connection]
<jhass>
Deck`: I think I'd go for result = h1.map.with_object({}) {|(k, v| result| result[k] = h2[k]-v }
bahar has quit [Ping timeout: 258 seconds]
yqt has joined #ruby
agarie has joined #ruby
* ljarvis
hands jhass a )
* jhass
thanks and hands ljarvis the superfluous | back
<ljarvis>
also that wont work because b would be -4
znz_jp has joined #ruby
<ljarvis>
o
<ljarvis>
shhh LJT_
<ljarvis>
wat
<ljarvis>
ljarvis
<ljarvis>
LJT_: carry on
<yorickpeterse>
you drunk?
<ljarvis>
you jelly?
<yorickpeterse>
not really
<ljarvis>
o
<ljarvis>
then no
<LJT_>
ljarvis ???
<yorickpeterse>
if I want to get drunk I can just grab some soju
<ljarvis>
LJT_: i accidentally your name, please ignore
<LJT_>
all good :)
<ljarvis>
yorickpeterse: when are you back in the land of the home
<yorickpeterse>
Friday evening
havenwood has joined #ruby
mello has quit [Ping timeout: 245 seconds]
<yorickpeterse>
kinda miss my own not-crappy wifi
<ljarvis>
was this a vacay?
<apeiros>
jhass: that'll run into troubles with key diffs
<yorickpeterse>
yeah
<yorickpeterse>
"vacation"
<niitotantei>
Deck`: Hash#merge
<ljarvis>
workation?
<ljarvis>
niitotantei: that's not the same, read their code
<yorickpeterse>
ljarvis: well I'm not working for $WORK
<jhass>
niitotantei: Hash#merge won't result in their example result :/
<yorickpeterse>
but I'm doing FOSS
<ljarvis>
yorickpeterse: ah
<ljarvis>
yorickpeterse: dat rust
<jhass>
apeiros: can only work by the examples given...
<yorickpeterse>
ljarvis: yeah
<apeiros>
jhass: true. information is vague. and your solution does fit the example.
<yorickpeterse>
I'm not venturing into multi-threading land
tkuchiki has joined #ruby
<apeiros>
jhass: but given the missing :c key I extrapolated that only common keys should be summed
nertzy has quit [Quit: This computer has gone to sleep]
<apeiros>
or diffed
<ljarvis>
rust is the first language since c++ 10 years ago that i really find difficult to read
<yorickpeterse>
heh
bigkevmcd has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass>
and I extrapolated that the keyset of h2 is a superset of h1 :P
ndrei has quit [Ping timeout: 264 seconds]
<ljarvis>
i can write it.. but reading it? nup
hahuang65 has quit [Ping timeout: 265 seconds]
<sevenseacat>
ljarvis: isnt it usually the opposite >_>
<apeiros>
jhass: yupp. valid. as said, vague info.
ndrei has joined #ruby
<ljarvis>
sevenseacat: I'd assume so yeah, i guess i'm special :(
bahar has joined #ruby
EllisTAA has joined #ruby
g0rx has joined #ruby
<EllisTAA>
i want to create a website that can pull up code and execute it. with my limited knowledge i was thinking i need an ide … is that true if so can i just embed one??
<shevy>
it's often easier to understand what you just wrote, than reading something that you did not write or wrote years ago
<shevy>
I had that a lot more with perl; ruby code on the other hand can be very readable
<sevenseacat>
EllisTAA: what?
<sevenseacat>
thats..... not a straightforward thing to do.
<jhass>
EllisTAA: I'd suggest you don't run untrusted code if you have that level of questions
<EllisTAA>
ha uh so i want to create a website that allows me to store my sourcecode and then let visitors execute it …
<apeiros>
EllisTAA: no, you can't embed an IDE into a website.
<sevenseacat>
and will very likely lead to your entire server getting hosed.
<apeiros>
you can develop a web-based IDE. but given your apparent knowledge, I think that's not realistic.
<EllisTAA>
*dreams crushed* ok
fgo has joined #ruby
<jhass>
nah, not crushed, put on hold
<EllisTAA>
:)
<jhass>
you'll know when you can revisit it
<adaedra>
go step by step
CloCkWeRX has joined #ruby
<EllisTAA>
thanks
DoubleMalt has quit [Remote host closed the connection]
CloCkWeRX1 has quit [Ping timeout: 265 seconds]
MasterPiece has joined #ruby
DoubleMalt has joined #ruby
<jhass>
that said of the roughly 400 people that've been to http://carc.in nobody tried to really break it so far, it's quite disappointing
MasterPiece has quit [Remote host closed the connection]
bMalum has joined #ruby
axl_ has joined #ruby
<yorickpeterse>
done
<yorickpeterse>
bah, it handles fork bombs
<yorickpeterse>
as if somebody thought about it
fgo has quit [Ping timeout: 255 seconds]
<jhass>
:P
<jhass>
and it's only the second fork bomb!
<jhass>
the first one was a shell one that failed to execute
umgrosscol has joined #ruby
<EllisTAA>
what’s a fork bomb
psy_ has quit [Ping timeout: 256 seconds]
fujimura has joined #ruby
CloCkWeRX1 has joined #ruby
<jhass>
but I mean I allow to run C and don't even see the known privilege escalation thingies
CloCkWeRX has quit [Quit: Leaving.]
edmagne has joined #ruby
codecop has quit [Remote host closed the connection]
edmagne has left #ruby [#ruby]
<jhass>
EllisTAA: a process that clones itself in an infinite loop consuming all system resources
<shevy>
the zombie mother
<EllisTAA>
ooo
chinmay_dd has joined #ruby
super has quit [Ping timeout: 264 seconds]
g0r__ has joined #ruby
g0r__ has left #ruby [#ruby]
<yorickpeterse>
jhass: I take it this runs under a VM/container/cgroups?
zombirx has joined #ruby
<jhass>
yeah
<zombirx>
any ruby coder ?
LJT_ has quit [Read error: Connection reset by peer]
atomical has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chinmay_dd has quit [Remote host closed the connection]
hinbody has quit [Read error: Connection reset by peer]
<yorickpeterse>
I'm a doctor
CloCkWeRX1 has quit [Ping timeout: 256 seconds]
fujimura has quit [Ping timeout: 276 seconds]
lxsameer has quit [Quit: Leaving]
chinmay_dd has joined #ruby
<jhass>
of geology!
<ljarvis>
i really want something like the rust/go playgrounds which let you run code and display the output underneath without the UI changing (but in multiple languages)
<adaedra>
Dr Rock
pandaant has joined #ruby
chinmay_dd has quit [Remote host closed the connection]
<yorickpeterse>
pull down your pants and cough
<yorickpeterse>
(that's what doctors say right?)
<apeiros>
yorickpeterse: that's uninteresting. s/a/the/ and suddenly you've got my attention :)
psy_ has joined #ruby
<sem__>
this is my problem : @point = game.point values = JSON.parse(@point.to_json) File.open('data.json', 'w'){|file| file.write(values)} erb :index end
<yorickpeterse>
replace what "a"?
<yorickpeterse>
oh, "I'm the doctor"?
<sem__>
I want to display the points in sinatra
<adaedra>
<yorickpeterse> I'm a doctor – I'd say
<apeiros>
yorickpeterse: *sob*, ok: s/\ba\b/the/
jgt1 has quit [Ping timeout: 256 seconds]
<adaedra>
meh, too slow
bMalum has quit [Quit: bMalum]
<flughafen>
what the hell
ruv has joined #ruby
<apeiros>
wait
thelastinuit has joined #ruby
<apeiros>
there was no other "a" in that phrase
<jhass>
lol
<apeiros>
those \b were unnecessary
<yorickpeterse>
you didn't specify the input buffer
<apeiros>
yorickpeterse: and yes, "I'm the doctor" :)
kevkev has quit [Quit: (null)]
<jhass>
apeiros: it's nice that you gave them a home & purpose anyway
<apeiros>
and WHO ever doesn't get the reference - that's your own damn fault :-p
bahar has quit [Ping timeout: 256 seconds]
<yorickpeterse>
stop discrimination against \
khebbie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
barkerd427 is now known as zz_barkerd427
<yorickpeterse>
* \b today!
<adaedra>
apeiros: ahah.
<yorickpeterse>
all escape sequences are equal
<apeiros>
but some are more equal
<Darkwater>
sem__: what is the problem?
<Darkwater>
I see some code and somethign you want
<jhass>
sem__: start by removing that JSON.parse(x.to_json), just File.write("data.json", game.point.to_json)
bMalum has joined #ruby
<jhass>
sem__: then in your sinatra app you can get back your array/hash with JSON.parse(File.read("data.json"))
<sem__>
ok thx jhass and Darkwater
EllisTAA has quit [Quit: EllisTAA]
hinbody has joined #ruby
<sem__>
ok
<Darkwater>
jhass: I think that's in his sinatra app
<sem__>
get '/' do game = Game.new @point = game.point JSON.parse(File.read("data.json")) erb :index end post '/' do game = Game.new game.point!(params[:marque].gsub(/oueur /, '').to_sym) @point = game.point File.write("data.json", game.point.to_json) erb :index end
<zombirx>
an other one plz
<sem__>
I have A JSON text must at least contain two octets!
<adaedra>
gist, gist, gist
<jhass>
?gist sem__
<ruboto>
sem__, https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
<sem__>
sorry
torpor has quit [Quit: Leaving.]
_seanc_ has joined #ruby
<adaedra>
And if your data.json is empty, the error is normal
<zombirx>
!kick jhass don t
<Darkwater>
lol
<jhass>
zombirx: say what?
<yorickpeterse>
"Offensive behavior include but are not limited to (in no particular order): Trolling" fuck
<zombirx>
the bot don t obey
<zombirx>
how to kick you also ?
<yorickpeterse>
you can't
<yorickpeterse>
you're not an op
Zai00 has quit [Quit: Zai00]
<adaedra>
yorickpeterse: no troll for you!
<Senjai>
jhass: just ban the guy :P
<yorickpeterse>
:<
RegulationD has joined #ruby
<jhass>
Senjai: will on the next channel rule violation
jwaldrip has joined #ruby
banister has quit [Ping timeout: 256 seconds]
tagrudev has quit [Remote host closed the connection]
astrobunny has quit [Ping timeout: 265 seconds]
Langlands has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
_seanc_ has quit [Client Quit]
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tenderlove has quit [Remote host closed the connection]
<jhass>
sem__: okay, cool, now you parse the file but you don't do anything with the parsed result
<jhass>
sem__: JSON.parse returns it, but you ignore its return value
<jhass>
you should assign it to something for starters
<avat>
I guess I was lost in trollwar, repeating my question :) - I'm trying to "unwire" my classes from each other - is this the proper way for dependency injection? https://gist.github.com/ZyzioZiom/c7bc2a9a25c38779307e
plashchynski has quit [Quit: plashchynski]
blackmesa has joined #ruby
plashchynski has joined #ruby
AhabsBeard has joined #ruby
gamename has quit [Remote host closed the connection]
commondream has joined #ruby
gamename has joined #ruby
gamename has quit [Remote host closed the connection]
roolo_ has joined #ruby
Lector has joined #ruby
torpor has joined #ruby
Scrofff has joined #ruby
enebo has joined #ruby
kies has joined #ruby
poguez_ has joined #ruby
thomasvm has joined #ruby
beneggett has joined #ruby
alex88 has joined #ruby
roolo has quit [Ping timeout: 276 seconds]
thomasvm has quit [Remote host closed the connection]
<EllisTAA>
hey yall. i want to create a crappy search engine for my homework assignment. would that be easy to do? I just have to create a spider right?
<apeiros>
fschuindt: also, if you already properly set the encoding of the string, you don't need from + to, the to alone is sufficient
<apeiros>
anyway, bottom of the line is that you want to == only with same encoding.
<fschuindt>
one script works, the other one dont. I think that is related to the line 32 @ splitter.rb. When I store the string in the array. I don't know, somewhere it mess up with the accents :((
ogpastaling has joined #ruby
bahar has quit [Ping timeout: 245 seconds]
<jhass>
I think it's the encode! line
<fschuindt>
LOL
<fschuindt>
it makes all the sense
<fschuindt>
w8 hahahahaha
<apeiros>
the strip is also relatively pointless
<apeiros>
if those 6 chars contain spaces, then the string is necessarily NOT equal to "INSERT" ;-)
<jhass>
File.new should convert to UTF-16LE to UTF-8 and then you interpret that UTF-8 as UTF-16LE and convert it to UTF-8, no?
<fschuindt>
apeiros: yeah, thats right
mandarinkin has joined #ruby
<fschuindt>
jhass: wait, what
ndrei has quit [Ping timeout: 256 seconds]
EllisTAA has quit [Quit: EllisTAA]
<_aeris_>
jhass > trouble with ./wtf.rb, no trouble with bundle exec ./wtf.rb ><
<jhass>
doesn't File.new convert to Encoding.default_internal?
<jhass>
_aeris_: then just use that :P
ebbflowgo has joined #ruby
<fschuindt>
whats the difference between enconde and encode!? the second changes the proper value, right?
<_aeris_>
jhass > not a response :P
<apeiros>
jhass: true
<jhass>
_aeris_: else you're loosing the benefit of bundler anyway
banister has joined #ruby
mdw has joined #ruby
<apeiros>
fschuindt: File.read(…, encoding: "UTF-16LE") translates to Encoding.default_internal
<jhass>
_aeris_: you can also add said require "bundler/setup" as first require, which does the same thing
<apeiros>
if you don't want it to be translated, you set external + internal encoding
<jhass>
fschuindt: and .encode with two parameters the second parameter changes how it's interpreted again
<apeiros>
another reason why 2-param encode is bad…
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<apeiros>
fschuindt: for real? what does `p Encoding.default_internal` print
Guest58610 has quit [Remote host closed the connection]
phat4life has joined #ruby
<jhass>
I'm starting to think that UCS 2 might not be as UTF-16 compatible as thought...
<phat4life>
how to i supress stdout when i am running rspec tests?
<jhass>
phat4life: >/dev/null
nertzy has joined #ruby
<fschuindt>
apeiros: p Encoding.default_internal prints nil
chipotle has joined #ruby
<jhass>
fschuindt: how about "".encoding ?
bahar has quit [Ping timeout: 265 seconds]
<jhass>
(p "".encoding)
AlphaAtom has joined #ruby
<apeiros>
sorry, got to commute. back in ~45min
[1]abirazor has quit [Read error: Connection reset by peer]
<fschuindt>
apeiros: no problem
<fschuindt>
jhass: #<Encoding:UTF-8>
treehug88 has joined #ruby
Scroff has joined #ruby
AlphaAtom has quit [Max SendQ exceeded]
fabrice31 has quit [Remote host closed the connection]
<fschuindt>
I am going out to the lunch time, see ya
iamninja has quit [Read error: Connection reset by peer]
<fschuindt>
thank you guys
yekKhaste has joined #ruby
yekKhaste has left #ruby [#ruby]
AlphaAtom has joined #ruby
fiveseven_ has joined #ruby
sem__ has quit [Ping timeout: 246 seconds]
fiveseven_ has left #ruby ["=)"]
sarkyniin has joined #ruby
commondream has quit [Remote host closed the connection]
Scrofff has quit [Ping timeout: 272 seconds]
atm0sphere has joined #ruby
commondream has joined #ruby
avat has quit [Quit: Page closed]
Jinkins has joined #ruby
Porfa has joined #ruby
zz_barkerd427 is now known as barkerd427
<_aeris_>
thanks jhass for the « non » help :P
AhabsBeard has joined #ruby
<jhass>
apeiros: looks like we're wrong and it doesn't convert, at least not in the encoding: form
rubie has joined #ruby
<jhass>
_aeris_: heh, educating on how to use bundler correctly is no help? :P
bahar has joined #ruby
rushed has quit [Quit: rushed]
startupality has quit [Read error: Connection reset by peer]
mase-chatter has quit [Quit: Leaving]
startupality has joined #ruby
dblessing has joined #ruby
atm0sphere has quit [Ping timeout: 246 seconds]
cdnsteve has joined #ruby
slawrenc_ has joined #ruby
someword has joined #ruby
<jhass>
fschuindt: I think Ruby simply doesn't support UCS-2LE and it's not UTF-16LE compatible for your usecase, you'll have to resort to an external converter or look if there's a gem that provides UCS-2LE support
Seanzie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
datanois1 is now known as datanoise
sandstrom has joined #ruby
_seanc_ has joined #ruby
bMalum has quit [Quit: bMalum]
dgutierrez1287 has joined #ruby
beneggett has quit [Quit: ...zzz ¯\_(ツ)_/¯ zzz...]
ta has quit [Remote host closed the connection]
_seanc__ has joined #ruby
<jhass>
fschuindt: or since you only care about two specific tokens, INSERT and \n, you could look up the byte sequences for these in UCS-2LE and work with that
kobain has joined #ruby
Cache_Money has joined #ruby
fschuindt has quit [Ping timeout: 272 seconds]
mrsolo has joined #ruby
_seanc_ has quit [Ping timeout: 252 seconds]
_seanc__ is now known as _seanc_
<Porfa>
hello guys...
<jhass>
hi
<Porfa>
haha whats up jhass ? :)
<Porfa>
everythings ok?
starfox_sf has joined #ruby
<jhass>
yeah
beneggett has joined #ruby
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Porfa>
there's to much heat in here some heatwave going on.. damn
<jhass>
some concert outside not matching up well with my music, but that's all
dgutierrez1287 has quit [Ping timeout: 258 seconds]
doertedev has quit [Read error: Connection reset by peer]
<Porfa>
hahah
ixti has joined #ruby
astrobunny has joined #ruby
iamjarvo has joined #ruby
<Porfa>
so i've been looking around but i rather have the opinion of an user directly, rather than a blog….
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
<phat4life>
jhass: but i have an rspec test that expects stdout
<Porfa>
i need to automate some page clicks and submits and wtv, i only have access to ssh to work on ruby… i've read about selenium and mechanize… if you could recumbent me one gem to start learning.. with one would it be?
kies has joined #ruby
mase-chatter has joined #ruby
startupality has quit [Quit: startupality]
keen___ has joined #ruby
<phat4life>
expect { AccountManager.print_report }.to output(report).to_stdout, how can i suprress the output and have this test still pass?
<Porfa>
what i want to so is to help out some employers.. i need my script to login at our company back office, select a couple of products, change the dates of the products availability, and expand the dates if required.. something like that.
hoey has quit [Quit: Connection closed for inactivity]
joaomdmoura has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
Porfa: heard good things about mechanize, pick that until it doesn't work for you
<sarkyniin>
mechanize is pretty good
keen__ has quit [Ping timeout: 256 seconds]
<sarkyniin>
using it to fetch some forum titles on a xenforo forum
xenog has left #ruby [#ruby]
solars has quit [Ping timeout: 256 seconds]
failshell has quit [Remote host closed the connection]
<Porfa>
thanks! :) and i hope mechanize is text only.. because most of the selenium tutorials i've seen required an open webbrowser..
<sarkyniin>
text only
freerobby has joined #ruby
<sarkyniin>
yeah
<Porfa>
ok, i'll make a mechanize tattoo then! thanks
starfox_sf has quit [Ping timeout: 265 seconds]
Zarthus has quit [Quit: This night will fall like any other, daylight subsides and shadows crawl.]
<borodin>
so in dev, I can do bundle install--path vendor/bundle, then check in the code, then in prod I can do bundle install --path vendor/bundle, and it'll only search there for the needed gems?
<borodin>
or bundle install --deployment?
bb010g has quit [Quit: Connection closed for inactivity]
shakes has joined #ruby
<adaedra>
if you move the vendor/bundle with the project (don't put it in VCS please) and the system is the same, it should directly use the gems in the folder I guess
<adaedra>
don't know how good of an idea it is though
tubuliferous_ has quit [Ping timeout: 245 seconds]
<borodin>
I can't build a gem server, I can't see rubygems.org from the box. I have little choice than to move the gems locally with the install
beneggett has quit [Quit: ...zzz ¯\_(ツ)_/¯ zzz...]
iamninja has quit [Ping timeout: 246 seconds]
bricker has joined #ruby
hdev1 has joined #ruby
baweaver has quit [Remote host closed the connection]
scripore has quit [Quit: This computer has gone to sleep]
iamninja has joined #ruby
barkerd427 is now known as zz_barkerd427
ogpastaling has joined #ruby
rodferso1 has joined #ruby
rodferso1 has quit [Client Quit]
aaeron has joined #ruby
commondream has quit [Remote host closed the connection]
beneggett has joined #ruby
vikaton has joined #ruby
commondream has joined #ruby
aaeron_ has joined #ruby
polysics has joined #ruby
bgmarx has joined #ruby
apofis has quit [Remote host closed the connection]
balazs has quit [Remote host closed the connection]
The_Phoenix has quit [Max SendQ exceeded]
The_Phoenix has joined #ruby
cmisenas has quit [Quit: cmisenas]
The_Phoenix has quit [Max SendQ exceeded]
The_Phoenix has joined #ruby
aapole has joined #ruby
The_Phoenix has quit [Max SendQ exceeded]
x1337807x has joined #ruby
IanVorn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
IanVorn has joined #ruby
barkerd427 is now known as zz_barkerd427
msnyon has joined #ruby
bricker has joined #ruby
balazs has joined #ruby
shakes has quit [Quit: Leaving]
ki0_ has joined #ruby
hdev1 has quit [Ping timeout: 255 seconds]
axl_ has quit [Remote host closed the connection]
n3k00n3 has joined #ruby
stamina has quit [Remote host closed the connection]
tvw has quit [Ping timeout: 256 seconds]
pengin has joined #ruby
Pqi has joined #ruby
but3k4 has quit [Ping timeout: 264 seconds]
failshell has quit [Remote host closed the connection]
chussenot has quit [Quit: chussenot]
c0m0 has quit [Ping timeout: 244 seconds]
fschuindt has joined #ruby
edwinvdgraaf has joined #ruby
ki0 has quit [Ping timeout: 252 seconds]
<Pqi>
Hello, What is the type of the object on which I can iterate such as " X.each do |key, value| " ? Is that an hashmap ? I tried to iterate on something like this: ['array'] = { x=>y, a=>b } but it doesnt seem to be the right type
mrsolo has quit [Quit: This computer has gone to sleep]
<drPoggs>
Pqi: That's a Hash, yes
Eiam has quit [Disconnected by services]
<drPoggs>
Pqi: On an Array, you could do ['foo', 'bar', 'baz'].each do |qux|...end
ki0_ has quit [Ping timeout: 276 seconds]
kerunaru has joined #ruby
<centrx>
Pqi, Could also be any Enumerable of pairs
arooni-mobile has quit [Ping timeout: 256 seconds]
quimrstorres has joined #ruby
but3k4 has joined #ruby
failshell has joined #ruby
d0lph1n98 has joined #ruby
hectortrope has quit [Quit: WeeChat 0.4.2]
mhoungbo has quit [Ping timeout: 255 seconds]
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<sarink>
is there an easy way to tell if a variable is a regex
CloCkWeRX1 has quit [Read error: No route to host]
Ox0dea has joined #ruby
hinbody has quit [Quit: leaving]
cmisenas has joined #ruby
CloCkWeRX has joined #ruby
<Ox0dea>
sarink: Regex ain't no Ruby class I ever heard of.
CamonZ has joined #ruby
<Ox0dea>
They respond_to?(last_match) in Regex?
but3k4_ has quit [Ping timeout: 265 seconds]
kies has quit [Ping timeout: 245 seconds]
aryaching has joined #ruby
unshadow has quit [Remote host closed the connection]
bgmarx has joined #ruby
DLSteve has joined #ruby
slackbotgz has quit [Read error: Connection reset by peer]
<Diabolik>
what would be the most efficient way of doing a buy one get one free method on items in an array, i.e. if there are 2 instances of item1 then only count 1
<Diabolik>
(2, 4, 6 etc)
slackbotgz has joined #ruby
failshell has quit [Remote host closed the connection]
scripore has quit [Quit: This computer has gone to sleep]
mc_fail has quit [Ping timeout: 256 seconds]
Soda has joined #ruby
<Ox0dea>
Diabolik: Provide example input and desired output.
<apeiros>
Diabolik: got an example?
shock_one has joined #ruby
CloCkWeRX has quit [Ping timeout: 255 seconds]
GnuYawk has quit [Read error: No route to host]
caconym has joined #ruby
mc_fail has joined #ruby
ghr has joined #ruby
kubunto has joined #ruby
Scroff has joined #ruby
ebbflowgo has quit [Quit: ebbflowgo]
hinbody has joined #ruby
<kubunto>
good idea or bad idea to use dropbox api to transfer files
<apeiros>
kubunto: context
__butch__ has joined #ruby
shock_one has quit [Ping timeout: 265 seconds]
StephenOTT has joined #ruby
CloCkWeRX has joined #ruby
<kubunto>
transfering pictures over the wire
<apeiros>
-.-
<_seanc_>
kubunto: what are you doing with the photos though?
<apeiros>
that's not really context.
<_seanc_>
if you’re storing them in Dropbox, then using Dropbox makes sense.
<_seanc_>
If you’re displaying them on a website, Dropbox probably doesn’t make much sense.
<apeiros>
anyway, there's much better ways than dropbox to copy data from one computer to another
<apeiros>
so without context - bad idea.
<kubunto>
midway point for file transfer
scripore has joined #ruby
symbol has joined #ruby
n3k00n3 has quit [Quit: Lost terminal]
gert7 has joined #ruby
wprice has quit [Quit: wprice]
zz_barkerd427 is now known as barkerd427
qwertme has joined #ruby
baweaver has quit [Remote host closed the connection]
jerius_ has joined #ruby
jerius has quit [Ping timeout: 245 seconds]
jackjackdripper1 has joined #ruby
jackjackdripper has quit [Ping timeout: 265 seconds]
centrx has quit [Ping timeout: 252 seconds]
towski_ has quit [Ping timeout: 276 seconds]
d0lph1n98 has quit [Ping timeout: 265 seconds]
mdw has joined #ruby
ghr has quit [Ping timeout: 246 seconds]
towski_ has joined #ruby
Porfa has quit [Ping timeout: 245 seconds]
<Ox0dea>
kubunto: That would be the Atlantic Ocean, no?
shock_one has quit [Remote host closed the connection]
hoov has quit [Quit: Leaving]
<jhass>
wait, I see zzak has commit rights...
timonv has quit [Ping timeout: 276 seconds]
nertzy has quit [Quit: This computer has gone to sleep]
lkba_ has joined #ruby
whippythellama has quit [Quit: whippythellama]
bronson has quit [Ping timeout: 264 seconds]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jpfuentes2 has joined #ruby
arooni-mobile has joined #ruby
lkba has quit [Ping timeout: 255 seconds]
robbyoconnor has quit [Ping timeout: 250 seconds]
ghr has joined #ruby
metallicrwr has joined #ruby
affenhoden has joined #ruby
aryaching_ has joined #ruby
<shevy>
another silent one
nfk has joined #ruby
<shevy>
they are IRC ghosts
xxneolithicxx has joined #ruby
<jhass>
yeah, dunno how apeiros got him talk
Scroff has quit [Remote host closed the connection]
whippythellama has joined #ruby
Scroff has joined #ruby
zotherstupidguy has quit [Ping timeout: 250 seconds]
pothibo has quit [Quit: pothibo]
aryaching has quit [Ping timeout: 276 seconds]
zotherstupidguy has joined #ruby
<drbrain>
there was a time when #ruby didn't exist
vickleton has joined #ruby
bricker has joined #ruby
discord has joined #ruby
djbkd has quit [Remote host closed the connection]
a346 has quit [Quit: a346]
<drbrain>
back when lilo (
metallicrwr has quit [Ping timeout: 276 seconds]
Scroff has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
Scroff has joined #ruby
aryaching_ is now known as aryaching
yfeldblum has joined #ruby
arescorpio has joined #ruby
Scroff has quit [Remote host closed the connection]
agilenav has joined #ruby
SouL_|_ has joined #ruby
agilenav has left #ruby [#ruby]
yqt has joined #ruby
<dfockler>
Jeremy Evans is my Ruby Hero
Scrofff has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
RobertBirnie has quit [Ping timeout: 264 seconds]
bilal has joined #ruby
discord has quit [Ping timeout: 255 seconds]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nateberkope has quit [Quit: Leaving...]
kubunto has left #ruby [#ruby]
IanVorn has joined #ruby
arooni-mobile has quit [Ping timeout: 265 seconds]
<sts>
yay!
<sts>
:)
hotpancakes has quit [Remote host closed the connection]
astrobunny has joined #ruby
RobertBirnie has joined #ruby
discord has joined #ruby
pengin has quit [Remote host closed the connection]
rbowlby has quit [Remote host closed the connection]
<dfockler>
what do people think of rubytogether?
bilal has left #ruby ["Leaving"]
hotpancakes has joined #ruby
SouL_|_ has quit [Remote host closed the connection]
bgmarx has quit [Remote host closed the connection]
sinkensabe has joined #ruby
<dfockler>
must be lunchtime in here
ebbflowgo has joined #ruby
qwertme has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
fujimura has joined #ruby
n008f4g_ has joined #ruby
qwertme has joined #ruby
nertzy has joined #ruby
jefus_ has joined #ruby
cjbottaro has joined #ruby
phutchins has quit [Ping timeout: 244 seconds]
<cjbottaro>
Hello. How come Socket.gethostbyname("blah.com") raises "Name or service not known", but `host blah.com` at the bash prompt resolves fine? Does Ruby does DNS resolution differently from the `host` command?
astrobunny has quit [Ping timeout: 272 seconds]
Scrofff has quit [Remote host closed the connection]
sandelius has joined #ruby
m8 has joined #ruby
chussenot has quit [Quit: chussenot]
<sts>
cjbottaro: yes. host would for example evaluate /etc/hosts. 'dig blah.com' wouldn't
fujimura has quit [Ping timeout: 255 seconds]
<cjbottaro>
sts: Ok, well blah.com isn't in my hosts file. Also `dig blah.com` resolved it, while Ruby's Socket.gethostbyname didn't. I'm worried that Ruby isn't using resolvconf or something... ?
djbkd has joined #ruby
ebbflowgo has quit [Ping timeout: 258 seconds]
<cjbottaro>
Ruby's Socket.gethostbyname *eventually* resolves it (these are newly created DNS entries), but host and dig resolve them much faster.
<shevy>
dfockler dunno; never even heard of rubytogether
<Ox0dea>
"Neglect" and "reject" are loosely synonymous, and #taint is OBJ_INFECT internally, so they're all covered!
jmhmccr has joined #ruby
<cjbottaro>
sts: I'm using network client libraries (for example Cassandra client, Elasticsearch client). I don't have control over how they try to resolve DNS. Is there a way to say "globally" use this method for DNS resolution?
<Diabolik>
what's the most efficient way of implementing the math logic
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
zotherstupidguy has joined #ruby
Scroff has joined #ruby
OrbitalKitten has joined #ruby
_aeris_ has left #ruby ["Konversation terminated!"]
frem has joined #ruby
hotpancakes has quit []
adefa has quit [Ping timeout: 250 seconds]
<dfockler>
Diabolik: usually checkout systems have a finished with transaction that generates the total
<Diabolik>
yeah i was debating whether it was better to deduct at the ned
<Diabolik>
*end
decoponio has quit [Quit: Leaving...]
<Diabolik>
or to do it within the alog
<Diabolik>
algo
yalue has quit [Read error: Connection reset by peer]
<dfockler>
otherwise you have to check the current state against the discount rule on every scan
ta has quit [Ping timeout: 252 seconds]
<dfockler>
which could work based on the item, just check rules related to that item
centrx has joined #ruby
chadwtaylor has joined #ruby
baweaver has joined #ruby
<dfockler>
it gets harder when you have something mixing item discounts together
<Ox0dea>
So strawberries are buy three, get 10% off instead of BOGO? That's practically a racket!
pikos has quit [Remote host closed the connection]
<dfockler>
Ox0dea: at scale that would really add up
<Ox0dea>
You should organize some sort of strike, and perhaps even motion to litigate.
premera has joined #ruby
finisherr has joined #ruby
<Ox0dea>
dfockler: BOGO tends to be repeatedly applicable.
Iskarlar has joined #ruby
hplar has joined #ruby
<Ox0dea>
So the "deal" on strawberries is really just turning the customer's discount from 50% to ten.
<Ox0dea>
It's outrageous.
<Ox0dea>
Diabolik: Do you have a lawyer?
tubuliferous_ has joined #ruby
bgmarx has joined #ruby
segfalt has quit [Quit: segfalt]
sinkensabe has quit [Remote host closed the connection]
willharr_ has joined #ruby
baweaver has quit [Ping timeout: 276 seconds]
<Diabolik>
lol
choke has joined #ruby
<Ox0dea>
I don't think you appreciate the gravity of the situation.
faitswulff1 has joined #ruby
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
segfalt has joined #ruby
faitswulff1 has quit [Client Quit]
centrx has quit [Ping timeout: 252 seconds]
faitswulff1 has joined #ruby
bgmarx has quit [Remote host closed the connection]
sdwrage has joined #ruby
sarkyniin has quit [Read error: No route to host]
<Aria>
Four inches.
nonparfumee has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tubuliferous_ has quit [Ping timeout: 256 seconds]
sarkyniin has joined #ruby
faitswulff1 has left #ruby [#ruby]
<Aria>
But Diabolik, I don't think efficiency is the thing you have to worry about -- business computers have always done slow decimal math and been fine. What'd be good to focus on is clear logic for calculating, and figuring out if anything needs to be rule-driven. Ad hoc logic around discounts gets dicy.
slawrenc_ has quit [Ping timeout: 265 seconds]
stoogenmeyer__ has quit [Ping timeout: 265 seconds]
centrx has joined #ruby
timonv has joined #ruby
centrx has quit [Remote host closed the connection]
<shevy>
four inches.... hmmm
bgmarx has joined #ruby
centrx has joined #ruby
robbyoconnor has quit [Ping timeout: 265 seconds]
polysics has quit [Remote host closed the connection]
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
x1337807x has joined #ruby
AlphaAtom has joined #ruby
<Ox0dea>
MRI used to have a function called Fdic_length().
<Ox0dea>
Back when Hash was Dict.
AlphaAtom has quit [Max SendQ exceeded]
dseitz has joined #ruby
<Diabolik>
Aria should i do a module called Rules
<Diabolik>
with all this shit in there?
AlphaAtom has joined #ruby
<Aria>
Perhaps. That gets into the business case and how this will actually change.
<Aria>
And gets into user interface concerns.
cntrx has joined #ruby
AlphaAtom has quit [Max SendQ exceeded]
baweaver has joined #ruby
AlphaAtom has joined #ruby
Fooster has quit [Ping timeout: 265 seconds]
AhabsBeard has joined #ruby
ylla has quit [Ping timeout: 252 seconds]
AlphaAtom has quit [Max SendQ exceeded]
tjbiddle has quit [Ping timeout: 276 seconds]
havenwood has joined #ruby
AlphaAtom has joined #ruby
cntrx has quit [Client Quit]
cntrx has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
AlphaAtom has quit [Max SendQ exceeded]
AlphaAtom has joined #ruby
tjbiddle has joined #ruby
dfockler has quit [Remote host closed the connection]
jaycee_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sarkyniin has quit [Ping timeout: 276 seconds]
ta has joined #ruby
rbowlby has joined #ruby
sarkyniin has joined #ruby
_ht has quit [Quit: Konversation terminated!]
baweaver has quit [Remote host closed the connection]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
nertzy has quit [Quit: This computer has gone to sleep]
cntrx has quit [Ping timeout: 244 seconds]
arooni-mobile has joined #ruby
doodleha_ has joined #ruby
mello has quit [Ping timeout: 272 seconds]
ckrailo has quit [Read error: Connection reset by peer]
zzak has quit [Read error: Connection reset by peer]
djbender has quit [Read error: Connection reset by peer]
Guest5307 has quit [Read error: Connection reset by peer]
deric_skibotn has quit [Ping timeout: 264 seconds]
freerobby has quit [Quit: Leaving.]
<havenwood>
ddfreyne: I think I'd rather go in the direction of Elixir's ExUnit, which I think is simple and elegant and sure has a heck of a lot fewer assertions.
<adaedra>
Well, I guess "Don't use be_true" would be clearer than "Undefined true.true?"...
tjbiddle has quit [Ping timeout: 256 seconds]
tjbiddle_ is now known as tjbiddle
<ddfreyne>
havenwood: Whatever works for you!
<ljarvis>
meh, who defines true? and false? methods. Their expect object should just handle it
<Sou|cutter>
why would somebody new to rspec at this point expect be_true to work in a different way than be_XXX ?
<Sou|cutter>
I think that may be the argument
eggoez has quit [Ping timeout: 272 seconds]
<ddfreyne>
I found RSpec's contexts quite useful for catching all cases, and shared_examples to verify that two objects that are supposed to behave the same, actually *do* behave the same.
<ddfreyne>
I haven't found a good way to do that in minitest as nicely yet.
scripore has joined #ruby
<adaedra>
The thing I don't like the most about rspec is that their HTML report is hideous.
michaeldeol has joined #ruby
<Sou|cutter>
matchers also give you pretty good output for 'free' (not in terms of perf, but in terms of you having to think about it)
speakingcode has joined #ruby
duggiefresh has quit [Remote host closed the connection]
<volty>
you should learn it a bit, before trying it
<jhass>
whether that's what you actually want, *shrug*
<lindii_>
which one of both
<jhass>
they're the same
rubie has joined #ruby
gambl0re has quit [Ping timeout: 245 seconds]
<Sevelina>
lindii_: For what reason? Hobby/Job?
<Sevelina>
There are called hashes, the => way is an older way.
<jhass>
Sevelina: why's that important?
wald0 has joined #ruby
<jhass>
s/older/general/
ur5us has quit [Remote host closed the connection]
plashchynski has quit [Quit: plashchynski]
<Sevelina>
jhass: Older.
<jhass>
general
bronson has quit [Ping timeout: 252 seconds]
<lindii_>
Sevelina: hobby
OrbitalKitten has joined #ruby
<lindii_>
im a lawyer.. nothing to do with programming
bkxd_ has joined #ruby
<Sevelina>
lindii_: Then reconsider my advice.
bkxd_ has quit [Client Quit]
Palmer11 has joined #ruby
<Sevelina>
lindii_: Learn both Ruby and Elixir.
<volty>
why not another then of them ?
<volty>
s/then/ten/
<jhass>
Sevelina: it's great that you like Elixir, however they picked Ruby and came here for help with it, please respect their choice
bkxd has quit [Ping timeout: 264 seconds]
<lindii_>
like they adopt too many conventions to do one thing
<lindii_>
i dont like that
hinbody has quit [Quit: leaving]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Sevelina>
jhass: You don't know that something exist before someone tells you or you find out.
paulcsmith has joined #ruby
iamninja has joined #ruby
AhabsBeard has quit []
<Sevelina>
lindii_: What is it that you don't like?
<jhass>
Sevelina: first time was mentioning it, second time is talking them out
c355E3B has joined #ruby
hotpancakes has joined #ruby
<jhass>
(is that English? it's too late here)
KrzaQ has quit [Read error: Connection reset by peer]
<volty>
it's small coinish :)
<lindii_>
jhass: i want to define a constant with attributes and a profile object
<lindii_>
looks like a profile array
<jhass>
lindii_: perhaps you want two structs?
<Sevelina>
jhass: Talking them out? I'm a professional Ruby developer for ~8 years. You should try and teach people from your own mistakes rather than whining about it.
<lindii_>
jhass: by the way is something im trying with rails
<lindii_>
jhass: nesting attributes
<jhass>
uh
KrzaQ has joined #ruby
<Sevelina>
lindii_: Do you understand the difference between hashes and arrays?
<jhass>
lindii_: I agree with Sigma00, you're not having repetition there
<lindii_>
yes
idafyaid has quit [Ping timeout: 265 seconds]
<lindii_>
hashes = associative arrays
<jhass>
well, map is the general term
<jhass>
associative array is the PHP term
mikecmpbll has quit [Quit: i've nodded off.]
havenwood has joined #ruby
<lindii_>
right.. same as dictionaries in python
scripore has joined #ruby
<dorei>
isn't hashtable the general term? :p
<Sevelina>
dorei: No.
shock_one has quit [Remote host closed the connection]
<eam>
hash is a typical implementation of a dictionary and is what most people use to call it generally
<eam>
arguably yes but the kids aren't doing it anymore
DEA7TH_ has quit [Ping timeout: 255 seconds]
hakunin has quit [Remote host closed the connection]
idafyaid has joined #ruby
<eam>
iirc php doesn't have an array type
<jhass>
dictionary is just what python (and perl I guess? :P) calls it
<eam>
it's all an associative map
hakunin has joined #ruby
<Sevelina>
jhass: And C#.
<eam>
perl calls it hash
<volty>
I call it «what's in a name?»
<eam>
I think python ushered in the "dictionary" terminology, I guess they're trying to distinguish the function from the implementation
startupality has quit [Quit: startupality]
lacrosse__ has joined #ruby
bkxd has joined #ruby
<eam>
php is crazy land, the "array" there is actually a hash
<Sevelina>
lindii_: Symbols are immutable. Strings, compared to symbols, when used are new objects. So if you use a string as a key 50 times, you are creating 50 different strings. With symbols, it's 1.
metallicrwr has quit [Ping timeout: 256 seconds]
<lindii_>
got it
<volty>
and encoded, so no comparison is necessary
<Ox0dea>
volty: Interned.
wldcordeiro has quit [Quit: Konversation terminated!]
<ruboto>
a1fa, we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[H]unt3r has joined #ruby
mdz_ has quit [Remote host closed the connection]
hakunin has quit [Remote host closed the connection]
<a1fa>
i'm trying to print id,make,new,description
<jhass>
a1fa: the bot didn't repost, that means it's at least the second time you used pastebin.com
<volty>
a1fa: have not used it much; only headache is that I can't use it with qtruby (and don't know why)
<jhass>
a1fa: yes, because xpath works differently than CSS
<jhass>
a1fa: if you know CSS, why use xpath?
pengin has joined #ruby
chrisgeorge has quit [Remote host closed the connection]
Scroff has quit [Ping timeout: 256 seconds]
<a1fa>
because i keep going from tutorial to tutorial, and nothing wants to work right :(
pandaant has quit [Remote host closed the connection]
fujimura has joined #ruby
<jhass>
aaeron: uh, my scrollback doesn't seem to have the context for that, so that means and so does my memory ;)
millerti has joined #ruby
<aaeron>
Ok
tjbiddle has joined #ruby
<aaeron>
jhass, I am getting the code
<aaeron>
Will update you
<aaeron>
in a moment
<jhass>
a1fa: well, what's your actual problem?
<aaeron>
thanks for the reply
someword has quit [Ping timeout: 255 seconds]
djbkd has quit [Remote host closed the connection]
<volty>
eam: thx, interesting.
<a1fa>
jhass: not knowing how to read nokogiris documentation for the most part
fgo has joined #ruby
<kinduff>
I'm developing this gem and I'm adding geocoder gem as a dependency inside my gemspec file. When I add it to my project it's not being grabbed. I'm calling `require 'geocoder'` from lib/gem_name.rb file. Any ideas?
chadwtaylor has quit [Ping timeout: 265 seconds]
dopie has quit [Quit: This computer has gone to sleep]
<jhass>
a1fa: we can help you with an actual problem, teaching very general things from the ground up is a bit out of scope ;)
mandarinkin has quit [Ping timeout: 265 seconds]
<a1fa>
so if i do doc.css and i loop through each car, how do i access id attribute in the car?
Iskarlar has joined #ruby
<jhass>
a1fa: treat the node like a hash
<jhass>
car["id"]
<a1fa>
oO
djbkd has joined #ruby
* a1fa
tests.
<eam>
volty: it's fixed in newer rubies though, so :) but the cost of comparing contiguous areas of memory is so very small it's easy for other aspects of the VM to overshadow -- the trouble with micro-optimizing in a high level language like ruby
<jhass>
well, n["id"] in your example
sandstrom has quit [Quit: My computer has gone to sleep.]
<jhass>
a1fa: btw do you know pry? it's great to play and discover an API with it
<a1fa>
i'll be damned ;)
<eam>
I wrote a binding for a shared memory hash table a few weeks ago. The cost of looking up an ivar is about on par with the entire cost of doing the store/fetch operations entirely
<a1fa>
i've heard of pry, have not used it -- i will look it up
RobertBirnie has joined #ruby
<jhass>
?pry a1fa
<ruboto>
a1fa, Pry, the better IRB. Includes easy object inspection via `ls`, `history`, docs view with `?`, source view with `$` and syntax highlighting, among other features (see `help` for more). It can also be used for easy debugging by putting ’binding.pry’ directy in your source code. Visit https://pryrepl.org/ or get it now with gem install pry pry-doc
<eam>
(because, you know, accessing a variable by name is itself a hashtable operation)
RobertBirnie has quit [Excess Flood]
<volty>
a1fa: page.xpath('//cars')
fujimura has quit [Ping timeout: 244 seconds]
RobertBirnie has joined #ruby
mrsolo has quit [Quit: Leaving]
mello has joined #ruby
mello has quit [Changing host]
mello has joined #ruby
<jhass>
volty: not the same and not the best xpath (avoid // where possible, it's slow) ;)
<jhass>
the xpath I'd go with is /cars/car, but why bother if the css selector works for them and is understood
<volty>
jhass: I prefer css, but since I noticed he was indexing with only one / ...
davidhq has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mello has quit [Ping timeout: 256 seconds]
<dorei>
jhass: i use xpaths starting with // all the time without noticable delays. i think that more time is needed to fetch the page than run the xpath query
pengin has quit [Remote host closed the connection]
Fooster has joined #ruby
revoohc has joined #ruby
Langlands has joined #ruby
<jhass>
yes, still it's good habit to avoid them and learn how to avoid them while doing that, since the day will come that running one on a big XML tree will screw you
axsuul has quit [Ping timeout: 255 seconds]
<volty>
yap, it could matter only if running inside something like web server serving heavy traffic. Btw I do not have memory for slow vs fast — I usually (unintentionally) just ignore notions about what is slow or fast.
mary5030 has joined #ruby
millerti has quit [Ping timeout: 246 seconds]
<jhass>
developing notions for cheap and expensive helped me
prereflect has joined #ruby
zotherstupidguy has quit [Ping timeout: 265 seconds]
<jhass>
in this example consider how many nodes /cars/car needs to iterate over and how many nodes //car would need to iterate over to come to the conclusion that there's no match
<volty>
«developing» is a quite wide paradigm — there are high level considerations that could be spoiled (distracted) by low level ones
<volty>
never mind, the processors get cheaper and cheaper :)
spider-mario has quit [Ping timeout: 255 seconds]
mister_solo has quit [Ping timeout: 272 seconds]
<volty>
and, otherwise, I could stay with c++ if the main purpose is the speed
<jhass>
you mean crystal :P
avat has quit [Quit: Page closed]
spider-mario has joined #ruby
<volty>
yap, could be a personal taste, at the end — I get distracted by that kind of considerations, other people could just have got used, without burden :)
zotherstupidguy has joined #ruby
zotherstupidguy has quit [Changing host]
zotherstupidguy has joined #ruby
Ropeney has joined #ruby
mary5030 has quit [Ping timeout: 244 seconds]
marr has quit [Ping timeout: 244 seconds]
<jhass>
I'm not saying to desperately seek the cheapest solution all the time
<jhass>
this was a case for a quite obvious one if you consider what amount of work each has to do
pengin has joined #ruby
axsuul has joined #ruby
axsuul has quit [Max SendQ exceeded]
<a1fa>
this really sucks ;(
<volty>
I know, I know. I remember you. And I appreciate the advice. The mines were more about some people that I find on scripting langs channels talking all the time about optimizing on speed, speed, speed :)
axsuul has joined #ruby
axsuul has quit [Max SendQ exceeded]
<a1fa>
so docs.xpath('//cars').each doesnt work eaither
<jhass>
sigh
<jhass>
dorei see what you did!
<jhass>
:P
axsuul has joined #ruby
<jhass>
a1fa: again, why not stick to the one that was working?
jack_rabbit has joined #ruby
bruno- has quit [Ping timeout: 265 seconds]
Channel6 has quit [Quit: Leaving]
<jhass>
dorei: oh, sorry, it was volty with the cars typo
astrobunny has joined #ruby
<a1fa>
jhass: because i got other elements within it
vikaton has joined #ruby
<jhass>
a1fa: the (correct) xpath won't change that
Maxed has quit [Quit: Maxed]
rubie has quit [Remote host closed the connection]
<al2o3-cr>
o/
hahuang65 has quit [Ping timeout: 276 seconds]
<a1fa>
so i want to loop through all cars, if i do what i posted
bkxd has quit [Ping timeout: 265 seconds]
wallerdev has joined #ruby
<atmosx>
aloha
<a1fa>
i can only get the car id, cant go back down and get the type, unless i do another doc.css('type')
<a1fa>
but then there is no guaruantee you are matching to the correct car
<volty>
docs.xpath('//car')
<al2o3-cr>
umadbro
<a1fa>
volty: thast didnt work
<atmosx>
how's everybody?
<jhass>
volty: sigh, really?
<volty>
car, singular
<a1fa>
and if jhass says it wont help, it wont help :(
hahuang65 has joined #ruby
<jhass>
a1fa: type = car.css('type') (or n.css('type') in your example)
<a1fa>
within doc.css?
<jhass>
yes
astrobunny has quit [Ping timeout: 256 seconds]
<al2o3-cr>
yes nokogiri very nice
<a1fa>
i hate you :)
<jhass>
mh, may need a .first or you use car.at('type')
<jhass>
I always forget about that
<a1fa>
it worked just fine
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
msnyon has quit [Read error: Connection reset by peer]
<volty>
you cannot strip from CDATA that way
meph has joined #ruby
asteros has quit [Quit: asteros]
<jhass>
could do Nokogiri::HTML(n.at('description').text).text
mark[oz] has quit [Remote host closed the connection]
tubuliferous_ has quit [Ping timeout: 265 seconds]
willharr_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<volty>
though I'm curious why the need to strip from cdata
mistermocha has quit [Ping timeout: 256 seconds]
djbkd has quit [Remote host closed the connection]
dorei has quit []
<a1fa>
if i do .at
<a1fa>
if i do .at - it only prints the first <description>
baweaver has quit [Remote host closed the connection]
<a1fa>
eventhough i am looping through all cars by usind doc.css('cars')
<jhass>
sounds like you do doc.at
<jhass>
instead of n.at
ldnunes has quit [Quit: Leaving]
j4cknewt has quit [Remote host closed the connection]
qwertme has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<a1fa>
check
wald0 has quit [Ping timeout: 256 seconds]
j4cknewt has joined #ruby
<a1fa>
ok this is now starting to make more sense
<volty>
imho .text does not properly handle ctext. (though i am bit tired)
hotpancakes has quit [Remote host closed the connection]
victorkohl has quit []
<volty>
though it shouldn't handle it at all
michael_mbp has quit [Excess Flood]
whippythellama has quit [Quit: whippythellama]
prereflect has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
zubov has joined #ruby
Yiota has joined #ruby
charliesome has joined #ruby
commondream has quit [Ping timeout: 258 seconds]
<ght>
Quetsion: I have a ruby app and I need to launch a lightweight web server on the host to accept commands from a separate ruby app, just wondering on thoughts regarding that.