delianid_ has quit [Remote host closed the connection]
baweaver has quit [Remote host closed the connection]
delianides has joined #ruby
<josiah14>
cool, shevvy
<josiah14>
I don't think I have to worry about it going a billion times in this case, but then, anything would be inefficient executed that many times in a row
delianides has quit [Client Quit]
blandflakes_away has joined #ruby
djbkd has joined #ruby
_cake has quit [Read error: Connection reset by peer]
spyderma_ has quit [Read error: Connection reset by peer]
odigity has joined #ruby
connor_goodwolf has quit [Ping timeout: 245 seconds]
_cake has joined #ruby
spyderman4g63 has joined #ruby
dfinninger has quit [Remote host closed the connection]
blandflakes_away has quit [Client Quit]
swistak35 has left #ruby [#ruby]
djbkd has quit [Ping timeout: 255 seconds]
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hobodave has quit [Quit: Computer has gone to sleep.]
lkba has joined #ruby
scripore has joined #ruby
<godd2>
josiah14 when you say "expensive" do you mean in O-time or constants?
jlast has joined #ruby
MatthewsFace has quit [Remote host closed the connection]
charliesome has joined #ruby
momomomomo has quit [Quit: momomomomo]
systemd0wn has quit [Remote host closed the connection]
GaryOak_ has quit [Remote host closed the connection]
<josiah14>
godd2: I'm thinking more along the lines of if I have to do a lot of converting in some function (or that function gets called a lot) is it better to just pass in strings and concat strings, and just use the hashrocket, or is there still some benefit to symbols
drkush has joined #ruby
<shevy>
well you can't concat symbols
<josiah14>
let's consider the general case, and then something that requires a lookup, like I concat the strings and then use the 'send' method off of some object
<jhass>
josiah14: if your methods purpose is to concatenate some strings, pass strings, not symbols
<godd2>
I'd say the benefits of symbols are more in their memory usage than their cpu load
<josiah14>
right, but i could (sym1.to_s + sym2.to_s).to_sym
<shevy>
if you have a string object already, you can use << to append the second string to it
<jhass>
send accepts strings
<godd2>
so if you're making lots of hashes with the same keys, symbols are a must-use for memory purposes
<jhass>
also try to prefer public_send
<shevy>
yeah but you can do this only when you have strings :)
<josiah14>
right, but does sending strings hurt the lookup time for send?
baweaver has joined #ruby
<shevy>
time to test it!
<jhass>
did you benchmark that to be a bottleneck?
<jhass>
in your real application?
lkba_ has joined #ruby
<josiah14>
I'm just thinking theoretically, I was working in some code that got me wondering about it
<josiah14>
it seems like something I could easily run into
<jhass>
you waste your time
justin_pdx has quit [Quit: justin_pdx]
<josiah14>
yah, probably
<godd2>
yea, if anyone asks, just note that the concatenation throws away any optimization benefit youre getting from symbols
<jhass>
worry if it becomes an issue, a real one
<jhass>
s/if/when/
Kricir has joined #ruby
eat_multi has joined #ruby
commmmodo has joined #ruby
<godd2>
josiah14 plus, this is an issue of constants, not O-times. The fact that you're using Ruby means you generally don't care about overhead
<josiah14>
I thought the benchmark might look like that
<shevy>
so for every about 5 million runs, you will save ( 2.5 / 5_000_000) seconds
<godd2>
haha
djbkd has joined #ruby
<shevy>
though perhaps if you have some really huge app it'll become more noteworthy
<shevy>
likes rails 10.0 or so
<josiah14>
well, this is a pretty big app. buuut, it's also a small user base, so I think it will be fine
sarkis_ has quit [Ping timeout: 246 seconds]
<josiah14>
there's also not a lot of inheritance going on in the app, so there isn't a huge inheritance tree to parse through (relatively) unless I were sending on a Rails object of some sort (which I'm not)
sarkis_ has joined #ruby
RegulationD has quit [Ping timeout: 240 seconds]
<shevy>
sounds tiny!
attamusc has quit [Quit: Connection closed for inactivity]
retornam has quit [Ping timeout: 246 seconds]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<godd2>
Sound like you need more metaprogramming. I hear that's pretty webscale.
eat_multi has quit [Quit: leaving]
jonr22 has quit [Ping timeout: 265 seconds]
eat_multi has joined #ruby
marr has quit []
galeido has joined #ruby
Asher has quit [Quit: Leaving.]
eat_multi has quit [Client Quit]
spider-mario has quit [Read error: Connection reset by peer]
VBlizzard is now known as _blizzy_
eat_multi has joined #ruby
eat_multi has quit [Client Quit]
eat_multi has joined #ruby
jlast has quit [Remote host closed the connection]
davedev24_ has quit [Ping timeout: 256 seconds]
eat_multi has quit [Client Quit]
dblessing has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
eat_multi has joined #ruby
<baweaver>
josiah14: are you who I think you are?
IrishGringo has quit [Ping timeout: 256 seconds]
eat_multi has quit [Client Quit]
eat_multi has joined #ruby
davedev24_ has joined #ruby
fabrice31 has joined #ruby
drkush has quit [Ping timeout: 265 seconds]
blackmesa has quit [Quit: WeeChat 1.1.1]
eat_multi has quit [Client Quit]
eat_multi has joined #ruby
reset has quit [Quit: Leaving...]
eat_multi has quit [Client Quit]
jlast has joined #ruby
eat_multi has joined #ruby
<baweaver>
Ahaha, unless there's another Josiah connecting from DST systems I doubt it.
<baweaver>
Didn't know you were on IRC.
fabrice31 has quit [Ping timeout: 244 seconds]
djbkd has quit [Remote host closed the connection]
patrick99e99 has quit [Ping timeout: 265 seconds]
sarkis_ has quit [Ping timeout: 255 seconds]
kblake has quit [Remote host closed the connection]
ghostmoth has quit [Quit: ghostmoth]
patrick99e99 has joined #ruby
drkush has joined #ruby
cassianoleal has quit [Read error: Connection reset by peer]
zacstewart has joined #ruby
spyderman4g63 has quit [Remote host closed the connection]
connor_goodwolf has joined #ruby
eat_multi has quit [Quit: leaving]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ghr has joined #ruby
wallerdev has quit [Quit: wallerdev]
drkush has quit [Ping timeout: 264 seconds]
<meschi>
Hi
sevvie has quit [Ping timeout: 255 seconds]
<meschi>
is Net::HTTP HTTP/1.1 by default? can i change it?
<josiah14>
beaweaver I am
VBlizzard has joined #ruby
<josiah14>
It's been a while since I've worked with Ruby
<josiah14>
getting back into it
<josiah14>
haha
<baweaver>
Traced your login IP to DST systems
<josiah14>
doing a little (bad) meta programming
<baweaver>
thought you were the only one there
<josiah14>
yah, I figured
<baweaver>
boo
<baweaver>
meschi: I would look into faraday if you're not bound to Net::HTTP
<meschi>
I try to access DuckDuckGo like this: uri = URI('http://duckduckgo.com/html/?q=test';) followed by Net::HTTP.get(uri). This gives me a 301 redirect
<meschi>
is the default Net::HTTP so bad?
_blizzy_ has quit [Disconnected by services]
VBlizzard is now known as _blizzy_
<baweaver>
It's slow and unwieldy
<baweaver>
just give it a follow redirects, I don't remember what that was.
withnale_ has quit [Read error: Connection reset by peer]
withnale_ has joined #ruby
The_Phoenix has joined #ruby
CorySimmons has joined #ruby
CorySimmons has quit [Client Quit]
apeiros_ has quit [Read error: Connection reset by peer]
apeiros_ has joined #ruby
justin_pdx has quit [Quit: justin_pdx]
hvxgr has quit [Ping timeout: 256 seconds]
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Hobogrammer has joined #ruby
fabrice31 has joined #ruby
tagrudev has joined #ruby
Channel6 has quit [Quit: Leaving]
longfeet has quit [Ping timeout: 244 seconds]
drkush has quit [Ping timeout: 264 seconds]
JoshGlzBrk has joined #ruby
cjim_ has joined #ruby
cjim_ has quit [Client Quit]
ptrrr has joined #ruby
drkush has joined #ruby
fabrice31 has quit [Ping timeout: 245 seconds]
<arup_r>
so quiet place..
neanderslob has quit [Ping timeout: 255 seconds]
Mon_Ouie has joined #ruby
Mon_Ouie has joined #ruby
neanderslob has joined #ruby
lolmaus has joined #ruby
last_staff has joined #ruby
drkush has quit [Ping timeout: 240 seconds]
bricker has quit [Quit: leaving]
Xiti has joined #ruby
charliesome has joined #ruby
apeiros_ has quit [Remote host closed the connection]
apeiros_ has joined #ruby
drkush has joined #ruby
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
polysics has quit [Remote host closed the connection]
blandflakes_away has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
polysics has joined #ruby
Czj has joined #ruby
ptrrr has quit [Quit: ptrrr]
pwnz0r has quit [Remote host closed the connection]
blandflakes_away has quit [Client Quit]
frobs has joined #ruby
swgillespie has joined #ruby
apeiros_ has quit [Ping timeout: 256 seconds]
jtdowney has joined #ruby
drkush has quit [Ping timeout: 252 seconds]
sahilsk has joined #ruby
skj3gg has quit [Quit: ZZZzzz…]
<sahilsk>
I need to know if there is a possible conflict, when running Sidekiq on more than 1 machine
anaeem1 has joined #ruby
polysics has quit [Ping timeout: 264 seconds]
Hirzu_ has joined #ruby
Qladstone has quit [Remote host closed the connection]
peeja has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
anaeem1 has quit [Remote host closed the connection]
IrishGringo has quit [Ping timeout: 256 seconds]
anaeem1 has joined #ruby
dandaman has joined #ruby
dandaman has quit [Client Quit]
drkush has joined #ruby
idoru has quit [Read error: Connection timed out]
idoru has joined #ruby
Hirzu has quit [Ping timeout: 272 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dj_zubehoer has joined #ruby
aganov has joined #ruby
codecop has joined #ruby
drkush has quit [Ping timeout: 252 seconds]
JohnBat26 has joined #ruby
_Andres has joined #ruby
drkush has joined #ruby
Hobogrammer_ has joined #ruby
hvxgr has joined #ruby
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Wolland has joined #ruby
ghostpl_ has joined #ruby
pwnz0r has joined #ruby
wallerdev has joined #ruby
bal has joined #ruby
sinkensabe has joined #ruby
Hobogrammer has quit [Ping timeout: 264 seconds]
beneggett has quit [Ping timeout: 272 seconds]
Mon_Ouie has quit [Ping timeout: 272 seconds]
SouL has joined #ruby
ghostpl_ has quit [Ping timeout: 246 seconds]
RegulationD has joined #ruby
DEA7TH has joined #ruby
pontiki has quit [Quit: goodnight]
davejlong has joined #ruby
bigkevmc_ is now known as bigkevmcd
serivich has joined #ruby
RegulationD has quit [Ping timeout: 255 seconds]
Xiti has quit [Quit: Xiti]
<ddv>
sahilsk: why don't you test this yourself?
davejlong has quit [Ping timeout: 264 seconds]
<ddv>
sahilsk: lazy?
PaulePan1er is now known as PaulePanter
<sahilsk>
nopes. am sysadmin and i need to deploy one app using it... just trying to figure out the sidekiq part of the application
davedev2_ has joined #ruby
<sahilsk>
ddv: if you anything , then it'd be great
<ddv>
sahilsk: just fire up 2 vm's
FooMunki has quit [Quit: FooMunki]
davedev24_ has quit [Ping timeout: 246 seconds]
<sahilsk>
ddv: I'm already doing it.... that post was posted incase somebody like you might know teh answer already... anyway thanks for your suggestions, though not helpful
drkush has quit [Ping timeout: 252 seconds]
Hirzu_ has quit [Remote host closed the connection]
drkush has joined #ruby
nii236 has joined #ruby
Qladstone has joined #ruby
oki has joined #ruby
<ddv>
sahilsk: you have to make sure your sidekiq job is thread safe
<sahilsk>
you mean idempotent?
surs has joined #ruby
ta has joined #ruby
drkush has quit [Ping timeout: 245 seconds]
mferrier has quit []
<flughafen>
moin
drkush has joined #ruby
sivsushruth has joined #ruby
OrbitalKitten has joined #ruby
polysics has joined #ruby
Macaveli has joined #ruby
Macaveli has quit [Client Quit]
aswen has joined #ruby
Macaveli has joined #ruby
drkush has quit [Ping timeout: 240 seconds]
fabrice31 has joined #ruby
drkush has joined #ruby
Spami has joined #ruby
mleung has joined #ruby
andikr has joined #ruby
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Xiti has joined #ruby
scripore has joined #ruby
harleypig has joined #ruby
tunaCanBruh has joined #ruby
crdpink has joined #ruby
OrbitalKitten has joined #ruby
benlieb has joined #ruby
nii236 has quit [Quit: WeeChat 1.1.1]
lemur has quit [Remote host closed the connection]
amclain has quit [Quit: Leaving]
nii236 has joined #ruby
Qladstone has quit [Remote host closed the connection]
djbkd has quit [Remote host closed the connection]
nii236 has joined #ruby
strixd has joined #ruby
drkush has quit [Ping timeout: 252 seconds]
drkush has joined #ruby
Hirzu has joined #ruby
crack has quit [Disconnected by services]
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Mia has quit [Read error: Connection reset by peer]
crack_ has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
serivich has quit [Ping timeout: 255 seconds]
<certainty>
moin
sahilsk has left #ruby [#ruby]
davedev2_ has quit [Ping timeout: 246 seconds]
Soliah has quit [Quit: Soliah]
Macaveli has quit [Ping timeout: 246 seconds]
davedev24_ has joined #ruby
luckyruby has joined #ruby
CorySimmons has joined #ruby
ZJvandeWeg has joined #ruby
scripore has quit [Quit: This computer has gone to sleep]
pwnz0r has quit [Remote host closed the connection]
mleung has quit [Quit: mleung]
sivsushruth has quit [Ping timeout: 256 seconds]
ghostpl_ has joined #ruby
drkush has quit [Ping timeout: 256 seconds]
sivsushruth has joined #ruby
jonr22 has joined #ruby
juanpablo_ has joined #ruby
drkush has joined #ruby
pwnz0r has joined #ruby
Bounga has joined #ruby
benlieb has quit [Quit: benlieb]
agent_white has quit [Quit: nite.]
nopolitica has quit [Ping timeout: 250 seconds]
ghostpl_ has quit [Ping timeout: 264 seconds]
einarj has joined #ruby
jonr22 has quit [Ping timeout: 265 seconds]
Soda has quit [Remote host closed the connection]
ki0 has joined #ruby
juanpablo_ has quit [Ping timeout: 264 seconds]
pwnz0r has quit [Ping timeout: 256 seconds]
<arup_r>
certainty: moin.. but too late today you are :)
<arup_r>
flughafen: o/
kalusn has joined #ruby
davedev24_ has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
<flughafen>
arup_r: ahoy
davedev24_ has joined #ruby
<flughafen>
moioioioin certainty
drkush has quit [Ping timeout: 250 seconds]
Qladstone has joined #ruby
<arup_r>
flughafen: working spree based rails app
<arup_r>
reading Deface gem.. It seems so nice
<flughafen>
arup_r: working on testsuite failures
<flughafen>
booooo
<arup_r>
I love writing unit tests.. But no scope :(
terlar has joined #ruby
<flughafen>
i like unit tests too
bim has joined #ruby
<arup_r>
Do you do TDD ?
morenoh149 has joined #ruby
<certainty>
arup_r: yeah, busy times
<arup_r>
I don't ... I write code .. then if I allowed then test.. :( I like TDD gurus...
drkush has joined #ruby
<arup_r>
certainty: busy in coding I like
sigurding has joined #ruby
<flughafen>
arup_r: no. i can't really say i' a ruby dev. but the only ruby i use is for the testsuite with capybara/cucumber
<arup_r>
ohkay
<flughafen>
but our product is in java, perl, python, bash and sql
<certainty>
arup_r: not so much coding. more operations.
amundj has joined #ruby
<arup_r>
ok... certainty: Are you Project manager/Lead ?
davedev24_ has quit [Read error: Connection reset by peer]
serivich has joined #ruby
davedev24_ has joined #ruby
krz has joined #ruby
<arup_r>
flughafen: why not in Ruby ?
<flughafen>
arup_r: we didn't start the fire
<flughafen>
;)
<arup_r>
hehehe
<flughafen>
um, we're a fork of another project
<certainty>
arup_r: nope. with operations i meant i'm doing sysadmin/devop tasks today :)
bim has quit [Ping timeout: 250 seconds]
<arup_r>
ok
<flughafen>
but perl is being removed, woohoo
<flughafen>
but i havent touched it
<certainty>
remove the dark craft
<arup_r>
You know lots of things.. I do write only Rails app code. nothing more than that.. I should enhance my skills too
<certainty>
good i hear you can get all sorts of deseases when you touch perl
<flughafen>
certainty: perl looks the same before and after encryption ;)
<arup_r>
There are too many books on Perl..
<arup_r>
they have fat documentations
<arup_r>
like Pythoin
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_Andres has quit [Quit: My Mac Pro has gone to sleep. ZZZzzz…]
piotrj has joined #ruby
drkush has quit [Ping timeout: 250 seconds]
<certainty>
flughafen: indistinguishable from random :)
ascarter has joined #ruby
<arup_r>
certainty: do you write Rails too ?
<arup_r>
ponga: is there... I see
rdark has joined #ruby
kyb3r_ has quit [Quit: Leaving]
sigurding has quit [Quit: sigurding]
<flughafen>
i have a couple of small commits to an opensource rails project, but really small. but i do have another issue assigned to me i need to fix
<flughafen>
so you can say things are getting pretty serious
<certainty>
arup_r: yepp
<arup_r>
cool
<certainty>
we have 3 big rails apps and a couple smaller ones.
CustosLimen has quit [Ping timeout: 256 seconds]
<arup_r>
wow
<arup_r>
e-commerce?
<flughafen>
we have a couple of rails apps here too, in yo face!
<certainty>
nope, management solutions to run our business. crm, datacenter, and customer front end
<certainty>
flughafen: hehe
Czj has quit [Ping timeout: 265 seconds]
<certainty>
i wish we had fewer actually
<certainty>
fewer projects in general
nopolitica has joined #ruby
razieliyo has joined #ruby
razieliyo has joined #ruby
<arup_r>
why so ? :)
<certainty>
many internal gems we have also
<certainty>
management is not easy
marr has joined #ruby
<certainty>
and we're a small shop so we have to do a good amount of time management
<arup_r>
ok
<certainty>
main business is providing hosting solutions. And naturally since we're small, we have to automate the heck out of it. That's what i do mostely
piotrj has quit [Remote host closed the connection]
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
OrbitalKitten has joined #ruby
<flughafen>
certainty: do you guys opensource your stuff?
drkush has joined #ruby
ghr has joined #ruby
davedev24_ has quit [Ping timeout: 264 seconds]
mikeric has joined #ruby
Qladstone has quit [Remote host closed the connection]
Macaveli has joined #ruby
blandflakes_away has joined #ruby
DEA7TH has quit [Changing host]
DEA7TH has joined #ruby
nopolitica has quit [Quit: leaving]
blandflakes_away has quit [Client Quit]
davidcelis has quit [Ping timeout: 246 seconds]
davidcelis has joined #ruby
dj_zubehoer has quit []
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Hirzu has quit [Remote host closed the connection]
CorySimmons has quit [Quit: Bye!]
plashchynski has joined #ruby
antgel has joined #ruby
senayar has joined #ruby
elaptics is now known as elaptics_away
tcrypt has quit [Remote host closed the connection]
yfeldblum has quit [Ping timeout: 265 seconds]
sevenseacat has quit [Remote host closed the connection]
arup_r has quit [Remote host closed the connection]
mikecmpb_ has quit [Quit: i've nodded off.]
senayar_ has joined #ruby
senayar has quit [Read error: Connection reset by peer]
nii236 has quit [Ping timeout: 245 seconds]
chthon has joined #ruby
joonty has joined #ruby
mikecmpbll has joined #ruby
lolmaus_ has joined #ruby
aryaching has joined #ruby
dandaman has joined #ruby
lolmaus has quit [Ping timeout: 255 seconds]
Hirzu has joined #ruby
nii236 has joined #ruby
CustosLimen has joined #ruby
elaptics_away is now known as elaptics
dmolina1 has joined #ruby
RegulationD has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
wldcordeiro has quit [Ping timeout: 265 seconds]
dmolina1 has quit [Client Quit]
djbkd has joined #ruby
kenneth has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
RegulationD has quit [Ping timeout: 264 seconds]
arup_r has joined #ruby
Hirzu has quit [Remote host closed the connection]
Musashi007 has joined #ruby
<certainty>
flughafen: nope, most of it is not open source. We plan todo though. At least two gems
<certainty>
personally i'd love to do more but, well
Musashi007 has quit [Client Quit]
duncannz has quit [Ping timeout: 264 seconds]
<arup_r>
certainty: Did you use ever Deface geam
<certainty>
arup_r: nope
<arup_r>
ok np
ghostpl_ has joined #ruby
phutchins has quit [Ping timeout: 240 seconds]
RandyT has quit [Ping timeout: 245 seconds]
theotherstupidgu has joined #ruby
Zai00 has joined #ruby
<flughafen>
you should totally check it out it's like totally cool and stuff
Soda has joined #ruby
<certainty>
y
leafybasil has quit [Remote host closed the connection]
dANO__ has joined #ruby
chipotle has joined #ruby
_Andres has joined #ruby
theotherstupidgu has quit [Remote host closed the connection]
serivich has quit [Read error: Connection reset by peer]
tunaCanBruh has joined #ruby
Takle has joined #ruby
djbkd has quit [Remote host closed the connection]
kaiZen- has joined #ruby
sivsushruth has quit [Ping timeout: 246 seconds]
tunaCanBruh has quit [Ping timeout: 264 seconds]
ghostpl_ has quit [Remote host closed the connection]
kenneth has joined #ruby
adriancb has joined #ruby
joonty has quit [Quit: joonty]
nii236 has quit [Quit: WeeChat 1.1.1]
nii236 has joined #ruby
nii236 has quit [Client Quit]
red_horned_rihno has quit [Ping timeout: 245 seconds]
joonty has joined #ruby
MasterPiece has joined #ruby
adriancb has quit [Ping timeout: 244 seconds]
maximski has joined #ruby
ZJvandeWeg has quit [Ping timeout: 256 seconds]
bradleyp_ has quit [Remote host closed the connection]
<canton7>
you don't give us any information on the challenge, so you can't want help with that. but you haven't asked any questions about ruby, so you can't want help with that either
<Phage>
Hmm...
<canton7>
so... conclusion: you don't actually want help? :S
<Phage>
I just showed you a screenshot of the challenge description.
senayar_ has quit [Remote host closed the connection]
<wasamasa>
lol
<canton7>
there are 2 parts to this: figuring out what you need to do, and doing it in under a second
blandflakes_away has quit [Client Quit]
<canton7>
step 1, figuring out what you need to do, is best done by hand. play around, figure out how to solve it, get it done by hand in 10 mins or whatever
senayar has joined #ruby
<Phage>
canton7: I can do it in under a second.
<canton7>
then automate it. this is the step you can use ruby for
<mikecmpbll>
lol
_Andres has quit [Quit: My Mac Pro has gone to sleep. ZZZzzz…]
<canton7>
Phage, how? that's information you haven't given us
<Phage>
canton7: I have code for this already.
<rom1504>
LOL
<canton7>
Phage, so... what's your question?
<mikecmpbll>
:~
drkush has quit [Ping timeout: 264 seconds]
<canton7>
if there are no questions, what are you doing here? :P
<rom1504>
just trolling us
<canton7>
I think so, yeah
<rom1504>
it's working well
DaniG2k has joined #ruby
<canton7>
meh, back to work
<Phage>
o.o
<Phage>
Forget it...
<canton7>
come back when you've got an actual, specific question
<mikecmpbll>
how can i forget H1?<??????͆??ˍ?????ɯ?? b?hHfcj[RANDSTR2]
Soda has quit [Remote host closed the connection]
<mikecmpbll>
:'(
charliesome has joined #ruby
imanzarrabian has quit [Ping timeout: 264 seconds]
<Phage>
rom1504: The output from that site, doesn't really many any sense.
drkush has joined #ruby
Macaveli has quit [Ping timeout: 252 seconds]
<rom1504>
RANDSTR2 makes sense, so it's probably the right way to do it
senayar has quit [Ping timeout: 245 seconds]
<rom1504>
and the rest is a random string, which makes sense too
<rom1504>
(since they even tell us that's what it is with RANDSTR2)
<rom1504>
so basically you need to convert the hexa to a string
<rom1504>
apparently .pack('H*')
<canton7>
rom1504, he's already solved it
<rom1504>
yeah there's that
<canton7>
he's already written the code to complete the challenge
gluten_hell has joined #ruby
yfeldblum has joined #ruby
Takle_ has joined #ruby
drkush has quit [Ping timeout: 245 seconds]
senayar has joined #ruby
drkush has joined #ruby
ZJvandeWeg has quit [Ping timeout: 264 seconds]
SixiS has quit [Quit: SixiS]
sprihodko has quit [Quit: (null)]
Takle has quit [Ping timeout: 246 seconds]
<mikecmpbll>
canton7: lol ;d
Dmr has joined #ruby
elfuego has joined #ruby
Pumukel has joined #ruby
topolinux has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
plashchynski has quit [Quit: plashchynski]
plashchynski has joined #ruby
mikeric has quit []
Takle_ has quit [Remote host closed the connection]
nii236 has quit [Quit: WeeChat 1.1.1]
<argoneus>
do symbols have a value
<argoneus>
or are they just generic objects that are all the same in all contexts
RegulationD has joined #ruby
<canton7>
that's like asking if a number has a value
<canton7>
symbols are very similar to strings. the difference is that they're more expensive to create, but a lot cheaper to compare
<argoneus>
right
<argoneus>
so when I create :mything in my class
<argoneus>
then I can use :mything everywhere in the same file
<argoneus>
and it will have the same value
<argoneus>
like an enum, after all
Pumukel has quit [Ping timeout: 265 seconds]
<mikecmpbll>
value? ..
<canton7>
it's like asking if using "hello" once, then using "hello" lots more times, if all the "hello"s have the same value
<canton7>
the "hello" *is* the value
<argoneus>
oh, right
RegulationD has quit [Ping timeout: 244 seconds]
<shevy>
argoneus you did smalltalk before ruby?
<argoneus>
so the symbols are pretty much something like -some numbers-
<argoneus>
like I decide :pi is a symbol
<argoneus>
and then I can use :pi everywhere
<shevy>
argoneus YES. It returns a number. Let me show you the C source.
<argoneus>
shevy: yes
lkba has joined #ruby
<shevy>
<shevy> symbols are immutable so the lookup is cheap. if you do it a billion times then yeah
<argoneus>
and then I have a method where It can give the tag to someone else
<argoneus>
just like a game of tag
<argoneus>
this is fine so far
<argoneus>
but I also need to check if the current message sender is in fact It and if the person he's sending it to exists, and brr whatever I'll just figure ito ut
<argoneus>
it's not hard in other languages, I just need to get my head around the syntax
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<canton7>
you're not giving enough details to make sense, I'm afraid
<canton7>
"but I also need to check if the current message sender is in fact It " <-- huh?
<argoneus>
yeah that's what I figured halfway through
<argoneus>
:D
<argoneus>
it's hard to convey an idea from my head into irc
kedare has joined #ruby
Dmr has quit [Quit: Leaving]
<argoneus>
I'll just figure it out somehow
jenrzzz has quit [Ping timeout: 245 seconds]
<shevy>
well
<shevy>
you use strange words
<shevy>
things like attribute
<shevy>
tags
<shevy>
message senders :D
<godd2>
No! shevy! You're scaring the children!
<shevy>
though at least that one is easier to see through .send()
joonty has quit [Quit: joonty]
<shevy>
argoneus what you also may realize is that you don't need to use everything in ruby in order to become productive
wallerdev has quit [Quit: wallerdev]
rkgudboy has joined #ruby
<shevy>
godd2 I need to bring them down to less enthusiasm!
piotrj has quit [Remote host closed the connection]
joonty has joined #ruby
chiel has joined #ruby
drkush has quit [Ping timeout: 256 seconds]
mbwe has quit [Quit: WeeChat 0.4.2]
bruno- has joined #ruby
polysics has quit [Remote host closed the connection]
bruno- is now known as Guest22045
polysics has joined #ruby
chinmay_dd has joined #ruby
phale has joined #ruby
phutchins has joined #ruby
Zai00 has quit [Quit: Zai00]
bjornar has joined #ruby
Guest22045 has quit [Ping timeout: 245 seconds]
polysics has quit [Ping timeout: 255 seconds]
FooMunki_ has joined #ruby
drkush has joined #ruby
tunaCanBruh has joined #ruby
anekos has quit [Remote host closed the connection]
otisZart has joined #ruby
phutchins has quit [Ping timeout: 255 seconds]
x77686d has joined #ruby
senayar has quit [Remote host closed the connection]
ghostpl_ has quit [Remote host closed the connection]
<centrx>
phale, A raster is A usually rectangular pattern of parallel lines forming or corresponding to the display of a television screen, computer monitor
<centrx>
etc
<centrx>
A raster almost always corresponds to two orthogonal grids thus forming an image made up of a pattern of dots rather than lines.
<phale>
thanks
tgunr has joined #ruby
<phale>
hmm
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<phale>
unpack("H*") doesn't return an array of hex'
greenbagels has quit [Read error: Connection reset by peer]
hs366 has quit [Remote host closed the connection]
<chiel>
hi all, any capistrano fanatics in here? i'm using it to deploy an app and for some reason, the `release_path` variable is empty during an `after :deploy, :clear_cache` hook... anyone have any ideas?
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davedev24_ has joined #ruby
OrbitalKitten has joined #ruby
triple_b has joined #ruby
piotrj has joined #ruby
claptor has quit [Quit: this channel is bakas]
aclearman037 has joined #ruby
jerematic has joined #ruby
keen__________79 has joined #ruby
nahtnam has quit [Quit: Connection closed for inactivity]
ms7 has joined #ruby
<workmad3>
memohg: a) that means you're using the pure-ruby version of that fcgi handler, which I doubt you really want. b) that's not the code that's somehow hacking a rails app into something that can launch via fcgi. c) ask Redmine support channels for help
keen__________78 has quit [Ping timeout: 256 seconds]
jerematic has quit [Client Quit]
<ms7>
I have two identical “times”:
<ms7>
Format is “Time”: 2015-03-05 12:58:45 UTC
<ms7>
Format is “ActiveSupport::TimeWithZone: Thu, 05 Mar 2015 12:58:45 UTC +00:00
<ms7>
How would I convert the second format to the first one?
<memohg>
workmad3, got confused on a) I'm gonna look for a redmine channel
dtordable has quit [Quit: • IRcap • 8.72 •]
Deele has quit [Ping timeout: 256 seconds]
<ms7>
jhass: class
<jhass>
ms7: then what centrx said
Waheedi has quit [Ping timeout: 255 seconds]
<ms7>
jhass: Actually, I’m not exactly sure now. I just ran my test and it tells me Time is an undefined method. Digging now..
<jhass>
ms7: may I ask why though?
ghostpl_ has joined #ruby
<apeiros_>
ms7: Time != time
<ms7>
sure, let me get you a paste, one sec
coinrookie has joined #ruby
<workmad3>
ms7: it's also worth noting that it looks like neither of those is really a 'format'... merely the .inspect output of a Time and a TimeWithZone respectively
<jhass>
ms7: the problem is not that the string representations of those two have a different format
gluten_hell has joined #ruby
<jhass>
the problem is that they do not represent the same time
spyderma_ has joined #ruby
<jhass>
there's exactly 6 minutes of difference
<ms7>
jhass: oh, wait, that wasn’t like that a few test runs ago, let me make sure its the same time and different format
enebo has joined #ruby
phutchins has joined #ruby
f03lipe_ has quit [Ping timeout: 256 seconds]
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros_>
ms7: you probably want Time.zone.now
enebo has quit [Client Quit]
<ms7>
ok, now it’s the same time, I removed the Time(…) method from the test
<jhass>
ugh, TimeWithZone does not compare to a Time?
<apeiros_>
also, comparing to "now" in unit tests is a bad idea.
<apeiros_>
jhass: iirc it coerces
<apeiros_>
yepp, comparing works fine.
<jhass>
so, again, format is not the problem
<apeiros_>
`t = Time.zone.now; t == t.to_time` # => true
<workmad3>
it'll be millisecond precision though
<jhass>
ms7: like apeiros said use fixed times or if you really can't, use the timecop gem
<workmad3>
so Time.now will almost certainly have changed between the two invocations... making it what apeiros_ just mentioned ;)
Takle has joined #ruby
<ms7>
apeiros_: Now it throws the following error message with Time.zone.now —> No visible difference in the ActiveSupport::TimeWithZone#inspect output. You should look at the iplementation of #== on ActiveSupport::TimeWithZone or its members.
DaniG2k has quit [Ping timeout: 244 seconds]
<jhass>
ms7: yes, you still confuse the string representation with the actual value
<ms7>
apeiros_: yes, I had a feeling using Time.now or similar in tests is a bad idea. I’m not sure how else to simulate a Time.now date when the data to be asserted comes from Time.now.utc
<workmad3>
ms7: just before that line, take a look at 'puts "Time.now: #{Time.now.to_f}, ends_at: #{place_rent.ends_at.to_f}"
<apeiros_>
ms7: wtf is Time() in your test?
<workmad3>
ms7: I bet you the fractional will be different ;)
<hanmac1>
TimeWithZone is AS Rails shit ;P that is "NotOurProblem" ;P
spyderman4g63 has quit [Ping timeout: 252 seconds]
<apeiros_>
hanmac1: can you stop the vitriol for a second and be constructive?
mkaesz has quit [Remote host closed the connection]
<apeiros_>
also ruby not supporting TZ proper by stdlib didn't help avoiding things like TimeWithZone
<ms7>
ok, hold on. overload
sinkensabe has quit [Read error: Connection reset by peer]
<ms7>
workmad3: trying your suggestion now
tunaCanBruh has joined #ruby
<apeiros_>
ms7: AR uses TimeWithZone. Time.zone.(local/now) constructs TimeWithZone. when doing tests, it's best to use that.
phutchins has quit [Ping timeout: 240 seconds]
skj3gg has joined #ruby
mkaesz has joined #ruby
<ms7>
:( using tmux, can’t simply copy paste my test in bah
<apeiros_>
gist
JDiPierro has joined #ruby
<apeiros_>
better than in irc anyway.
<workmad3>
ms7: did you take a look at .to_f on both Time.now and ends_at then? were they different, as suspected?
mkaesz has quit [Remote host closed the connection]
triple_b has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<ms7>
I mean I have to manually type my example :) using multiple panes when copying takes ALL the text in all panes
<workmad3>
ms7: there you go... it's that the time has changed ;)
<workmad3>
ms7: the default .inspect doesn't show milliseconds though
OrbitalKitten has joined #ruby
agarie has joined #ruby
<apeiros_>
ms7: and that would be why I said "comparing to now in tests is a bad idea"
<ms7>
so it seems I should never be using Time.now in tests as it will always be different from the asserted value
<workmad3>
^^
<apeiros_>
now changes *all* *the* *time*
<ms7>
apeiros_: exactly. Timecop then?
tunaCanBruh has quit [Ping timeout: 264 seconds]
<apeiros_>
that's one solution
tkuchiki has joined #ruby
<ms7>
damn
mkaesz has joined #ruby
roshanavand has joined #ruby
<jhass>
timecop for when you can't avoid using Time.now, yeah
Czj has joined #ruby
<jhass>
I think I also prefer it to manually stubbing out Time.now
<jhass>
(assuming that's how your code constructs the time)
<ms7>
one of my mentors is saying to look into travel_to
JDiPierro has quit [Remote host closed the connection]
<workmad3>
ms7: you could also work around it by doing 'assert (Time.now.to_f - place_rent.ends_at.to_f) < 0.5' (or something smaller)
<ms7>
digging
mkaesz has quit [Remote host closed the connection]
Czj has left #ruby [#ruby]
<ms7>
workmad3: HA
<jhass>
workmad3: had something like that once, only leads to flaky tests really
<workmad3>
jhass: yeah, was about to comment on that front
<workmad3>
ms7: as jhass said, it does lead to tests that are a bit flakey, it introduces a bit of imprecision, and it's ugly to boot
Grumelo has joined #ruby
senayar has joined #ruby
* certainty
sometimes passes the time as an argument. handy if you have to be able to rerun things later and pretend that some day in the past is actually now
<workmad3>
ms7: but if you need something quickly, it can work :)
SouL has joined #ruby
<workmad3>
certainty: I've been known to have methods that do 'def foo_bar(clock = Time); some_time = clock.now; end'
<workmad3>
certainty: then I can inject a stub with a specific 'now' set up
<certainty>
workmad3: yepp
<certainty>
i did something similar
<workmad3>
I stopped using timecop when I realised it seriously messed up my test time reporting on CI runs
<workmad3>
I don't like runs that claim to have taken a year to run :)
<apeiros_>
lol
sankaber has joined #ruby
adriancb has quit [Read error: Connection reset by peer]
galeido has quit [Ping timeout: 244 seconds]
<apeiros_>
that's why baretest did TestTime = Time.clone
<workmad3>
right... lunch time
<workmad3>
bbl
workmad3 is now known as wm3|away
<apeiros_>
it actually cloned a couple of core classes to avoid silly stubbers killing the framework
n008f4g_ has joined #ruby
serivich has joined #ruby
dtordable has joined #ruby
sgambino has joined #ruby
<certainty>
hah
adriancb has joined #ruby
<certainty>
i should check our CI. I know we use timecop in some places
mjuszczak has quit []
Hirzu_ has quit [Ping timeout: 252 seconds]
mkaesz has joined #ruby
nettoweb has joined #ruby
paulfm has joined #ruby
marr has quit [Ping timeout: 255 seconds]
Hirzu has joined #ruby
adriancb has quit [Remote host closed the connection]
nettoweb_ has joined #ruby
<shevy>
timecop
<shevy>
van damme
nii236 has joined #ruby
Rapier- has joined #ruby
nettoweb has quit [Ping timeout: 256 seconds]
ndrei has quit [Ping timeout: 245 seconds]
dtordable has quit [Quit: • IRcap • 8.72 •]
amystephen has joined #ruby
gisli has joined #ruby
mkaesz has quit [Remote host closed the connection]
ndrei has joined #ruby
startupality has quit [Quit: startupality]
centrx has quit [Remote host closed the connection]
startupality has joined #ruby
PaulCapestany is now known as PaulCape_
startupality has quit [Client Quit]
topolinux has quit [Ping timeout: 256 seconds]
otisZart has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<gisli>
hi guys, I'm new to ruby and I'm wondering about Gemfiles. Is it possible to install the gems I state in the Gemfile only for that project and not the whole machine? So it would work similarly to how Node/NPM does it with npm install and package.json.
<jhass>
gisli: yes you can, bundle install --path vendor/bundle
mkaesz has joined #ruby
<jhass>
bundle install --deployment, which you should use on your production server, does this by default
juanpablo_ has joined #ruby
<jhass>
see the comprehensive help at bundle help and bundle help install
rbirch has joined #ruby
<avril14th>
ms7: you also have Delorean if you want to compare gems
enebo has joined #ruby
selu has quit [Read error: Connection reset by peer]
topolinux has joined #ruby
davejlong has joined #ruby
arup_r has quit [Remote host closed the connection]
<gisli>
jhass: oh okay so i could do a 'bundle install --path=/home/myrepo' and it will install everything from my Gemfile into the path, if I'm understanding this correctly.
senayar_ has joined #ruby
nii236 has quit [Quit: WeeChat 1.1.1]
<gisli>
Does that create a problem if I want to maybe later install it system-wide?
juanpablo_ has quit [Ping timeout: 246 seconds]
<jhass>
yes and no
<shevy>
lol
<jhass>
I mean, yes to first and no to second ;)
<gisli>
jhass: thanks alot, I appreciate it ;)
<jhass>
however it's uncommon to install outside the project tree when using --path
phale has joined #ruby
<gisli>
jhass: okay, so it's best to do one or the other
centrx has joined #ruby
<jhass>
gisli: you can also set the GEM_HOME environment variable to set a general installation location, respected by both bundler and rubygems itself
kalusn has quit [Remote host closed the connection]
<jhass>
ms7: is trave_to Time.now not just freeze?
<ms7>
jhass: yes, it freezes the time, from my understanding. I was told that Timecop was required before Rails 4.2 (I think?) since travel_to was only added recently.
<jhass>
mmh, travel_to is not Timecop actually?
<jhass>
oh
<ms7>
exactly
<jhass>
I didn't notice
<ms7>
so no need to install timecop gem for this particular case
<ms7>
WOO
jenrzzz has joined #ruby
JDiPierro has joined #ruby
<apeiros_>
so AS::TestCase copied TimeCop functionality. interesting.
triple_b_ has joined #ruby
vegardx has joined #ruby
benlieb has joined #ruby
serivich has quit [Ping timeout: 246 seconds]
<vegardx>
Is it possible to get bundle to honor ANY path set at all? I'm using rbenv and rbenv-gemset in order to get a somewhat functional system. But bundler... bundler just does what ever the fuck it wantst do.
<apeiros_>
it seems to omit DateTime
triple_b has quit [Ping timeout: 256 seconds]
piotrj has quit [Read error: Connection reset by peer]
<apeiros_>
funny, travel_back just clears all stubs. what a misnomer.
<vegardx>
TL; DR: How do you get bundler to work as you'd expect. It does not honor anything set by rbenv or rbenv-gemsets.
piotrj has joined #ruby
<apeiros_>
"where's my stubs gone?!?" well… you traveled back, and back there were no stubs!
<shevy>
back then there was not even any code!
jenrzzz has quit [Ping timeout: 244 seconds]
piotrj_ has joined #ruby
<jhass>
vegardx: bundler honors GEM_HOME just perfectly fine
serivich has joined #ruby
<vegardx>
Clearly it does not, as it installs the gems globally, not honoring the paths set by rbenv.
<vegardx>
Which sort of defeats the purpose of environments.
polysics has quit [Remote host closed the connection]
ms7 has left #ruby [#ruby]
piotrj has quit [Ping timeout: 246 seconds]
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros_>
I don't think bundler does the installations on its own, I'm pretty sure it uses rubygems for that
polysics has joined #ruby
<vegardx>
if I run "gem install foo" in the same directory rbenv-gemsets works as intended. It's just bundler.
scripore has joined #ruby
vclaud has joined #ruby
fryguy9 has joined #ruby
<jhass>
I guess rbenv considers environment variables still as evil and chooses to monkey patch your gem executable instead
Parker0 has joined #ruby
topolinux has quit [Ping timeout: 264 seconds]
mkaesz has quit [Remote host closed the connection]
vclaud has quit [Remote host closed the connection]
topolinux has joined #ruby
fryguy9 has quit [Read error: Connection reset by peer]
<ponga>
why is gitbook horidly buggy
<ponga>
*uck
fryguy9 has joined #ruby
<vegardx>
Beats me, I just want something that works. And as of now there doesn't seem to be much options.
<vegardx>
rbenv looked promising.
mostlybadfly has joined #ruby
Parker0 has quit [Client Quit]
polysics has quit [Ping timeout: 244 seconds]
<jhass>
why do you need gemsets btw?
jottr has joined #ruby
<vegardx>
I want to keep things under wraps. I'd like to be able to "rm -rf ~/project" when I'm done and forget about it.
<vegardx>
Just like I can with nodejs and python.
<jhass>
bundle install --path vendor/bundle and done with that part
Parker0 has joined #ruby
<Jamo>
doesn't rvm gemsets solve that issue?
<vegardx>
That doesn't stop bundle for using the wrong version of ruby. The idea of enviroments is to have things isolated.
<jhass>
Jamo: it did, before we had bundler
<jhass>
now we have bundler
flip_digits has joined #ruby
devdazed has quit [Quit: Computer has gone to sleep.]
<vegardx>
Is it possible to set the path in Gemfiles?
<jhass>
vegardx: that has nothing to do with gemsets, it means you didn't run rbenv rehash as every second command like you gotta do with rbenv or your rbenv is borked in another way
<Jamo>
jhass: ok, good to know; never really used it...
<jhass>
vegardx: no
<jhass>
but on servers you should use --deployment which sets that option to exactly the value I used as example
<vegardx>
Then I cannot use that.
<jhass>
because?
<vegardx>
Because of maintainability and not "forgetting" to set path.
mrdtt has joined #ruby
<jhass>
it's a remembered option
Kellin has joined #ruby
<vegardx>
Exactly.
<jhass>
you have to do it once when setting the project up on your machine
<phale>
what is loop exactly?
<phale>
not "for" or "while"
<phale>
but loop literally
<vegardx>
I have tons of projects, the mess that would make is laughable.
<jhass>
phale: def loop; while true; yield; end; end;
<phale>
is it good
<shevy>
phale loop { sleep 1; puts 'hey phale' }
<shevy>
the name makes it simple
<shevy>
loop loops over things
<jhass>
vegardx: I don't see where that's much different from adding it to the Gemfile or as adding a .ruby-gemset file
Parker0 has quit [Client Quit]
<shevy>
and you can break out manually whenever you want to
<phale>
cool
<shevy>
with the keyword break
foureight84 has joined #ruby
RegulationD has joined #ruby
<vegardx>
jhass: They live inside the project. Impossible to mix gems from projects then.
<shevy>
ruby has cleverly named stuff :)
jaygen has quit []
<jhass>
vegardx: it's impossible to do so with bundler active in the first place
<vegardx>
I have a .ruby-gemsets-file, but bundler does not honor it.
<jhass>
doesn't even matter whether you use --path or not
<waxjar>
if bundler doesn't respect the gem_path/gem_home env vars, bundler is broken imo, even if they provide a workaround
tunaCanBruh has joined #ruby
<jhass>
bundlers whole purpose is to keep your dependency environment consistent
<vegardx>
waxjar: Exactly.
<jhass>
waxjar: it does for me
<jhass>
I rather don't trust rbenv/rbenv-gemsets to set it correctly
foureight84 has quit [Client Quit]
<vegardx>
So you don't see any issue with bundler completely breaking a typical workflow?
<vegardx>
I expect programs to honor the paths set by the shell.
<vegardx>
I want to be able to say to some one "pull this repo" and they'll get it working because things are set properly up.
juanpablo_ has joined #ruby
garethrees has joined #ruby
<jhass>
phale: it works, it's just not doing what you think it does ;). If you do a debugging puts into the if, you'll see that it is indeed properly executed
RandyT has joined #ruby
<phale>
jhass: hm
<phale>
the problem is that it's returning false
<phale>
even when it's true..
<jhass>
phale: it just doesn't leave the method just because of that
<phale>
oh
<phale>
i keep mixing up C and ruby...
<jhass>
phale: I doubt that would work in C either
<shevy>
that's because you haven't yet written enough ruby phale
JohnBat26 has joined #ruby
<phale>
jhass: well not the hash of course
<shevy>
phale you could also write: return true if @accounts[user] == password
<shevy>
the way you wrote it right now, you always return false
<phale>
but if you tried "if (ok) return true;"
<shevy>
the other way around
<phale>
no need to add an else, just add a return false at the end
Takle has quit [Remote host closed the connection]
lys has joined #ruby
fryguy9 has quit [Quit: Leaving.]
<jhass>
phale: yes, but you don't have a return keyword there
<phale>
shevy: okay
ghr has quit [Ping timeout: 256 seconds]
<shevy>
you could use return in both cases :) but the last return is optional, people like to omit it
<shevy>
return true if bla
<phale>
or i could just do
<shevy>
return false
<phale>
return @accounts[user] == password
<phale>
dont need a return either though
<shevy>
yeah
<phale>
can get rid of that
<shevy>
indeed
<jhass>
phale: the last expression of a method is its return value, making the return keyword in that instance optional
<shevy>
you are already in the natural ruby flow now!
<shevy>
soon you will write more ruby code than jhass does
<phale>
shevy: now it breaks my loop
<shevy>
because he is writing more crystal than ruby
avril14th has quit [Ping timeout: 256 seconds]
<shevy>
phale just reshuffle your conditions in the loop; you can only break out early if you use break
<shevy>
or if you have some other error, and no begin/rescue :P
Axy has quit [Read error: Connection reset by peer]
mikecmpbll has quit [Max SendQ exceeded]
Axy has joined #ruby
cphrmky has joined #ruby
rbennacer has joined #ruby
avril14th has joined #ruby
Axy has quit [Changing host]
Axy has joined #ruby
psy_ has quit [Ping timeout: 244 seconds]
mikecmpbll has joined #ruby
Megtastique has joined #ruby
<phale>
see?
<phale>
im not sure what im doing wrong
ych4k3r has joined #ruby
centrx has quit [Remote host closed the connection]
Takle has joined #ruby
lesce has joined #ruby
skj3gg has joined #ruby
dys has joined #ruby
Zai00 has quit [Quit: Zai00]
scripore has quit [Quit: This computer has gone to sleep]
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
topolinux has quit [Ping timeout: 250 seconds]
fryguy9 has joined #ruby
Macaveli has quit [Ping timeout: 250 seconds]
scripore has joined #ruby
<jhass>
I seem to have missed the description of what's not working?
fryguy9 has quit [Read error: Connection reset by peer]
fryguy9 has joined #ruby
iamjarvo has joined #ruby
scripore has quit [Client Quit]
OrbitalKitten has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
scripore has joined #ruby
aclearman037 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
topolinux has joined #ruby
jlast has joined #ruby
jimms has joined #ruby
aclearman037 has joined #ruby
marr has joined #ruby
plashchynski has quit [Quit: plashchynski]
ZJvandeWeg has quit [Ping timeout: 246 seconds]
jottr has joined #ruby
ghostpl_ has quit [Remote host closed the connection]
centrx has joined #ruby
dj_zubehoer has joined #ruby
tohsig has joined #ruby
adriancb has joined #ruby
startupality has joined #ruby
polysics has joined #ruby
otisZart has joined #ruby
ghostpl_ has joined #ruby
fryguy9 has quit [Read error: Connection reset by peer]
fryguy9 has joined #ruby
Guest67784 has quit [Ping timeout: 256 seconds]
werelivinginthef has joined #ruby
devdazed has joined #ruby
otisZart has quit [Read error: Connection reset by peer]
scripore has quit [Quit: This computer has gone to sleep]
adriancb has quit [Ping timeout: 252 seconds]
scripore has joined #ruby
adriancb has joined #ruby
qiffp has joined #ruby
Katselphrime has joined #ruby
RegulationD has joined #ruby
freerobby has quit [Quit: Leaving.]
<ducklobster>
is it necessary to add the json gem to your Gemfile or Gemspec since it is a default gem?
freerobby has joined #ruby
sigurding has joined #ruby
<ducklobster>
or I guess, is it good practice to even though the above?
<centrx>
JSON is in stdlib
<centrx>
so not necessary to add gem
benlieb has quit [Quit: benlieb]
<centrx>
the 'json' gem is for JSRuby I believe
<centrx>
JRuby rather
<jhass>
I think it's basically vendored in but you might get a newer version via the gem
<ducklobster>
centrx thanks, I always wondered why it was in the Rubydoc
<ducklobster>
vendored in, as in it is a separate gem but they wrap it into stdlib?
mitchellhenke has joined #ruby
<jhass>
like with rubygems and minitest
spider-mario has quit [Quit: No Ping reply in 180 seconds.]
<jhass>
I think, dunno though
Zai00 has joined #ruby
rbennacer has quit [Remote host closed the connection]
Qladstone has joined #ruby
Takle has quit [Remote host closed the connection]
<wm3|away>
centrx: I think updates are also released through the gem for MRI, so that you can grab fixes, etc. without waiting for a ruby version that vendors it
wm3|away is now known as workmad3
last_staff has quit [Read error: Connection reset by peer]
spider-mario has joined #ruby
tjohnson has joined #ruby
zenith_ has quit [Remote host closed the connection]
<workmad3>
and, of course, there's yajl-ruby which provides ruby bindings to yajl, for another JSON option
<apeiros_>
*exception is raised # ruby terminology
Kricir has quit [Remote host closed the connection]
<nickjj>
i like exiting early from functions and i want to log some stuff, but i don't want to call the log function 5 times with a different string each time
<jhass>
oh, I thought we "fail" exceptions these days :P
<apeiros_>
given that `throw :error` is valid ruby and has nothing to do with exceptions
<apeiros_>
jhass.failed? # => true
<nickjj>
i figured i could use something like refer/ensure to call it once and just set a variable before i exit early as the string
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jottr has quit [Ping timeout: 252 seconds]
dfinninger has joined #ruby
rbennacer has quit [Remote host closed the connection]
<jhass>
nickjj: if it's a complex logger call I'd rather extract it to a private method though
<nickjj>
jhass, it is already extracted to a method
diegoviola has joined #ruby
<nickjj>
it's not super complex, it has 4 arguments. 1 of which is a "status" which would change based on the outcome of some code ran before running it
skj3gg has quit [Quit: ZZZzzz…]
bruno-_ has joined #ruby
Adran has quit [Quit: Este é o fim.]
<nickjj>
it seems like i'm doing it wrong if i have to call that method 5 times just to change the status
senayar_ has quit [Remote host closed the connection]
memohg has quit [Quit: Leaving]
Kellin has quit [Ping timeout: 245 seconds]
<jhass>
maybe just gist what you have?
Mia has quit [Read error: Connection reset by peer]
<apeiros_>
nickjj: btw., porting idioms is often a bad idea. port meaning, not implementations.
Axy has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
topolinux_ has joined #ruby
Axy has joined #ruby
_Andres has quit [Quit: My Mac Pro has gone to sleep. ZZZzzz…]
<nickjj>
it would be really easy to just call Scrape.log_message a few times with a different status but i thought maybe there's a better way
sevenseacat has quit [Remote host closed the connection]
<jhass>
nickjj: it's hard to find a refacotring opportunity from that little :/
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kellin has joined #ruby
topolinux has quit [Ping timeout: 256 seconds]
<nickjj>
jhass, reload it. i added more
<apeiros_>
the `next` is suspicious
<jhass>
meaning, I gathered that much from your explanations, I was hoping some insight into the complete structure
<apeiros_>
mid-function returns = spaghetti
<nickjj>
apeiros_, it's inside of a loop to skip to the next person in the list
<jhass>
yeah, still
odigity has quit [Ping timeout: 265 seconds]
<apeiros_>
nickjj: that's the same thing
<nickjj>
how is that spaghetti?
<apeiros_>
it's a mid-code return
justin_pdx has quit [Quit: justin_pdx]
<apeiros_>
returns are not limited to functions
<jhass>
nickjj: I'm interested in all cases, not just the failure/skip ones
PaulCape_ has quit [Quit: .]
<nickjj>
mid-code returns are a good habit imo, why would i NOT want to exit early if i no longer care about the rest of the code in the fn/block/whatever?
agarie has quit [Remote host closed the connection]
KidCartouche has joined #ruby
<nickjj>
jhass, in the success case it just writes the person to a db at the end of the function call
OrbitalKitten has joined #ruby
<jhass>
what it does is not that important here actually
<jhass>
the structure is
Takle_ has quit [Remote host closed the connection]
<nickjj>
then it increments a few numbers to keep track how many were successful as part of the progress output in the log
topolinux_ has quit [Ping timeout: 246 seconds]
benlieb has joined #ruby
senayar has joined #ruby
OrangeJewce has joined #ruby
<nickjj>
for example in the person_exists case, it just does a lookup in the db on a unique field and returns true/false if it exists or not
<jhass>
gisting the whole thing would violate your NDA you think?
it0a has joined #ruby
PaulCapestany has joined #ruby
tgunr has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
timanema has quit [Ping timeout: 272 seconds]
<apeiros_>
nickjj: mid-code returns are a horrible habit and you should quit it
<nickjj>
i have 18 security cameras on me, if i share the code everyone here would have to be eliminated
<apeiros_>
and you can read about it about everywhere. there's virtually no disagreement there.
<nickjj>
seriously though, it's just scraping a website and looping through "people"
<apeiros_>
you'd not want to quit early because your code becomes messy to read. you phrase your branching properly and move stuff to methods in a meaningful way. result: readable code.
<jhass>
again, what it does is actually not relevant here, the structure and similarity of the cases and calls is
spicerack has quit [Ping timeout: 240 seconds]
<phale>
jhass
<phale>
I need the best tutorial money can buy
<phale>
or can't buy
<nickjj>
jhass, everything is the same except the "status" part of the fn call
PaulCapestany has quit [Max SendQ exceeded]
braincra- has joined #ruby
devyn_ has quit [Ping timeout: 240 seconds]
<jhass>
phale: senior dev that personally mentors you, standing physically next to you
<phale>
good one
<phale>
haha
devyn has joined #ruby
zenith_ has quit [Remote host closed the connection]
<apeiros_>
nickjj: it seems to me - from the limited code you gave - that you want to parametrize status: STATUS[:missing_person]
<apeiros_>
and don't even need all those ifs
rbennacer has joined #ruby
PaulCapestany has joined #ruby
<nickjj>
apeiros_, the ifs are database queries that return true/false
<nickjj>
given my naming of the methods you can probably guess which one i prefer
JohnBat26 has quit [Ping timeout: 272 seconds]
<apeiros_>
there's absolutely no reason to return early there.
braincrash has quit [Ping timeout: 252 seconds]
<canton7>
imo that isn't a valid use-case for an early exit
<apeiros_>
note: I do consider *immediate* returns a different thing than*mid-code* returns.
zenith_ has joined #ruby
jottr has joined #ruby
<apeiros_>
but the example you gave is still poor
xtagmy has joined #ruby
<canton7>
it took me about twice as long to mentally parse the second example
Qladstone has quit [Ping timeout: 256 seconds]
<nickjj>
ok, let me gist this whole scrape thing after removing just a tiny bit of the NDA protected secret sauce
iamjarvo has joined #ruby
<nickjj>
i'll simply rename a few urls and variable names
<apeiros_>
nickjj: def yay; foo ? 'hello' : 'bar'; end
iamjarvo has quit [Max SendQ exceeded]
<workmad3>
If it's really a single value for the condition, and two single-word branches (simple literals or single method calls), I'd personally do a ternary... foo ? "hello" : "bar"
<workmad3>
as apeiros_ just said too :)
<apeiros_>
as said, poor case, bad code.
iamjarvo has joined #ruby
jonr22 has joined #ruby
<nickjj>
sure, but what if you wanted to do 2 things based on the condition of foo
<apeiros_>
or if you dislike ternary, a fully written out if/else is still better.
<nickjj>
my example was too simple i'm afraid
tgunr has joined #ruby
<apeiros_>
then use an if/else, as the programming language elders command you to :-p
<canton7>
if you want to do two different things based on a single parameter, imo you need two sub-methods
<apeiros_>
and ^
<canton7>
... then it boils down to the same, and the if/else is clearer
<nickjj>
ok, give me 2min to supply the gist, hold your horses
<apeiros_>
"say what you mean"
<canton7>
(depending on how large those two different things are, of course)
<apeiros_>
canton7: was about to say the same
<canton7>
:P
<workmad3>
canton7: aww, you mean you'd disagree with my use of a ternary with an 80-character variable holding the condition and 2 60 character method names for each branch?
<canton7>
sure, a ternary would work too
<apeiros_>
workmad3: lol
<canton7>
I would use a ternary for "do X if condition, else do Y", but for getting a value, sure
<apeiros_>
I'm all for meaningful names, but 80 chars seems *slightly* excessive :D
<canton7>
and I'm happy line-splitting ternaries, so long method names is fine :)
polysics has quit [Remote host closed the connection]
ghostpl_ has quit [Remote host closed the connection]
<workmad3>
apeiros_: if I'm not careful, I'm going to end up spending the afternoon integrating a password generator into vim as a variable name generator :)
<phale>
i've been at it for five hours and it still is not fixing itself
<phale>
im not even sure what the problem is
<canton7>
code doesn't fix itself ;)
<phale>
okay
<phale>
but still, the loop will hang after a valid login
<phale>
weird
<canton7>
which line is it hanging on?
rippa has joined #ruby
hanmac1 has quit [Quit: Leaving.]
<workmad3>
phale: err.... why is your loop *outside* your Thread? :/
<phale>
it is?
<jhass>
workmad3: it's fine, it's blocking on the accept
<workmad3>
jhass: yeah, just spotted that
<jhass>
workmad3: standard fork on connection thingy
<phale>
how do I unblock it then
<jhass>
phale: it's fine
<canton7>
phale, what line is it blocking on?
<canton7>
s/blocking/hanging/
<phale>
well it sends "Login attempt: user password"
jlast has quit [Remote host closed the connection]
jonr22 has quit [Ping timeout: 264 seconds]
<workmad3>
phale: well, after that the connection is closed and you'd need to start a new connection
<jhass>
phale: where does statecmp come from?
<nickjj>
i removed some comments and unimportant things like scrape implementation details (ie. extracting fields from selectors)
timonv has quit [Ping timeout: 240 seconds]
<canton7>
phale, so is it line 19, line 25, line 20, etc, that hangs? which is the last exact line that executes?
<jhass>
phale: oh, yeah, what workmad3 said first
<phale>
statecmp
<canton7>
if you're not sure, add more logging :)
<phale>
u know
<phale>
statecmp
<phale>
uh
<phale>
yeah that might be it
timonv has joined #ruby
ascarter has joined #ruby
mkaesz has joined #ruby
Cache_Money has joined #ruby
beneggett has joined #ruby
<phale>
didn't fix it
<phale>
it will execute the puts "Login attempt: user pass"
<phale>
after that it just doesnt work
sinkensabe has quit [Read error: No route to host]
sinkensabe has joined #ruby
<workmad3>
phale: hmm... actually, as jhass said... what is 'statecmp', where did it come from, what do you think it's doing?
<phale>
i just got rid of it
<phale>
it was an error
<workmad3>
phale: also, where is @accounts initialised?
<phale>
initialize
<phale>
@accounts = Hash.new
<workmad3>
phale: can't see that in the code you pasted
<phale>
well it shouldn't be too much of a problem
<phale>
if you don't see it that is
<workmad3>
phale: unless it has a typo in initialization and you're hitting an exception that's killing the thread because @accounts in nil
ghostpl_ has joined #ruby
<workmad3>
phale: seeing as it 'dies' between printing 'login attempt' and any other logging, and the only thing that happens there is 'valid_login', it's a fairly good candidate for an issue
phutchins has joined #ruby
<phale>
hm
timanema has joined #ruby
<phale>
maybe
hobodave has joined #ruby
<workmad3>
phale: also, do you have an objection to normal if/else statements? :)
joonty has quit [Quit: joonty]
<nickjj>
jhass, i'd be really curious to see how you'd refactor that
<phale>
i use this because it's short
<phale>
concise and clear
<phale>
;)
<workmad3>
phale: err... not particularly
<phale>
yes
<canton7>
you check valid_login twice....
<workmad3>
^^
<canton7>
once with an unless, once with an if
<phale>
so what does a man do?
<canton7>
if test ... else ... end
<jhass>
nickjj: looking currently, not sure I follow the logic for resetting start_at_per_page, it'll always be 1 inside the loop
scripore has quit [Quit: This computer has gone to sleep]
<workmad3>
phale: you have a long, ugly way of doing 'if valid_login(...); <blah>; else; <blah>; end'
<canton7>
not if test ... end if !test ... end
<nickjj>
jhass, reload the gist (i added a comment since then), but line 36 (after the reload) increments it
<phale>
okay
<phale>
i added an else removed the unless and put the code from unless into else
<phale>
was that supposed to fix it?
lolmaus__ has quit [Quit: Konversation terminated!]
<nickjj>
jhass, i reset it back to 1 because imagine this output, page 1 : 1/50 ... page 1 : 2/50 ... page 2 : 1/50
<workmad3>
phale: no, just a comment on truly horrendous code
<workmad3>
phale: also out of curiosity... where are 'name' and 'version' coming from?
scripore has joined #ruby
zenith_ has quit [Remote host closed the connection]
<nickjj>
page_begins_at might be a better var name, this is just something i hacked together as a first iteration
<phale>
truly horrendous
<phale>
>truly horrendous
<phale>
is this your first time writing ruby?
jenrzzz has joined #ruby
<phale>
it's not maximally horrendous
<workmad3>
phale: only if you ignore the last 8 years I've spent doing it :P
<phale>
i agree it sucks at parts
jimms has joined #ruby
<phale>
but the rest is good
Takle has joined #ruby
<nickjj>
jhass, perhaps a case/when for each "exit early" condition is more clear?
<workmad3>
phale: if it was good, it would work :P
<workmad3>
phale: still... 'name' and 'version'... where do they come from?
<phale>
name is an attr_accessor
<phale>
version is from initialize
tkuchiki has quit [Remote host closed the connection]
<workmad3>
phale: is it 'version' or '@version'?
<phale>
@version
<workmad3>
phale: ok, then there's your issue
<phale>
okay thanks
<workmad3>
phale: ' c.puts "Welcome to #{name} #{version}", "Type help for some commands."' <-- 'version' is wrong there
joonty has joined #ruby
tkuchiki has joined #ruby
<phale>
that fixed it
<phale>
ty
<workmad3>
phale: it'll be throwing a NoMethodError which will crash everything out
sj has quit [Ping timeout: 265 seconds]
<workmad3>
phale: out of curiosity... are you a C programmer by day?
red_horned_rihno has quit [Ping timeout: 256 seconds]
AirstripOne has joined #ruby
* apeiros_
off for commute, curious to see jhass' refactoring when back online :D
<phale>
workmad3: yes
<phale>
but i dont program in it anymore
<workmad3>
phale: it shows ;)
<phale>
where
<workmad3>
phale: in the way you wrote that method
<phale>
hm
<phale>
yes
apeiros_ has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 256 seconds]
sinkensabe has quit [Remote host closed the connection]
zenith_ has joined #ruby
<phale>
workmad3: want an exercise?
<workmad3>
phale: not particularly
<AirstripOne>
Has anyone else on here done project euler?
<phale>
it's okay
<phale>
if i can't do it you probably can't do it either
<phale>
uhh PPM parser + output raster width and height onto colors on terminal
<canton7>
phale, that's not the point. most of us have our own lives to read, and making little networking toy scripts for you doesn't add value
<canton7>
*to lead
gizmore has joined #ruby
<workmad3>
phale: as I said, not particularly... and the backhanded insult to my capabilities doesn't entice me into it either
<canton7>
trying to insult people into helping you doesn't work either. it just turns everyone watching against you
<workmad3>
phale: I have no need to prove myself to you :P
<phale>
i didn't see that i was insulting someone
tkuchiki has quit [Ping timeout: 272 seconds]
<phale>
sorry
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
psy_ has joined #ruby
<workmad3>
canton7: hear that? he doesn't think I'm a person! :(
<sivsushruth>
lel
<canton7>
<phale> if i can't do it you probably can't do it either <-- that's saying someone's worse than you
aganov has quit [Remote host closed the connection]
<phale>
no
<phale>
it means equal
<phale>
same equality
<phale>
wasn't saying he was worse
<canton7>
when you're bad, that's still saying someone's bad :P
<phale>
maybe if you interpret data that way
garethrees has quit [Remote host closed the connection]
<phale>
i interpret it differently
<canton7>
anyway, client call, yay
<workmad3>
phale: unfortunately, insults don't work on how you interpret them, they work on how everyone else interprets them
ghr has joined #ruby
kblake has joined #ruby
<workmad3>
phale: and it came across as a very "hey, if you're so good and judgemental, why don't you do this, but I bet you can't because you're just as bad as I am at this stuff"
senayar has quit []
<phale>
with the same logic you could say a book is insulting you
<phale>
if it gives you an exercise
bal has quit [Quit: bal]
mskaesz has joined #ruby
djcp has joined #ruby
<workmad3>
phale: if a book stated 'try this, but I bet you can't do it because I can't and I can't even write simple ruby' then yes, it would be insulting
<phale>
can't you let bygones be bygones?
<phale>
i insulted you once accidentally, said i was sorry
<phale>
what else do you want from me?
<workmad3>
phale: a pint of blood and a pound of flesh, fedexed to an anonymous PO box...
<phale>
i'll just ignore you to avoid any conflict
<phale>
sorry
* workmad3
shrugs
mskaesz has quit [Remote host closed the connection]
spyderma_ has quit [Remote host closed the connection]
crueber has joined #ruby
mkaesz has quit [Ping timeout: 245 seconds]
<havenwood>
AirstripOne: I haven't done all of them, but some.
startupality has quit [Quit: startupality]
<AirstripOne>
It's pretty good practice for writting efficient algos when you move up. Although I notice the poeple tend to look down on Ruby
<phale>
The Ruby Programming Language eh?
<phale>
sounds like a splendid work of art
<phale>
i'mma go read it
<AirstripOne>
I guess they would feel better if you had to write every freaking method/function in C...no thanks
fabrice31 has quit [Remote host closed the connection]
paradoja has quit [Ping timeout: 240 seconds]
red_horned_rihno has joined #ruby
agarie has joined #ruby
<workmad3>
AirstripOne: I've done a few of them, mostly did them in ruby
<havenwood>
AirstripOne: There are quite a few now. It'd be quite an accomplishment to complete them all.
KidCartouche has quit [Quit: Leaving]
<AirstripOne>
I'
<AirstripOne>
I'm trying. Some of them now takes days
zenith_ has quit [Ping timeout: 264 seconds]
<havenwood>
AirstripOne: Nice.
<workmad3>
AirstripOne: to figure out? or to run?
<AirstripOne>
to figure out
<AirstripOne>
to run the max is 60secs
<workmad3>
AirstripOne: ah, yeah... they're not intended to be easy :)
Hirzu has quit [Ping timeout: 246 seconds]
AlexRussia has quit [Ping timeout: 256 seconds]
spyderman4g63 has joined #ruby
<AirstripOne>
workmad3: that's for sure. you get a false sense on the first 20 and then it goes up and up. although, like I said. Ruby gets no respect on the forum
<workmad3>
AirstripOne: what I've encountered a few times is that I give up on a problem on PE, then when I look at it again a year or two later the answer is obvious :)
<AirstripOne>
exactly! same for me
<AirstripOne>
the subconcious takes over thinking about it
<AirstripOne>
SERVLIST
<workmad3>
AirstripOne: well, for me I think it's more that I've spent time reading various bits on maths, physics and thinking techniques in the interim, and I end up just spotting the answer quicker, rather than a subconcious process that lasted a year or more thinking about the one thing ;)
jaequery has joined #ruby
replay has joined #ruby
<AirstripOne>
that too!
ghr has quit []
<AirstripOne>
I haven't read this much on number theory in years
mistermocha has joined #ruby
<phale>
anyone here who has read TRPL?
ghr has joined #ruby
<hoelzro>
phale: I have
<hoelzro>
I very much enjoyed it
<phale>
did you learn ruby?
<phale>
like at a very advanced level?
wallerdev has joined #ruby
<phale>
including the syntax etc
<AirstripOne>
I prefer the pick axe books, The well grounded rubyist, and Why's book
<phale>
TRPL is written by the creator of ruby
<AirstripOne>
Ruby is a fun language but it doesn't scale well.
mloveless has joined #ruby
Morkel has quit [Quit: Morkel]
<phale>
im sure he knows how to explain it the best
<phale>
seeing as he made the language..
max96at|off is now known as max96at
mistermo_ has joined #ruby
<AirstripOne>
I think David Flanagan wrote TRPL and Matsumoto just signed his name
scripore has quit [Quit: This computer has gone to sleep]
hollywood has joined #ruby
<phale>
dunno
aarkerio has joined #ruby
<aarkerio>
I'm reviewing a class for a fellow programmer and in the bottom of the class I see the code:
<nickjj>
apeiros, oh. i simplified it to a string -- the STATUS[:foo] is just a hash with symbol/string pairs for the actual log msg
zenith_ has quit [Remote host closed the connection]
<apeiros>
seems to me like you also removed logic…
<jhass>
nickjj: apeiros so I think http://paste.mrzyx.de/p5pgturna would be my idea, not super happy, especially about the names, but that's what it is when you have to work in the abstract
<apeiros>
the if's are not present
spyderman4g63 has quit [Ping timeout: 272 seconds]
<nickjj>
apeiros, yeah i reversed the logic in the first gist to make it more simple to read
<nickjj>
the full one is the real actual logic
adriancb has quit [Read error: Connection reset by peer]
kaiZen- has joined #ruby
<nickjj>
jhass, checking
boshhead has joined #ruby
adriancb has joined #ruby
<jhass>
nickjj: basically regard page as an object containing multiple Foos, thus start by extracting them to their own builders/factories/parser whatever you want to call it
mistermocha has joined #ruby
lemur has quit [Remote host closed the connection]
<nickjj>
jhass, i don't think the logic matches hmm
bruno-_ has quit [Ping timeout: 265 seconds]
<phale>
jhass
<jhass>
well, in your full gist, the actual logic was still very vague
maletor has quit [Quit: Computer has gone to sleep.]
<phale>
Do you know a good Ruby Image Parser
<phale>
for most file formats
<jhass>
nickjj: for example .find_by_title? and Foo.exists? are basically the same thing
<nickjj>
jhass, yeah. those are parts i did slightly change. realistically there's like 15 attributes and 3 of them are being checked
<jhass>
nickjj: I assumed proper uniqueness validations so replaced the .exists? by just checking whether the save succeeded
danzilio has joined #ruby
<jhass>
but those are details
OrangeJewce has quit [Quit: Leaving.]
odigity has joined #ruby
<jhass>
the more important parts are decoupling the logging from the parsing by extracting parsing the individual item to its class and provide the relevant data for the logging as attributes
<jhass>
its own
HOrangeJewce has joined #ruby
<jhass>
phale: no
<nickjj>
yeah i'm going over that now, but i wonder if the added complexity is worth it
_blizzy_ has quit [Ping timeout: 265 seconds]
<nickjj>
let's say i were to remove those checks/nexts and validate things properly
multi_io has joined #ruby
<nickjj>
it goes from around 25 lines of code to almost a 100 with your version
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass>
assuming you have to read it fully to get a quick overview of what its intention is
MasterPiece has joined #ruby
<nickjj>
i'm scraping 2 pages that are similar, the only difference is what model gets acted on and the logging status
<nickjj>
some scraping details are a little different but almost all of process_page is the same
<jhass>
well, that's the issue
<jhass>
I can only work on what I know
<nickjj>
yeah, i'm just saying with your version it might be a win
<jhass>
so my solution optimized from what I know, not from your real requirements
<nickjj>
because right now i'm basically duplicating your process_page method twice
<phale>
Guys
<phale>
How do most people parse files becausei m making a PPM parser
zenith_ has joined #ruby
<jhass>
phale: they open them, read them and interpret their contents
ramfjord has joined #ruby
<nickjj>
jhass, thanks for looking into it. this definitely gives me some ideas
paradoja has joined #ruby
<jhass>
nickjj: all it should do, you're welcome :)
<nickjj>
my version is kind of a hacky-but-works solution
<nickjj>
yours seems more polished
jenrzzz has joined #ruby
<phale>
jhass: That's pretty great
<phale>
I know how to open and read them but how do I interpret their contents in The Ruby Programming Language 1.9.3+
krz has quit [Quit: WeeChat 1.0.1]
<jhass>
nickjj: what I found to be the main thing that helps in writing more readable code is trying to keep the "same level of abstraction" inside a method rule
<nickjj>
jhass, want me to PM you the unedited version?
<nickjj>
you don't need to go nuts on it, but just see it
<jhass>
nickjj: that makes you extract more code into private methods and by doing so you're more likely to recognize groups of methods (and thus chunks of code) that belong to their own class
<eam>
phale: do you know the data structure of a PPM file?
<jhass>
nickjj: tbh I have enough for the moment, should cook some food instead :P
<nickjj>
jhass, yeah i was hoping you could give it a 30 second glance and then determine if your current refactor is still a good idea
<nickjj>
in which case i'd adjust my code to that style
<phale>
eam: yes
<jhass>
it doesn't work like that for me unfortunately, I have to move code around until something emerges :)
<eam>
phale: if you can slurp the whole file into memory it's very easy and you can traverse the buffer as an array
zenith_ has joined #ruby
<eam>
if you can't, you can step through the file with read() and seek()
devdazed has quit [Ping timeout: 252 seconds]
kobain has joined #ruby
<phale>
hm
<phale>
maybe
jaequery has joined #ruby
kobain has quit [Max SendQ exceeded]
js12345 has joined #ruby
mistermocha has quit [Ping timeout: 264 seconds]
versatiletech has joined #ruby
<phale>
im really confused rn
yeticry has quit [Ping timeout: 246 seconds]
aphprentice has joined #ruby
<eam>
about?
iamjarvo has quit [Read error: Connection reset by peer]
<phale>
everything except the slice
iamjarvo_ has joined #ruby
adriancb has joined #ruby
ndrei has joined #ruby
<eam>
welp, if you have a specific point of confusion I'm happy to help
snockerton has joined #ruby
<phale>
the thing you said
<phale>
slurp memory, read() and seek()
jimms has quit [Remote host closed the connection]
scripore has joined #ruby
arup_r has joined #ruby
spyderman4g63 has joined #ruby
Guest97324 is now known as marx
<eam>
phale: whole_file_as_one_big_string = filehandle.read # reads (slurps) the entire file into memory
<phale>
ah yes
<phale>
i do that
<eam>
if the file is larger than memory this won't work
maximski has joined #ruby
User458764 has quit [Client Quit]
yeticry has joined #ruby
<phale>
a .ppm file(regularly) can be around 1.3mb
<phale>
is that a lot?
<eam>
generally no
<jhass>
phale: a file descriptor does not only point to file, it points to a position inside the file. read reads from that position forward, seek sets that position
DerisiveLogic has joined #ruby
<phale>
cool
<eam>
phale: you can use [] to look at individual bytes in the file
<phale>
one problem though
mistermocha has joined #ruby
<phale>
GIMP adds a comment which can break everything
<eam>
phale: your parser will have to understand comments
djbkd has joined #ruby
<phale>
yeah
<phale>
i just have to ignore them somehow
<eam>
parsing is a fairly complex problem, you might want to start with a more fundamental approach
<phale>
you can clearly see that some things are bad
<phale>
in the code that is
beneggett has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<eam>
sure, hopefully it'll get you started
danjordan has quit [Quit: danjordan]
zenith_ has quit [Ping timeout: 256 seconds]
odigity has quit [Ping timeout: 265 seconds]
stef204 has joined #ruby
spyderma_ has joined #ruby
Takle has quit [Remote host closed the connection]
Ankhers has joined #ruby
timonv has quit [Ping timeout: 246 seconds]
<phale>
thanks
BTRE has joined #ruby
mistermo_ has joined #ruby
og01 has joined #ruby
spyderman4g63 has quit [Ping timeout: 264 seconds]
strixd has quit [Quit: 500]
momomomomo has quit [Ping timeout: 256 seconds]
misterm__ has joined #ruby
qiffp has quit [Ping timeout: 264 seconds]
ascarter has joined #ruby
zenith_ has joined #ruby
<og01>
hi guys, I am not familiar with bundle and am trying to understand how it works, my problem is that im trying to run a ruby program but the gem kitchen-vagrant was older than what i needed (from git)
User458764 has joined #ruby
mistermocha has quit [Ping timeout: 246 seconds]
tag has joined #ruby
<og01>
i tried using bundle at this point and added test-kitchen and kitchen-vagrant to the Gemfile, and did bundle install
arup_r has quit [Ping timeout: 265 seconds]
mistermocha has joined #ruby
mistermo_ has quit [Read error: Connection reset by peer]
ascarter has quit [Client Quit]
GaryOak_ has joined #ruby
<og01>
unfortunatly when i ran the program (kitchen) it still used the ones i installed with gem, so I gem uninstall'ed both packages and run bundle install again
<og01>
the kitchen binary was available again (presumably from the bundle install)
<og01>
but it couldnt find the kitchen-vagrant gem which was installed via bundle
maximski has quit []
commmmodo has quit [Quit: commmmodo]
rocknrollmarc has joined #ruby
<og01>
i guess this is to do with include paths with ruby, but im not really sure where and how ruby finds its modules, nor esactly where bundle installs them
JoshGlzBrk has joined #ruby
lemur has quit [Remote host closed the connection]
CustosLimen has quit [Ping timeout: 264 seconds]
<jhass>
og01: prefix your command with bundle exec
leslie has quit [Quit: Have you ever tried to eat a clock? It's very time consuming.]
misterm__ has quit [Ping timeout: 246 seconds]
Bounga has quit [Quit: See ya]
oki_ has quit [Ping timeout: 240 seconds]
sinkensabe has quit [Remote host closed the connection]
triple_b has joined #ruby
<og01>
jhass: kitchen is still unable to find the module kitchen-vagrant, give me a minute i'll play around with it
havenwood has quit [Remote host closed the connection]
<jhass>
og01: make a gist with the full error output, your Gemfile and the exact commands you run if still fails
joonty has quit [Quit: joonty]
jonr22 has joined #ruby
dandaman has quit [Quit: Leaving.]
maletor has joined #ruby
rocknrollmarc has quit [Read error: Connection reset by peer]
Synthbread has quit [Ping timeout: 252 seconds]
hk3380 has joined #ruby
odigity has joined #ruby
Rapier- has joined #ruby
bricker has joined #ruby
js123456789 has joined #ruby
rbennacer has quit [Remote host closed the connection]
gluten_hell has quit [Quit: Computer has gone to sleep.]
<workmad3>
jhass: you could probably reduce to 8-bit grayscale reasonably by either picking the highest value out of an RGB triple or by getting the mean of them
<davejlong>
jhass: It's just a simple site, as it sounded like you were just trying to find out what the hex FF is, which doesn't output in a lot of terminals.
<Senjai>
agarie: I've seen it
<Senjai>
agarie: I'd be happy to offer code review
<workmad3>
jhass: you could probably then reduce it to 15 grays by doing colour.fdiv(17).round
<Senjai>
agarie: but I know little about actual science
joast has quit [Client Quit]
<jhass>
davejlong: I count in hex that far, thanks :)
User458764 has joined #ruby
<workmad3>
jhass: and assuming a map of each integer to a suitable gray on the screen :)
<phale>
jhass: what was the method you use to convert from \x to integer?
<phale>
s/use/used/
versatiletech has quit [Quit: versatiletech]
<jhass>
phale: do you have scrollwheel?
dandaman has quit [Quit: Leaving.]
<workmad3>
jhass: 3 methods... one is an average as I said, one is to take the highest and lowest and average them, and the third is fairly specific percentages of R, G and B to create a combined gray :)
<phale>
yes but im on terminal
<phale>
it doesnt work on irssi
<shevy>
phale shevegen.square7.ch/screenshot.png
arup_r has quit [Ping timeout: 245 seconds]
<workmad3>
phale: if you hadn't ignored me, I could now tell you that pgup and pgdown work in irssi
<phale>
workmad3: really?
<workmad3>
phale: ah, so you unignored me :P
<shevy>
use xchat!
<phale>
i never ignored you lol
<shevy>
either xchat or peechat
<phale>
peechat?
<shevy>
yeah!
<phale>
sounds discomforting
<workmad3>
phale: and yeah, pgup pgdown work fine, or if you're on a mac kb, then fn + uparrow/downarrow
<jhass>
shevy: xchat doesn't support sane TLS though
<workmad3>
phale: look at line 20 and 21 of your code
buub has joined #ruby
<workmad3>
phale: how is it immensly confusing?
<phale>
uh
<phale>
read it
<workmad3>
phale: it's saying that there are width * height pixels as the raster
<workmad3>
phale: and each pixel consists of rgb triples
<phale>
oooo right
_cake has joined #ruby
<workmad3>
phale: you need to know the maxval to know whether it's 1 byte or 2 bytes per colour component though
<workmad3>
phale: and if you read carefully, it even tells you the important bit about endianness of the bytes ;)
phoo1234567 has quit [Ping timeout: 240 seconds]
Guest42392 has quit [Ping timeout: 246 seconds]
pork_clips has quit [Ping timeout: 245 seconds]
ghr has joined #ruby
bruno-_ has joined #ruby
<phale>
maxval is 255
dtordable has joined #ruby
<phale>
for me ;)
<workmad3>
phale: ok, then 1 byte per component ;)
<workmad3>
phale: which means 3 bytes per pixel
<workmad3>
phale: so your raster should be 3 * height * width pixels long, which you can then carve up into an array of arrays if you so desired
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<workmad3>
s/pixels/bytes in my last comment
<phale>
can you give me a ruby code example of this?
<phale>
just to simplify things
freerobby has quit [Quit: Leaving.]
freerobby has joined #ruby
agarie has joined #ruby
ereslibre has quit [Remote host closed the connection]
pontiki has quit [Remote host closed the connection]
gccostabr has quit [Quit: See you later!]
pontiki has joined #ruby
versatiletech has joined #ruby
jenrzzz has joined #ruby
JDiPierro has joined #ruby
ghr has quit [Ping timeout: 256 seconds]
ereslibre has joined #ruby
scripore has quit [Quit: This computer has gone to sleep]
HOrangeJewce has joined #ruby
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
scripore has joined #ruby
rdark has quit [Quit: leaving]
Mon_Ouie has joined #ruby
Mon_Ouie has joined #ruby
rocknrollmarc has joined #ruby
<workmad3>
phale: you mean something like info[:raster_grid] = info[:height].to_i.times{|h| info[:raster][3 * h * info[:width].to_i, 3 * info[:with].to_i] }
tkuchiki has joined #ruby
rocknrollmarc has quit [Max SendQ exceeded]
Takle has joined #ruby
<phale>
it's already an integer
rocknrollmarc has joined #ruby
<workmad3>
phale: wrong :P
<phale>
how
rocknrollmarc has quit [Max SendQ exceeded]
<phale>
i put .to_i
<workmad3>
phale: because you redid the split and assigned the string back to info[:height] and info[:width]
rocknrollmarc has joined #ruby
<graft>
what are you guys talking about? storing an image?
rocknrollmarc has quit [Client Quit]
<phale>
graft: kinda
<workmad3>
graft: he's writing a PPM reader
<phale>
not rly tho
<graft>
what's happening after you read it?
<workmad3>
graft: or rather, attempting to write a PPM reader
JDiPierro has quit [Ping timeout: 244 seconds]
iamjarvo_ has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 252 seconds]
ismaelga has joined #ruby
<workmad3>
and I'm off to grab food now, so hf ;)
<phale>
workmad3: thanks
beneggett has joined #ruby
thumpba has quit [Remote host closed the connection]
workmad3 is now known as wm3|away
<graft>
phale, what are you doing after you load the ppm into memory?
tohsig has quit [Read error: Connection reset by peer]
<phale>
splitting it into spaces
<phale>
and then putting the information into a hash
thumpba has joined #ruby
<graft>
i mean, to what end?
<phale>
uh
kaiZen- has quit [Ping timeout: 245 seconds]
<phale>
the literal end of the file
tohsig has joined #ruby
User458764 has joined #ruby
Takle has quit [Ping timeout: 256 seconds]
tkuchiki has quit [Ping timeout: 256 seconds]
<graft>
... what is your ultimate purpose? you're trying to extract some information or something?
<graft>
why do you want to read a ppm file, is what i am asking
mistermocha has joined #ruby
bruno-_ has quit [Read error: No route to host]
chinmay_dd has quit [Quit: Leaving]
JDiPierro has joined #ruby
kaiZen- has joined #ruby
versatiletech has quit [Ping timeout: 272 seconds]
iamjarvo has joined #ruby
coderkevin has quit [Quit: Connection closed for inactivity]
Megtastique has joined #ruby
<phale>
graft: well
Megtastique has quit [Max SendQ exceeded]
<phale>
it's the easiest image format to use for my new ascii art image interpreter
<graft>
so you have a drawing in ppm format and you want to print it in ascii
oki has joined #ruby
<phale>
yes
<phale>
but coloured ascii
<phale>
print " ".colorize(:background => :white)
<graft>
and it's 1 pixel => 1 ascii character?
<phale>
for example
<phale>
yes
djbkd has joined #ruby
Stalkr_ has joined #ruby
<phale>
work3: your example is strange
mjuszczak has quit []
<phale>
it gives me 4
ndrei has joined #ruby
ramfjord has joined #ruby
Megtastique has joined #ruby
mloveles_ has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
xtagmy has quit [Remote host closed the connection]
grrrr__ has joined #ruby
dtordable has quit [Quit: • IRcap • 8.72 •]
Guest50 has joined #ruby
joast has joined #ruby
joast has quit [Remote host closed the connection]
mloveless has quit [Ping timeout: 264 seconds]
<graft>
phale, you should move some of this stuff around. "info" should clearly be PPMImage class or something, not a bare hash, and you should probably do something like parser = ImageParser.new('bla.ppm',ImageType::PPM); ppm = parser.parse_ppm
<Stalkr_>
Anyone here used Grape/Sinatra for APIs?
<graft>
Stalkr_: i've been thinking about it
qiffp has joined #ruby
<Stalkr_>
graft: Played with either of them?
<graft>
Stalkr_: so far the disadvantage seems to be you don't get controllers with sinatra
<graft>
not sure about grape
mloveles_ has quit [Ping timeout: 252 seconds]
<graft>
i'm leaning towards rails API, if I can avoid activerecord
<Stalkr_>
Why would you need controllers with an API?
mjuszczak has joined #ruby
<graft>
eh, seems easier to organize endpoints that way
spider-mario has quit [Quit: No Ping reply in 180 seconds.]
<Stalkr_>
I'm just playing with Grape/Sinatra but Grape seems so... verbose
sevvie has quit [Ping timeout: 246 seconds]
joast has joined #ruby
tunaCanBruh has joined #ruby
n0zz has joined #ruby
n0zz has quit [Client Quit]
<GaryOak_>
I've used grape a little bit and it's a lot more strict because it's for API's
n0zz has joined #ruby
commmmodo has joined #ruby
<Stalkr_>
GaryOak_: Is it easier to use compared to just Sinatra?
jenrzzz has joined #ruby
joast has quit [Client Quit]
ptrrr has joined #ruby
joast has joined #ruby
spider-mario has joined #ruby
einarj has quit [Remote host closed the connection]
tus has joined #ruby
joast has quit [Client Quit]
Megtasti_ has joined #ruby
benlieb has quit [Quit: benlieb]
<n0zz>
Hey, can someone recommend me something to visualise data? I tried to use googlecharts, but this gem was for image google charts, which is old and not fun, and not everything works there... :/
tunaCanBruh has quit [Ping timeout: 246 seconds]
DouweM has quit [Read error: Connection reset by peer]
oki has quit [Ping timeout: 272 seconds]
joast has joined #ruby
joast has quit [Client Quit]
<phale>
n0zz: data
<GaryOak_>
Stalkr_: yeah for building APIs it's really nice, you can enforce params really easily, and do nice versioning
egtann has joined #ruby
joast has joined #ruby
ismaelga has quit [Remote host closed the connection]
sevvie has joined #ruby
Megtastique has quit [Ping timeout: 256 seconds]
red_horned_rihno has quit [Quit: Leaving]
joast has quit [Client Quit]
<GaryOak_>
Stalkr_: although like it says in the README that it's definitely opinionated about how to structure things
<Stalkr_>
GaryOak_: I'll try to play with it. Want to do some front-end work with some JS framework and have an API running behind
Channel6 has quit [Remote host closed the connection]
<Stalkr_>
I don't mind opinionated, then I know whether I am doing something right or wrong
<phale>
Stalkr_ GaryOak_: >>#ror
joast has joined #ruby
<GaryOak_>
Yeah and it's got good documentation so that helps
<mwlang>
Surely, Ruby and LDAP aren’t still the most archaic, hardest thing to do in Ruby 8 years later. (grumbles)
anarang has quit [Client Quit]
livathinos has quit []
tvon has joined #ruby
piotrj has joined #ruby
sevvie has quit [Ping timeout: 256 seconds]
<mwlang>
Are the only gems for LDAP net-ldap, ruby-net-ldap, and ruby-ldap?
FooMunki_ has quit [Read error: Connection reset by peer]
<jhass>
rubygems.org would know
<mwlang>
The latter two do not seem to be able to even make a connection to the ldap server whereas the first one does make a connection, but putting together a query is challenging at best.
valkyrka has quit [Read error: No route to host]
diego_ar has joined #ruby
goshdarnyou is now known as goshdarnyoutest
goshdarnyoutest is now known as goshdarnyou
FooMunki_ has joined #ruby
cVit_ has quit [Quit: Си одам]
<mwlang>
jhass: Ah, I didn’t think to put a search on the rubygems.org site itself….google doesn’t know all after all!
<mwlang>
lots of options to explore
tvon has quit [Read error: Connection timed out]
tvon has joined #ruby
<workmad3>
mwlang: bleh, I had to deal with net-ldap for some integration recently... it really does suck badly :(
<zhan_>
right so I got more of a math problem, 3 numbers, 219, 1241, 7024. The correlation between them is 17.65 percent going from big number to small, what's opposite? otherwise whats the number after 7024
decoponio has quit [Quit: Leaving...]
<workmad3>
zhan_: you need to find out what number 7024 is 17.65% of ?
ramfjord has quit [Ping timeout: 265 seconds]
<zhan_>
no 1241 is 17% of 7024
<zhan_>
what number comes after 7024 with the same correlation though
morenoh149 has quit [Ping timeout: 240 seconds]
momomomomo has joined #ruby
<zhan_>
whats the formula i use?
<mwlang>
workmad3: it definitely feels like throwback to PHP or Perl rather than idiomatic Ruby
tmtwd has joined #ruby
<zhan_>
uh yes
<workmad3>
zhan_: lay it out as a multiplication, after converting the percentage to 0.17 form ;)
<zhan_>
workman you're right
<zhan_>
what?
<workmad3>
zhan_: i.e. x * 0.1765 = 7024... very easy to figure out from there
g0bl1n has joined #ruby
<zhan_>
uh jesus
<zhan_>
true
<GaryOak_>
Algebra!!!!
<workmad3>
GaryOak_: basic algebra at that! :)
* GaryOak_
shakes fists at algebra
* mwlang
thinks he’s in the wrong room...
<workmad3>
GaryOak_: if you didn't have algebra, you wouldn't have the interwebs that you're now using to curse algebra
<zhan_>
so im figuring out relations of multipliers
peterhu has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
jonr22 has quit [Ping timeout: 256 seconds]
<centrx>
zhan_, GaryOak_ is an expert in algebra
whoughton has joined #ruby
baweaver has joined #ruby
hobodave has quit [Client Quit]
baweaver has quit [Remote host closed the connection]
<GaryOak_>
I am, just replace the numbers with the letters
versatiletech has joined #ruby
<zhan_>
so than i'm creating a class or a toolbox for these multipliars?
Rephiax has joined #ruby
hobodave has joined #ruby
_Andres has quit [Quit: My Mac Pro has gone to sleep. ZZZzzz…]
gluten_hell has quit [Remote host closed the connection]
Musashi007 has quit [Quit: Musashi007]
crdpink has quit [Quit: q term]
Morkel has quit [Quit: Morkel]
tunaCanBruh has quit [Ping timeout: 264 seconds]
ramfjord has joined #ruby
chipotle has quit [Quit: cheerio]
anaeem1 has quit [Remote host closed the connection]
sinkensabe has joined #ruby
anaeem1 has joined #ruby
replay has quit [Ping timeout: 246 seconds]
momomomomo_ has joined #ruby
ldnunes has quit [Quit: Leaving]
momomomomo has quit [Ping timeout: 250 seconds]
momomomomo_ is now known as momomomomo
Hijiri has quit [Quit: WeeChat 1.0.1]
soulcake has joined #ruby
rocknrollmarc has quit [Ping timeout: 256 seconds]
sinkensabe has quit [Remote host closed the connection]
<zhan_>
this modifier-class variable isn't syntax correct right? @@training_time = x * .6666
<zhan_>
so that i could create instances of the class with different training times?
anaeem1 has quit [Ping timeout: 264 seconds]
<zhan_>
wtv i'll just experiment as im suppose to
<havenn>
zhan_: Float literals cannot start with a `.`.
havenn is now known as havenwood
crdpink has joined #ruby
<jhass>
>> .2
<eval-in_>
jhass => /tmp/execpad-b8c2207ef8bc/source-b8c2207ef8bc:2: no .<digit> floating literal anymore; put 0 before dot ... (https://eval.in/296483)
<zhan_>
k
<zhan_>
0.6666?
<jhass>
oh, "anymore", when did it change?
mjuszczak has joined #ruby
g0bl1n has quit [Quit: g0bl1n]
mary5030 has joined #ruby
tkuchiki has joined #ruby
yfeldblum has quit [Remote host closed the connection]
mjuszczak has quit [Client Quit]
swgillespie has joined #ruby
diego_ar has quit [Remote host closed the connection]
skj3gg has quit [Quit: ZZZzzz…]
ascarter has joined #ruby
ych4k3r has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kaiZen has joined #ruby
mary5030 has quit [Ping timeout: 256 seconds]
wallerdev has quit [Quit: wallerdev]
last_staff has quit [Quit: last_staff]
tkuchiki has quit [Ping timeout: 255 seconds]
mjuszczak has joined #ruby
skj3gg has joined #ruby
soulcake has quit [Quit: Quack.]
diegoviola has quit [Quit: WeeChat 1.1.1]
mkaesz has quit [Remote host closed the connection]
Musashi007 has joined #ruby
soulcake has joined #ruby
mkaesz has joined #ruby
cphrmky has joined #ruby
fryguy9 has quit [Quit: Leaving.]
morenoh149 has joined #ruby
elaptics_away is now known as elaptics
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Sembei has quit [Ping timeout: 244 seconds]
scripore has quit [Quit: This computer has gone to sleep]
baweaver has joined #ruby
hobodave has quit [Quit: Computer has gone to sleep.]
JoshGlzBrk has joined #ruby
JoshGlzBrk has quit [Remote host closed the connection]
mkaesz has quit [Ping timeout: 244 seconds]
pontiki has quit [Read error: Connection reset by peer]
<Senjai>
If you want a private mentor, you should throw some $, if not you should ask your questions in the channel so others can benefit from the answers
<zhan_>
k
agarie has quit []
<zhan_>
sec
enterprisedc has quit [Ping timeout: 245 seconds]
blackmesa has joined #ruby
roshanavand has joined #ruby
<havenwood>
jhass: Yeah, the "anymore" seems like what you'd want just one version later for those confused. Now that it's more than a decade later... it's more confusing than helpful.
tvon has joined #ruby
crdpink has quit [Quit: q term]
<graft>
who writes .6 anyway?
<zhan_>
actually more of a global thing, should I create an array with modifiers for all of the skills and then create a class that can look at specific parts of array, or should i create a head class for skill, and create sub class for each skill
<helpa>
zhan_: If you don't provide any code, it becomes really difficult for us to help you. Providing code to reproduce the problem increases your chances of getting great, accurate help immensely.
crdpink has joined #ruby
<zhan_>
i don't know how to code in 2nd place
FooMunki_ has quit [Quit: FooMunki_]
<zhan_>
like more specifically, i suppose that if i use an array I'll be writing code that writes code?
piotrj has quit [Remote host closed the connection]
<baweaver>
zhan_: ^
skj3gg has joined #ruby
piotrj has joined #ruby
Asher has quit [Quit: Leaving.]
<baweaver>
Chalk it up to stupid naming conventions from Netscape and them wanting a java-like scripting language that's really more of a scheme derivative. That's a different matter though.
riotjon__ has joined #ruby
<zhan_>
fuck you
<baweaver>
Well there's another one for the mute list
<baweaver>
bye
RegulationD has quit [Remote host closed the connection]
<zhan_>
true programmer
tkuchiki has joined #ruby
<zhan_>
whose up for more algebra?
<baweaver>
Some people I suppose.
<baweaver>
After being around Javascript, Ruby, and Haskell for a while I like my anonymous functions.
<baweaver>
Granted Java 8 gives it a mild reprieve, but still...
riotjone_ has quit [Ping timeout: 246 seconds]
<zhan_>
2nd item has .6666 relation to 1st, and 3rd has relation .3333 to 1st, 16 item has .06249 to 1st, whats the incremental modifier?
bMalum has joined #ruby
piotrj has quit [Ping timeout: 252 seconds]
skj3gg has quit [Ping timeout: 252 seconds]
<zhan_>
or rather 3rd item has relation .6666 to 2nd
<zhan_>
sry
<zhan_>
w8 scrap that
HOrangeJewce has quit [Quit: Leaving.]
<baweaver>
Go I can't say I ever really understood the magic of. I should probably play with it a bit more before getting an opinion on it.
<baweaver>
Any Go lovers have compelling reasons?
tkuchiki has quit [Ping timeout: 256 seconds]
RegulationD has joined #ruby
<zhan_>
w8
<zhan_>
don't go exploring with the thought just yet
tkuchiki has joined #ruby
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
chishiki has quit [Quit: WeeChat 1.1.1]
brb3 has quit [Quit: ZZZzzz…]
chishiki has joined #ruby
<baweaver>
More tempted to play with Erlang / Elixir myself.
<zhan_>
baweaver: 1st items relation to 2nd is .5, and 2nd items relation to 3 is .6666, and at those increments 16 items relation to 1st is 0.06249
<zhan_>
how do i work this
<zhan_>
increment modifier?
tobago has quit [Read error: Connection reset by peer]
nettoweb has joined #ruby
mitchellhenke has joined #ruby
tkuchiki has quit [Ping timeout: 256 seconds]
Guest30239 has quit [Read error: Connection reset by peer]
bruno- has joined #ruby
ascarter has joined #ruby
bruno- is now known as Guest38722
skj3gg has joined #ruby
skj3gg has quit [Client Quit]
mitchellhenke has quit [Client Quit]
<zhan_>
baweever: ?
bigmac_ has joined #ruby
bigmac_ has quit [Read error: No route to host]
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
he put you on ignore
SolarSailor has quit [Quit: My Turing machine has gone to sleep. ZZZzzz…]
bigmac has quit [Ping timeout: 250 seconds]
<zhan_>
he responded to me though
mitchellhenke has joined #ruby
<zhan_>
joked when i said fuck you about his cheekiness
jottr has joined #ruby
<zhan_>
or whoever wrote program claing java as false to my question
<zhan_>
*claiming
elfuego has quit [Quit: elfuego]
<zhan_>
or the way that mute works is that i can't "reply" to him by "bawearver:"
Asher has joined #ruby
thiagovsk has quit [Quit: Connection closed for inactivity]
<zhan_>
how do i create an index with sets of variables"?
g0bl1n has joined #ruby
rbennacer has quit [Remote host closed the connection]
mitchellhenke has quit [Client Quit]
<android6011>
when i use force_encoding('us-ascii') on a string and then when going character by character and get "invalid byte sequence in US-ASCII" when doing .ord what is happening? how can i tell what value is stored in memory?
<jhass>
android6011: use "US-ASCII-8bit" or it's (properly named) alias "binary"
maletor has joined #ruby
<baweaver>
jhass: referring to that person from earlier?
<eam>
android6011: in terms of "what is happening," with unicode characters are no longer equal to bytes
it0a has quit [Ping timeout: 252 seconds]
<android6011>
jhass: this is existing code. there is the force_encoding('us-ascii') and then data[idx..idx+3].unpack('V*')[0], so I am trying to see what is stored at each of those indexes
<jhass>
baweaver: yeah
<baweaver>
I tend to do that to people that are unnecessarily rude.
agent_white has quit [Quit: bbl]
<zhan_>
baweaver have you actually muted me?
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
android6011: yeah, doesn't look correct
<eam>
android6011: so, if you have a multi-byte sequence it will show up as one "character" using a character index
mitchellhenke has joined #ruby
doodlehaus has quit [Remote host closed the connection]
<eam>
but if the multi-byte sequence is impossible then it'll produce an error
<jhass>
android6011: unpack just doesn't care about encoding, opposed to .ord
<android6011>
jhass: so how can i tell what value unpack is seeing?
<jhass>
android6011: I already said?
g0bl1n has quit [Quit: g0bl1n]
<android6011>
so itll use the ascii 8 bit value?
<jhass>
mmh, depends on what V does, I don't have it in mind
beneggett has joined #ruby
<jhass>
why don't you actually just look at the value that statement returns?
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<eam>
impossible to index to a character position if the byte sequence is invalid
<eam>
data.b[idx..idx+3].unpack('V*')[0] oughta be fine though
mikeric has quit []
<jhass>
eam: nah, they said they get that when doing .ord "to look at the value"
<eam>
jhass: data[index].ord?
<jhass>
wasn't that specific
<eam>
that's my suspicion
<android6011>
data = "HELLO"; data = data.force_encoding('us-ascii'); result = data[idx..idx+3].unpack('V*')[0]; this works but im trying to understand what it is that is actually being unpacked from that.
rbennacer has quit [Remote host closed the connection]
<android6011>
the original value coming in is \xDC which is what is showing me the err
<jhass>
android6011: add p result
<eam>
>> idx = 1; data = "HELLO"; data = data.force_encoding('us-ascii'); result = data[idx..idx+3].unpack('V*')[0]
<android6011>
jhass: i can see the result, but in python im getting a different result so I am trying to see what values it is ruby is operating on during the unpack
<eam>
android6011: are you asking what unpack is doing?
<eam>
android6011: what result do you see, and what do you expect?
baweaver has quit [Remote host closed the connection]
<android6011>
they are very close which is what makes me think it is just that character being processed differently
<jhass>
apeiros_: I thought you'd hide in a corner on the .force_encoding("us-ascii" already :P
<apeiros_>
you folks are already trying to explain encoding to them. no need for me to weigh in.
krowv has joined #ruby
<apeiros_>
also I try to stay out of encoding discussions as it only makes me angry about people's ignorance.
<jhass>
apeiros_: yeah, you should contribute proper encoding support to Crystal instead :P
sevvie has quit [Ping timeout: 252 seconds]
<android6011>
ok so let me explain more so maybe its a little clearier what I'm looking for
mitchellhenke has quit [Quit: Computer has gone to sleep.]
<apeiros_>
jhass: AS multibyte stuff is actually quite good
<apeiros_>
I'd port that
<apeiros_>
"I'd" = "you should"
<bradland>
unpack template V is 32-bit unsigned, VAX (little-endian) byte order
<jhass>
mmh, I make a mental note
<bradland>
yowza
<bradland>
what the hell are you working on? lol
<jhass>
apeiros_: anything you'd port for Time/Date/Calendar?
St1gma has joined #ruby
<eam>
bradland: ip address?
jonr22 has joined #ruby
<apeiros_>
jhass: chronos
mikeric has joined #ruby
<jhass>
thought so :P
<apeiros_>
IMO still better than ruby's core stuff, even if unfinished.
<eam>
little endian is internet byte order, isn't it?
<android6011>
we have a ruby application that takes in data as utf8, converts to us ascii and does an unpack on 4 char substring sets of that whole data string. I have no control of the data coming in and ruby is providing the right result,
_djbkd has joined #ruby
sevvie has joined #ruby
<bradland>
eam: i thought internet was N
<apeiros_>
android6011: you are aware that us-ascii is only 7bit, right?
<eam>
nope, ignore that I got it backwards, htons() is big endian
_honning_ has joined #ruby
<apeiros_>
(why did I just do that?)
<bradland>
v: 32-bit unsigned, network (big-endian) byte order
<eam>
bradland: you're right
<android6011>
but we have another internal application in python that also needs to process the data. when i do a char comparison to see why the result are different \xDC in python is showing me 65533 and ruby just errors when i try to see the val at that position
<bradland>
yeez, i screwed that one up
<bradland>
N: 32-bit unsigned, network (big-endian) byte order
<jhass>
apeiros_: because I wasn't sure if it actually consumes 7bit per character or 8bit and thus didn't say so :P
<apeiros_>
jhass: it consumes 8bit
<android6011>
apeiros_: yes, i didnt make the original code base, just inherited it and thats how its written
<bradland>
android6011: you're mixing a looooot of stuff here
<android6011>
i know :/
<apeiros_>
jhass: but no processing method will work with anything beyond 0x79
<eam>
android6011: you're dealing in sets of 4 bytes, so what's a concrete example of all 4 bytes returning different values?
<bradland>
when dealing with strings, the binary data and character display are co-dependent.
<eam>
can you give an example string?
<apeiros_>
jhass: and your "use binary" was spot on. I don't get why they still insist on us-ascii instead of binary.
<jhass>
yeah...
_djbkd has quit [Remote host closed the connection]
juanpablo_ has quit [Quit: (null)]
<bradland>
your method of inspection maters
<bradland>
as these guys are suggesting, you should keep your string type as "binary", and rely only on the output of unpack
juanpablo_ has joined #ruby
<jhass>
apeiros_: though I don't see why it would make a diff for the actual unpack code they showed
<bradland>
using things like String#ord are only going to confuse you
<apeiros_>
jhass: not for the unpack
<apeiros_>
but for the ord
<android6011>
apeiros_: binary produces the wrong result and breaks the unpack for the expected result
<bradland>
you're not working with characters, you're working iwth binary data
<apeiros_>
android6011: ^ tell me how binary changes the result
krowv has left #ruby ["Leaving"]
<apeiros_>
I repeat: your analysis is wrong. but please, insist on it. but then: why ask for help if you don't accept it?
_djbkd has joined #ruby
laputa has joined #ruby
_djbkd has quit [Remote host closed the connection]
ghostpl__ has quit [Remote host closed the connection]
<android6011>
im sorry, i understand what you're saying
mjuszczak has joined #ruby
sarkis has quit [Ping timeout: 250 seconds]
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<android6011>
what i mean is in the code set when i just change the line data = force_encoding('us-ascii') to data = force_encoding('binary') i end up with a different result later on with the unpack. there could be something else in the middle it affects though?
devdazed has quit [Quit: Computer has gone to sleep.]
mjuszczak has quit [Client Quit]
<apeiros_>
android6011: I can't tell without seeing real code.
lkba_ has joined #ruby
<android6011>
ill have to hop back on tomorrow with it,
vdamewood has joined #ruby
<bradland>
android6011: the unpack method will return an array
<bradland>
so if you want to see what's "really" being unpacked, inspect the results of the unpack call
<android6011>
bradland: right, and because its taking 4 bytes when its parsed with V* it only returns one num
bMalum has quit [Quit: bMalum]
zachrab has joined #ruby
replay has joined #ruby
juanpablo_ has quit [Quit: (null)]
mjuszczak has joined #ruby
<bradland>
V* slurps all bytes
<bradland>
the reason it's only returning one number is because you're referencing the index at 0
juanpablo_ has joined #ruby
beneggett has joined #ruby
<bradland>
data[idx..idx+3].unpack('V*')[0];
it_tard has quit [Quit: yawn]
davedev2_ has joined #ruby
<android6011>
bradland: how could i tell how unpack is treating the 3rd byte when I do unpack('V')
x1337807x has joined #ruby
<bradland>
unpack('V') and unpack('V*') are different
sarkis has joined #ruby
<bradland>
i think you need to revisit how unpack works
mary5030 has joined #ruby
<bradland>
the "template" passed to unpack tells the method how you want the data treated
davedev24_ has quit [Ping timeout: 246 seconds]
<apeiros_>
bradland: not for 4 bytes, though
lkba has quit [Ping timeout: 250 seconds]
<bradland>
.....
juanpablo_ has quit [Read error: Connection reset by peer]
jenrzzz_ has joined #ruby
beneggett has quit [Client Quit]
<apeiros_>
and data[idx..idx+3] ensures it's 4 bytes
<android6011>
bradland: is the difference that the first will only return the first 32uintle and the 2nd will return an array with all found in 4 byte chnks?
juanpablo_ has joined #ruby
Rollabunna has quit [Quit: Leaving...]
<apeiros_>
the * is just pointless decoration with that
<apeiros_>
android6011: no, it returns an array always
<android6011>
i agree, again, didn't write the code
<bradland>
i would nail this down to some basic tests
<android6011>
\xDC is the byte causing issues right now
jenrzzz has quit [Ping timeout: 240 seconds]
<bradland>
and what happens when \xDC is encountered?
<bradland>
(using unpack)
<apeiros_>
android6011: gist code and input
_djbkd has joined #ruby
<bradland>
you get a number you don't expect
<bradland>
?
<apeiros_>
and expected output and actual output
buub has quit [Ping timeout: 250 seconds]
<apeiros_>
you can gist the input by using `p data`
<apeiros_>
don't forget `p idx`
FooMunki has joined #ruby
<android6011>
no i do, the ruby stuff all works fine, what im trying to understand is what it becomes after force_encoding('us-ascii') has been run with it in the 4 byte string
<bradland>
force_encoding doesn't change the binary data
<bradland>
full stop
<android6011>
ok
<jhass>
you could even drop it when using .unpack
<android6011>
so its not truly all ascii then
<bradland>
ascii is a means of interpreting numbers
* apeiros_
sobs silently
<bradland>
that is all
juanpablo_ has quit [Ping timeout: 244 seconds]
<bradland>
there is no ascii on disk
<jhass>
whatever it is, unpack doesn't care
davedev2_ has quit [Read error: Connection reset by peer]
<apeiros_>
android6011: what does an encoding do?
<bradland>
or in memory
<bradland>
or in the CPU
<bradland>
only numbers
jenrzzz has joined #ruby
<bradland>
ascii says, "treat these numbers as these characters"
<android6011>
ok i get that, so i think whats happening then is with python, when i try to read it as ascii its showing me 65533 as the ascii val
davedev24_ has joined #ruby
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hobodave has quit [Quit: Computer has gone to sleep.]
jaequery has joined #ruby
<jhass>
"ascii val"
maknz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
please explain what that is
Azure has quit [Excess Flood]
<android6011>
like you guys said, force encoding doesnt change the data so if thats truly still the value and doesnt "default" to something when its invalid then i think i understand whats happening
jenrzzz_ has quit [Ping timeout: 265 seconds]
Azure has joined #ruby
<android6011>
jhass: all i had is some js in front of me but with the \xDC in JS when I do .charAt(2) i get back 65533
<android6011>
(sorry i know this conversatation is coming across as a mess)
centrx has quit [Remote host closed the connection]
<jhass>
apeiros_: maybe we should ask Radar to turn the automatic pastebin.com message here too?
<Senjai>
!rule4
<helpa>
Do not use any service that is not Pastie or Gist to post code. Pastebin, for example has a tiny font and it has ads on it which cause the page to load slowly. Other paste services generally look like crap.
<apeiros_>
Radar: ping
<Radar>
apeiros_: hi
maximski has joined #ruby
<apeiros_>
o/
<Radar>
patches welcome :)
<bradland>
android6011: man, i hate javascript
<apeiros_>
00:24 jhass: apeiros_: maybe we should ask Radar to turn the automatic pastebin.com message here too?
<apeiros_>
^
<apeiros_>
can you? :)
<android6011>
bradland: ya not the best of all the langs
<bradland>
V* gives you an array of groups of 4 bytes, and C* gives you arrays of standard 8-bit integers
Musashi007 has joined #ruby
<Radar>
Senjai: you'll need to replace the part of the message beneath that as well
<jhass>
Senjai: almost, actual message needs to interpolate channel
<Radar>
Senjai: railsbot is all YOLO code
<Radar>
testing in production ftw
<apeiros_>
Radar: done.
<apeiros_>
didn't even have to clone to desktop :D
ta has joined #ruby
Sembei has joined #ruby
bricker has joined #ruby
<Senjai>
apeiros_: beat me to it
<Radar>
apeiros_: that doesn't interpolate the message either
<Senjai>
TROLOLOLOL
<Radar>
Line 296
<Senjai>
Im going to let apeiros_ take this one
<Senjai>
This is the fastest review-release cycle ever
<apeiros_>
Radar: bah, minor
<android6011>
bradland: thats interesting, i think that may help me
<apeiros_>
Radar: how do I update a PR?
<apeiros_>
just redo?
<Senjai>
apeiros_: Edit it on your branch
<Radar>
apeiros_: Yeah you can redo
<Radar>
Or ^
<apeiros_>
also L299
maximski has quit []
<android6011>
i have to head out, if i cant get things sorted ill be back tomorrow more prepared. honestly i didnt expect so many people to jump in to help so thanks everyone
<bradland>
you bet
piotrj has quit [Ping timeout: 246 seconds]
<Senjai>
Radar: How can we cleanup/add tips?
roshanavand has quit [Remote host closed the connection]
paradisaeidae has quit [Ping timeout: 256 seconds]
<apeiros_>
done
<Radar>
Senjai: ! add <tip name> <text>
<Radar>
Senjai: Cleaning up is done by me atm
<apeiros_>
(and no, didn't run tests - does it have some?)
<Senjai>
cheers
<Senjai>
apeiros_: HAHA, Didnt run tests, btw, is there tests? xD
<Senjai>
<3
<Radar>
apeiros_: [10:28:12] <Radar>testing in production ftw
commmmodo has joined #ruby
helpa has quit [Remote host closed the connection]
<helpa>
Hi jhass. We in #ruby would really appreciate it if you did not use pastebin during your time with us.
<helpa>
Pastebin is not good because it loads slowly for most, has ads which are distracting and has terrible formatting. Please use Gist (http://gist.github.com) or Pastie (http://pastie.org) instead. Thanks!
<jhass>
\o/
<Radar>
\o/
<jhass>
great job everyone!
<Radar>
Thanks :)
chipotle has joined #ruby
<apeiros_>
thx radar! much appreciated :)
<Senjai>
#teamwork
<Senjai>
#community
<Senjai>
#togetheranythingispossible
nicolastarzia has joined #ruby
CorySimmons has joined #ruby
chipotle has quit [Max SendQ exceeded]
maximski has joined #ruby
enebo has quit [Quit: enebo]
maximski has quit [Max SendQ exceeded]
benlieb has joined #ruby
android6011 has quit [Ping timeout: 246 seconds]
<bradland>
can someone remind me of how to use String#pack("B*") ?
jlast has quit [Remote host closed the connection]