<yorickpeterse>
Well in this case you're using both single and double quotes in the XML
<yorickpeterse>
So you can either use %q{xml here} or use heredocs
<harly>
use %( ... )
<yorickpeterse>
So you'd get something like:
<harly>
what he said.
<yorickpeterse>
REXML::Document.new <<-EOF
<yorickpeterse>
xml here
<yorickpeterse>
EOF
apeiros has quit [Ping timeout: 245 seconds]
<flujan>
ow, thanks for the tip. Will give it a try.
amerine has joined #ruby-lang
ender|dkm has quit [Ping timeout: 264 seconds]
<harly>
what does the - do in <<- there yorick?
<yorickpeterse>
harly: allows you to smack the "EOF" bit at the same indentation
<yorickpeterse>
otherwise it has to be at the start of the line
twe4ked has joined #ruby-lang
<yorickpeterse>
In this case it doesn't really matter though
<harly>
oh handy. does it remove leading spaces from quoted part as well?
<flujan>
it worked. Thanks for the tips guys!
dm78 has quit [Remote host closed the connection]
<yorickpeterse>
harly: No
<yorickpeterse>
You can use something like <<-EOF.strip for that
amerine has quit [Ping timeout: 260 seconds]
yatish27 has joined #ruby-lang
ledestin has quit [Ping timeout: 245 seconds]
skade has joined #ruby-lang
ledestin_ has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yatish27_ has joined #ruby-lang
yatish27 has quit [Ping timeout: 245 seconds]
earthquake has joined #ruby-lang
Guest85122 has quit [Quit: This computer has gone to sleep]
tbuehlmann has quit [Quit: Leaving]
solars has quit [Ping timeout: 255 seconds]
dwknoxy has joined #ruby-lang
chussenot has joined #ruby-lang
nutl has joined #ruby-lang
<harly>
Object.const_get(:Help).new will create a new Help obj. but if the help is defined as class Foo::Help, then that shortcut doesn't work. Is there a way?
<yorickpeterse>
Foo.const_get(:Help).new
<harly>
super typ
<harly>
ty*
tmegano has quit [Ping timeout: 255 seconds]
tmegano has joined #ruby-lang
ironhide_604 has quit [Ping timeout: 260 seconds]
maceto has joined #ruby-lang
yfeldblum has joined #ruby-lang
yatish27_ has quit [Remote host closed the connection]
yfeldblum has quit [Ping timeout: 255 seconds]
|jemc| has quit [Ping timeout: 255 seconds]
bsvineeth has joined #ruby-lang
bsvineeth has quit [Remote host closed the connection]
bsvineeth has joined #ruby-lang
arBmind1 has quit [Quit: Leaving.]
banister has joined #ruby-lang
arBmind has joined #ruby-lang
banister has quit [Max SendQ exceeded]
arBmind has quit [Client Quit]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
tmegano has quit [Ping timeout: 255 seconds]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
karamazov has quit [Remote host closed the connection]
banister has joined #ruby-lang
bsvineeth has quit [Remote host closed the connection]
bsvineeth has joined #ruby-lang
Miphix has quit [Quit: Leaving]
toastynerd has quit [Remote host closed the connection]
maceto has quit [Read error: Connection reset by peer]
maceto has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bsvineeth has quit [Ping timeout: 255 seconds]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
AlJaMa has quit [Ping timeout: 245 seconds]
Kats has joined #ruby-lang
bsvineeth has joined #ruby-lang
<Kats>
Rubi?
fullybaked has quit []
amerine has joined #ruby-lang
Kats has quit [Client Quit]
Guest19040 has quit [Read error: Connection reset by peer]
AlJaMa has joined #ruby-lang
dm78 has joined #ruby-lang
Guest19040 has joined #ruby-lang
amerine has quit [Ping timeout: 255 seconds]
<centrx>
Rubby
maceto has quit [Read error: Connection reset by peer]
maceto has joined #ruby-lang
maceto has quit [Client Quit]
dm78 has quit [Ping timeout: 260 seconds]
luiz_ has joined #ruby-lang
luiz_ is now known as Guest51987
Guest19040 has quit [Read error: Connection reset by peer]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
vintik has joined #ruby-lang
banister has joined #ruby-lang
anildigital has quit [Changing host]
anildigital has joined #ruby-lang
bsvineeth has quit [Remote host closed the connection]
bsvineeth has joined #ruby-lang
symm- has quit [Ping timeout: 240 seconds]
bsvineet_ has joined #ruby-lang
bsvineeth has quit [Read error: No route to host]
dm78 has joined #ruby-lang
<apt-get_>
if I wanted to replace ' in a string with \'
centrx has quit [Quit: Mead error: Connection reset by beer]
Meta5 has quit [Client Quit]
amerine has quit [Ping timeout: 255 seconds]
qba73 has quit []
wallerdev has joined #ruby-lang
Meta5 has joined #ruby-lang
omosoj has joined #ruby-lang
Meta5 has quit [Client Quit]
MSY has joined #ruby-lang
MSY is now known as Guest88885
alexju has joined #ruby-lang
alexju has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
yfeldblum has quit [Ping timeout: 255 seconds]
Guest88885 has quit [Quit: Leaving]
flujan has quit [Quit: flujan]
tmegano has joined #ruby-lang
bsvineet_ has quit [Remote host closed the connection]
yatish27 has joined #ruby-lang
bsvineeth has joined #ruby-lang
hellangel7 has joined #ruby-lang
j4cknewt has joined #ruby-lang
skade has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
AKASkip has joined #ruby-lang
symm- has joined #ruby-lang
toastynerd has joined #ruby-lang
bsvineeth has quit [Ping timeout: 260 seconds]
skade_ has joined #ruby-lang
toastynerd has quit [Ping timeout: 255 seconds]
skade has quit [Ping timeout: 260 seconds]
torrieri has quit [Quit: Leaving...]
mmus has joined #ruby-lang
wallerdev has joined #ruby-lang
wallerdev has quit [Client Quit]
workmad3 has quit [Ping timeout: 260 seconds]
banister is now known as banisterfiend
allomov has quit [Remote host closed the connection]
bsvineeth has joined #ruby-lang
earthquake has quit [Quit: earthquake]
toastynerd has joined #ruby-lang
toastynerd has quit [Read error: No route to host]
LBo has joined #ruby-lang
relix has quit [Read error: Connection reset by peer]
relix has joined #ruby-lang
thegeekinside has joined #ruby-lang
diegoviola has joined #ruby-lang
amerine has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
skade has joined #ruby-lang
allomov has joined #ruby-lang
amerine has quit [Ping timeout: 245 seconds]
skade_ has quit [Ping timeout: 260 seconds]
amerine has joined #ruby-lang
rue has quit [Remote host closed the connection]
king313 has joined #ruby-lang
king313 has quit [Changing host]
king313 has joined #ruby-lang
yfeldblum has joined #ruby-lang
torrieri has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
yfeldblum has quit [Ping timeout: 255 seconds]
wallerdev has joined #ruby-lang
ender|dkm has joined #ruby-lang
x0f has quit [Ping timeout: 240 seconds]
x0f has joined #ruby-lang
shinnya has quit [Ping timeout: 255 seconds]
robmiller1 has joined #ruby-lang
robmiller has quit [Read error: Connection reset by peer]
omosoj has quit [Ping timeout: 260 seconds]
apt-get_ has quit [Ping timeout: 245 seconds]
<j4cknewt>
hey, I'm getting an error whenever I try to gem install anything. Found some mismatch issues between RVM / gem / ruby but think I fixed them. Still getting gem install error though
<yorickpeterse>
j4cknewt: what is your question?
<j4cknewt>
The error is: (Gem::RemoteFetcher::FetchError) Errno::ETIMEDOUT: Operation timed out - connect(2) for "your-dns-needs-immediate-attention.network"
<j4cknewt>
Do you have any idea what could cause this
<yorickpeterse>
hahaha that DNS hostname
<yorickpeterse>
Is that the actual name?
<j4cknewt>
i dont know what that name is
<yorickpeterse>
If this is a public network I'd strongly suggest you unplug your network now and change all your passwords, that or I'm being overly paranoid
<yorickpeterse>
Either way, it's a timeout problem
<yorickpeterse>
Meaning the `gem` command couldn't connect to RubyGems
<j4cknewt>
Hmm. it's not a public network.
<j4cknewt>
I can install things in a gemfile
<yorickpeterse>
Does it specify a source to install from?
<yorickpeterse>
That is, is there a line anywhere that says something like `source '...'`
<j4cknewt>
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
<necrosorc>
but sometimes I can't figure it out and need someone to explain it, so I appreciate that...
<necrosorc>
yeah :)
<jhass>
sure, don't be afraid to ask here
<necrosorc>
thanks
<jhass>
if you're through that best try to solve a small problem you already solved in another language or you have regularly. Then post your solution here and ask for (style) comments
maceto has joined #ruby-lang
<necrosorc>
I don't know other languages, this is my first
mistym has joined #ruby-lang
maceto has left #ruby-lang [#ruby-lang]
yatish27_ has joined #ruby-lang
<jhass>
then even more so ;)
yatish2__ has joined #ruby-lang
charliesome has quit [Quit: zzz]
yatish27_ has quit [Ping timeout: 260 seconds]
momomomomo`away has quit [Quit: momomomomo`away]
objectiveous has joined #ruby-lang
enkristoffer has quit [Quit: ❤]
objectiveous has left #ruby-lang [#ruby-lang]
hotpancakes has joined #ruby-lang
yatish27 has joined #ruby-lang
yatish2__ has quit [Ping timeout: 245 seconds]
mistym has quit [Remote host closed the connection]
vikasyaligar has joined #ruby-lang
saarinen has joined #ruby-lang
bin7me has joined #ruby-lang
hotpancakes has quit [Remote host closed the connection]
kaji has quit [Ping timeout: 240 seconds]
[spoiler] has quit [Quit: Leaving]
yfeldblum has joined #ruby-lang
nathanstitt has joined #ruby-lang
bsvineeth has quit [Remote host closed the connection]
<apt-get_>
I don't know why it's returning this, since I didn't execute the request
<apt-get_>
:/
<apt-get_>
anyone knows why?
mjc__ has joined #ruby-lang
vikasyaligar has quit []
yatish27_ has quit [Remote host closed the connection]
<yorickpeterse>
apt-get_: you can pass your variable bindings directly into the "execute" method
<yorickpeterse>
e.g.
<yorickpeterse>
db.execute('select * from users where name = ?', 'Alice')
<yorickpeterse>
You can also use named bindings if that's easier
<yorickpeterse>
db.execute('select * from users where name = :name', :name => 'Alice')
ldnunes has quit [Quit: Leaving]
arooni-mobile has joined #ruby-lang
torrieri has quit [Read error: Connection reset by peer]
benanne has quit [Quit: kbai]
saarinen has quit [Quit: saarinen]
bin7me has quit [Read error: Connection reset by peer]
torrieri has joined #ruby-lang
diegoviola has joined #ruby-lang
Lewix has joined #ruby-lang
Lewix has quit [Changing host]
Lewix has joined #ruby-lang
j4cknewt has quit [Remote host closed the connection]
charliesome has quit [Quit: zzz]
j4cknewt has joined #ruby-lang
fenchurch_ has quit [Quit: Connection closed for inactivity]
yatish27 has joined #ruby-lang
thegeekinside has joined #ruby-lang
sepp2k has joined #ruby-lang
j4cknewt has quit [Ping timeout: 255 seconds]
arooni-mobile has quit [Ping timeout: 260 seconds]
tmegano has quit [Ping timeout: 255 seconds]
vintik has quit [Remote host closed the connection]
amerine has joined #ruby-lang
rizel has joined #ruby-lang
<yorickpeterse>
whitequark: so some "Big Data News" account retweeted that kafka tweet
<yorickpeterse>
That alone means I've done my job well enough
skade has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<whitequark>
hahaha
arooni-mobile has joined #ruby-lang
<yorickpeterse>
there's also some startup tabs account fav'ing my stuff
tmegano has joined #ruby-lang
<yorickpeterse>
currently feeding the corpus with random non buzzword stuff
<yorickpeterse>
e.g. declaration of independence, pride & prejudice, etc
<yorickpeterse>
HackerNews comments sadly contain too many buzzwords so it gets a bit too weird most of the time
<whitequark>
I was once going to feed a shared corpus of 50/50 asstr.org and quantum mechanics papers
<yorickpeterse>
haha
skade has quit [Quit: Computer has gone to sleep.]
<yorickpeterse>
I set up yorick_ebooks a while ago but meh, fucking twitter doesn't let me get a write-capable API key
<yorickpeterse>
Because they don't support setting up a mobile phone in .nl I can't request one
MichD is now known as michd
<whitequark>
yorickpeterse: you can get like
<whitequark>
Google Voice
<whitequark>
or do they only send SMS?
<whitequark>
oh, Google Voice actually allows SMS
AKASkip has quit [Ping timeout: 255 seconds]
<yorickpeterse>
meh too much effort
arBmind1 has joined #ruby-lang
arBmind has quit [Ping timeout: 260 seconds]
<yorickpeterse>
"CircleCI we're building a Full Stack Engineer: We’re looking for a more experienced engineers, or engineers with a strong all-rounder" pfff haha
riffraff has quit [Quit: Leaving]
thegeekinside has quit [Quit: (null)]
ItSANgo has joined #ruby-lang
apt-get_ has quit [Quit: Quitte]
webhat_ is now known as webhat
brnorion has joined #ruby-lang
allomov has quit [Remote host closed the connection]
solars has quit [Ping timeout: 245 seconds]
j4cknewt has joined #ruby-lang
lele has quit [Read error: Connection reset by peer]
<rizel>
Hi everybody
<rizel>
I'm trying to get the keys from a hash
arooni-mobile has quit [Ping timeout: 245 seconds]
<rizel>
my hash is set in this way:
<rizel>
matrix = Hash.new("total"=> 0)
<rizel>
so then I do:
<rizel>
matrix["hello"]["total"]+=1
vintik has joined #ruby-lang
<rizel>
but when I try to get the keys from my hash with matrix.keys it just shows me []
<rizel>
why is that?
<bnagy>
try the block form
<rizel>
as mentioned before, I'm trying to get the list of keys from that hash, in this case "hello"
<matled>
rizel: you never used Hash#[]=, i.e. never created an element
vintik has quit [Ping timeout: 245 seconds]
<bnagy>
rizel: yeah and I'm saying use the block form for new
<matled>
rizel: Hash.new(foo) creates a hash with a default value, i.e. Hash#[] will return that element, but not create an entry for that
<bnagy>
you're creating an ephemeral hash and discarding it
<matled>
rizel: Hash.new { |hash,key| hash[key] = default_value } can be used to create entries whenever you access a key through Hash#[]
<rizel>
hmm
<rizel>
but
<matled>
i.e. the block will be executed on #[] if the key does not exist, and then create an entry with the default value
tmegano has quit [Ping timeout: 255 seconds]
<rizel>
but, why does it return me a value when I do: matrix["hello"]
charliesome has joined #ruby-lang
<bnagy>
because you told it to
<matled>
rizel: Hash.new(foo) is the same as Hash.new { |hash,key| foo }. When you call Hash#[] it just returns the default value, but does not modify the Hash itself
<matled>
rizel: you need to call Hash#[]= to modify the hash. i.e. matrix["hello"] = something
<necrosorc>
can someone explain why the code here pushes odd values to return instead of the even ones? reading the code, it seems to me that it's saying if the remainder of i divided by two is zero then push the results to return, yet pushing the odd results clearly is the opposite....what am I getting wrong? https://gist.github.com/anonymous/d42adadeb3b643892924
<rizel>
ok thanks :)
apeiros has quit [Remote host closed the connection]
j4cknewt has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
<necrosorc>
sorry I kept saying return but should have been saying result
j4cknewt has joined #ruby-lang
<matled>
necrosorc: i % 2 == 0 <=> i is even. so you do "next" for all even numbers and put the odd ones into the array.
<necrosorc>
ah..
<matled>
next skips the remainder of the loop body
<matled>
i.e. read as "next iteration"
<necrosorc>
right
<necrosorc>
thank you I understand
j4cknewt has quit [Read error: No route to host]
necrosorc is now known as firesorc
j4cknewt has joined #ruby-lang
j4cknewt has quit [Remote host closed the connection]
j4cknewt has joined #ruby-lang
michaeldeol has joined #ruby-lang
brnorion has quit [Ping timeout: 255 seconds]
j4cknewt has quit [Ping timeout: 255 seconds]
j4cknewt has joined #ruby-lang
mistym has joined #ruby-lang
mjc__ has quit [Quit: Connection closed for inactivity]
Guest89619 has quit [Quit: This computer has gone to sleep]