<Spaceghostc2c>
elico1: I don't understand what you're saying.
XedMada has joined #ruby
<Spaceghostc2c>
A database being built to be used in a relational database management system?
lggr has quit [Ping timeout: 264 seconds]
IrishGringo has quit [Ping timeout: 246 seconds]
rubious has joined #ruby
ffranz2 has joined #ruby
havenn has joined #ruby
<mensvaga>
n_blownapart: read the documentation about String, and see if << is the same as +
<mensvaga>
As far as the other stuff is concerned, I have no idea.
lggr has joined #ruby
eignerch_ has quit [Remote host closed the connection]
<Elico1>
Spaceghostc2c: a db structure that was meant to be used as relational..
xyzodiac has quit [Quit: Computer has gone to sleep.]
<mensvaga>
n_blownapart: << and + are concatination for strings.
<Elico1>
Spaceghostc2c: it seems like active record mysql is lacks some of the basic things
<n_blownapart>
mensvaga: thanks, I know they're different from eachother, but not sure about side effects since the output is the same..
<mensvaga>
They have different method documentation entries, but they appear to do the same thing, except one is called "append" and may call integer.to_s() or something.
<Elico1>
mensvaga: << is not == + << is enumaration thing
<mensvaga>
Try doing string + integer
<mensvaga>
and then string << integer.
_adeponte has quit [Remote host closed the connection]
<mensvaga>
It's correct, but it's written in formal boolean algebra.
<mensvaga>
Expressed in code, De Morgan's laws are:
<banisterfiend>
mensvaga womensvaga
<Elico1>
if you will take build a new class you will see that "<<" will not work without enumaration
<n_blownapart>
elico1: yeah but my book prefers + because of apparentside effects that I cannot determine, in this prog: http://pastie.org/4794256
<mensvaga>
0 = 0; 1 = 1; !1 = 0; !0 = 1; 1 && 1 = 1; 1 && 0 = 0; 0 && 0 = 0; 0 || 0 = 0; 0 || 1 = 1; 1 || 1 = 1; , and so on and so forth.
<Elico1>
Spaceghostc2c: if it's a good way to implement it then it's good
fyolnish has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 244 seconds]
<Spaceghostc2c>
elico1: No. Never.
<Spaceghostc2c>
It's just a poor design that works.
<mensvaga>
banisterfiend: it's latin for "the mind wanders" or "the wandering mind". I don't mind that it has something close to lady parts in the name :)
<mensvaga>
that and 'a' causes 'g' to not be pronounced as 'j'.
<Spaceghostc2c>
High coupling, no cohesion, it's just one monolithic mess.
<mensvaga>
If it were vagi or vage, then yes.
<mensvaga>
vagA, nope.
lggr has joined #ruby
<Elico1>
n_blownapart: it's pretty simple..
notVert has quit [Read error: Connection reset by peer]
<Spaceghostc2c>
elico1: I've worked on enough projects to be able to say with complete confidence that building your app that tightly coupled to your framework and your persistence layer is a Bad Thing™ although it may not reveal itself as such for a while.
sfim has quit [Read error: Connection reset by peer]
ryanf has quit [Ping timeout: 268 seconds]
A1241 has joined #ruby
sfim has joined #ruby
<Elico1>
n_blownapart: e.each { |string, war| string << "#{war}..." } creates\chaning the string in e...
A1241 has quit [Quit: Leaving.]
A124 has joined #ruby
<mensvaga>
You know how there are JSON libraries that take a data structure and output JSON?
<mensvaga>
How do I take a data structure and output it to something that ERB would use if I were defining variables inside of it?
rabidpraxis has joined #ruby
xyzodiac has joined #ruby
<mensvaga>
I could make an ERB template for it, but that would just be silly.
<n_blownapart>
elico1 but + is preferred because << produces side effects that I still don't see.
<Spaceghostc2c>
n_blownapart: What do you mean?
<Spaceghostc2c>
n_blownapart: It just appends to the current object without returning a new one. It modifies in place.
<Spaceghostc2c>
Returning the same object.
yshh_ has quit [Remote host closed the connection]
<Elico1>
well you can see it if you will write the right ode...
GraemeLion has joined #ruby
<n_blownapart>
Spaceghostc2c: thanks . the book says one must be careful using << over + because of side effects. elico1 what there's an error? http://pastie.org/4794256
<Spaceghostc2c>
n_blownapart: n = "My awesome"; puts n;puts n << " String"
asdfhoqwergfiqwe has joined #ruby
<Spaceghostc2c>
n_blownapart: + will mean that you're creating multiple objects, which isn't bad, but when you don't need them, just concat.
aantix has quit [Ping timeout: 252 seconds]
<Elico1>
i will give you an example: e.each { |string, war| puts string ; p string.object_id; }
<n_blownapart>
havenn: elico1 Spaceghostc2c thanks all ! will study all of this...
<Spaceghostc2c>
n_blownapart: Anytime, friend.
<n_blownapart>
Spaceghostc2c: pax
<Spaceghostc2c>
n_blownapart: Pax?
<n_blownapart>
Spaceghostc2c: yeah latin for peace , my signiture
<Elico1>
n_blownapart: you will get a big that you can see in that: e.each { |string, war| string << "#{war}..."; p string.object_id; }
<Spaceghostc2c>
n_blownapart: Oh, cool.
<n_blownapart>
signature*
<n_blownapart>
elico1: cool thanks
<Elico1>
Spaceghostc2c: about the rdbms maybe it stinks for someone who understands but I will not fight for this DB if they built and used it that way so be it.
<Spaceghostc2c>
elico1: I don't think that building an app in that way is a very good thing to do.
<Spaceghostc2c>
So if you do it, good luck, may God have mercy on your soul.
<mensvaga>
That's how you can tell that Ruby is a young language.
<mensvaga>
"God have mercy on your soul"
<Spaceghostc2c>
mensvaga: Python is young in the same way.
swarley_ has quit [Ping timeout: 248 seconds]
lggr has joined #ruby
ttt has joined #ruby
<mensvaga>
As opposed to, "There might not be a God, but I know you'll be miserable."
<Spaceghostc2c>
But hey it was started in 1995 as the first release.
<Spaceghostc2c>
It was conceived in 1993 though.
<mensvaga>
I kid of course, Here I am implying that some amount of Atheism should at least be apparent in a more mature programming language.
<Spaceghostc2c>
mensvaga: There are old esoteric languages that really likely depend on the whim of the Gods.
mattyoho has joined #ruby
<Spaceghostc2c>
Sometimes I even feel bad for sticking my code inside a rails project directory unless it's specific to the framework. DAO objects go into the file structure, but my models are completely standalone.
<havenn>
mensvaga: Oh you mistake our meaning, we realize God is dead and purely wish his mercy in a postmodernist sense.
<mensvaga>
there you go
<Spaceghostc2c>
My DAO objects expose interfaces that are relevant to the domain, so I just replicate the API and implement the database portion again and my domain objects chug along happily.
<wmoxam>
God isn't dead. I saw he tweeting last week
<wmoxam>
*him
jimeh has quit [Ping timeout: 265 seconds]
yakitori has joined #ruby
ttt has quit [Ping timeout: 260 seconds]
lggr has quit [Ping timeout: 264 seconds]
iori has joined #ruby
kiyoura has joined #ruby
yshh has joined #ruby
yshh has quit [Remote host closed the connection]
yshh has joined #ruby
dmiller has quit [Remote host closed the connection]
kiyoura has quit [Read error: Connection reset by peer]
gabrielrotbart has joined #ruby
dustinleer has joined #ruby
yasushi__ has joined #ruby
linguini has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
ph^ has joined #ruby
lggr has joined #ruby
savage- has quit [Remote host closed the connection]
katherinem13 has joined #ruby
AlbireoX has quit [Remote host closed the connection]
<havenn>
It seems absolutely insane to use enumerable and inject like that >.>
Chryson has joined #ruby
ph^ has joined #ruby
<n_blownapart>
havenn: its a book example
cbuxton1 has quit [Quit: Leaving.]
bricker has quit [Quit: Lost terminal]
<havenn>
n_blownapart: In context maybe I'd think otherwise. =P
<n_blownapart>
havenn: please elaborate
<n_blownapart>
havenn: I'm checking out your second example thanks
xnm has quit [Ping timeout: 246 seconds]
GoGoGarrett has joined #ruby
talsamon has quit [Read error: Operation timed out]
talsamon has joined #ruby
Emmanuel_Chanel_ is now known as Emmanuel_Chanel
<havenn>
sfim: You may be looking for Splat: method_calling_an_array(*the_array)
lggr has quit [Ping timeout: 240 seconds]
<havenn>
sfim: e.g.: people = ["Rudy", "Sarah", "Thomas"]; say "Howdy!", *people
havenn has quit [Remote host closed the connection]
pingfloyd has joined #ruby
pingfloyd has quit [Client Quit]
awarner has joined #ruby
pingfloyd has joined #ruby
<n_blownapart>
havenn: that is cool I amended the lines puts string.object_id; puts war.object_id -- got 4 which is nil before each war.object_id. thanks very instructive !
lggr has joined #ruby
seanstickle has joined #ruby
havenn has joined #ruby
Jellyg00se has joined #ruby
chendo_ has quit [Ping timeout: 256 seconds]
ph^ has quit [Ping timeout: 245 seconds]
<havenn>
Oops, didn't actually run the second gist... just realized nil was printing blank lines, so changed it to nil.inpect...
chendo_ has joined #ruby
Tearan has joined #ruby
jarred has quit [Quit: jarred]
<n_blownapart>
havenn: one sec sorting it out
ttt has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
gmci_ has quit [Quit: Computer has gone to sleep.]
jso has quit []
dpk has joined #ruby
bthesorceror has joined #ruby
bthesorceror_ has joined #ruby
bthesorceror has quit [Read error: Connection reset by peer]
bthesorceror_ is now known as bthesorceror
ttt has quit [Ping timeout: 240 seconds]
<n_blownapart>
havenn: yeah so it returns nil and 4 after string id and each war id thanks very much interesting!
jasonkuhrt has joined #ruby
nari has joined #ruby
lggr has joined #ruby
bthesorceror has left #ruby [#ruby]
CannedCorn has joined #ruby
<CannedCorn>
hey guys
<CannedCorn>
do you ever use require 'bundler/setu[
<CannedCorn>
require 'bunlder/setup'
<CannedCorn>
when i use that it test:unit complains to no end about bundler
mk03_ has quit [Remote host closed the connection]
<CannedCorn>
gems/bundler-1.2.1/lib/bundler/source.rb:516: warning: method redefined; discarding old revision
ttt has joined #ruby
AlbireoX has joined #ruby
<CannedCorn>
anyone have ideas?
n_blownapart has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 264 seconds]
pipopopo has quit [Ping timeout: 268 seconds]
Ruler_Of_Heaven_ has joined #ruby
GraemeLion has quit [Quit: out]
<Spaceghostc2c>
I have no ideas. I merely regurgitate the misinformation that was thrust upon me from childhood continually in an effort to find peace in a reality I don't understand due to the impenetrable shrouds of self-doubt and misguided desire to be 'normal'. This is the world today.
wimplash has joined #ruby
<bnagy>
You know who had ideas? Hitler.
seoaqua has joined #ruby
<rking>
Ideas are like… your opinion, mannn.
lggr has joined #ruby
alvaro_o has quit [Quit: Ex-Chat]
<CannedCorn>
awesome
<Spaceghostc2c>
Ideas? Where we're going we don't need ideas.
rakunHo has joined #ruby
chrishunt has joined #ruby
<bnagy>
We're starting a cloud business?
awarner has quit [Remote host closed the connection]
tommyvyo has quit [Quit: Computer has gone to sleep.]
dagnachewa has quit [Remote host closed the connection]
ph^ has joined #ruby
<mensvaga>
So, here's the result of me trying to convert a data structure as text input for a template:
<mensvaga>
at least, that's the output of it, given an input.
<mensvaga>
FML.
<mensvaga>
I just needed something that converts a data structure to text. Done wrote a shitty output generator for it.
lggr has quit [Ping timeout: 246 seconds]
c0rn_ has joined #ruby
<bnagy>
isn't that what pp does?
<mensvaga>
Nope.
<mensvaga>
Not "exactly"
lggr has joined #ruby
gmci has joined #ruby
<bnagy>
awesome_print?
<Spaceghostc2c>
bnagy: You're my favorite trollbruv.
cw has quit [Read error: Connection reset by peer]
<mensvaga>
Yeah. Awesome print.
<mensvaga>
I need to figure out what the hell the guy was thinking, and if the output of 'pp' would work, but I'm looking at his documents and I don't think it will.
<mensvaga>
Don't get me wrong, I hate this stupid bullshit.
TandemAdam has left #ruby ["Leaving"]
dpk has quit [Ping timeout: 246 seconds]
seoaqua has quit [Ping timeout: 252 seconds]
<bnagy>
couldn't you do that really insecurely in like 4 lines of code?
BrokenCog has joined #ruby
BrokenCog has quit [Changing host]
BrokenCog has joined #ruby
sent-hil has quit [Remote host closed the connection]
wimplash has quit [Quit: Leaving...]
BrokenCog has quit [Client Quit]
dpk has joined #ruby
<mensvaga>
More like 30, all in one class, using recursion.
<mensvaga>
Hell. I'll post the code. I don't care.
<Spooner>
The pony & mail gems are pretty simple too.
butblack has left #ruby [#ruby]
dagnachewa has joined #ruby
<RubyPanther>
Everybody wants a pony
djbpython has joined #ruby
sent-hil has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
chendo_ has quit [Ping timeout: 252 seconds]
chendo_ has joined #ruby
chendo_ has quit [Changing host]
chendo_ has joined #ruby
lggr has joined #ruby
seoaqua has joined #ruby
Spooner has quit [Ping timeout: 245 seconds]
chimkan_ has joined #ruby
forced_request has quit [Read error: Connection reset by peer]
chimkan_ has quit [Client Quit]
lggr has quit [Ping timeout: 265 seconds]
ttt_ has joined #ruby
ph^ has joined #ruby
cibs has quit [Read error: Connection reset by peer]
cibs has joined #ruby
havenn has quit [Remote host closed the connection]
ananthakumaran has joined #ruby
robertotauille has joined #ruby
ttt has quit [Ping timeout: 260 seconds]
gabrielrotbart has quit [Read error: Connection reset by peer]
lggr has joined #ruby
h4mz1d has quit [Ping timeout: 264 seconds]
gabrielrotbart has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
iamjarvo has quit [Ping timeout: 256 seconds]
AndChat- has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
libryder has joined #ruby
justinmcp has quit [Remote host closed the connection]
sent-hil has quit [Remote host closed the connection]
Cache_Money has quit [Ping timeout: 265 seconds]
Banistergalaxy has quit [Ping timeout: 246 seconds]
slicslak has joined #ruby
Banistergalaxy has joined #ruby
ph^ has quit [Ping timeout: 264 seconds]
AndChat- has quit [Ping timeout: 244 seconds]
quest88 has joined #ruby
AlbireoX has quit [Remote host closed the connection]
lggr has joined #ruby
pskosinski has quit [Ping timeout: 276 seconds]
AndChat- has joined #ruby
Banistergalaxy has quit [Ping timeout: 244 seconds]
GoHuyGo has joined #ruby
slicslak has quit [Ping timeout: 256 seconds]
AndChat- has quit [Ping timeout: 244 seconds]
Banistergalaxy has joined #ruby
gmci has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 252 seconds]
seoaqua has quit [Ping timeout: 256 seconds]
JohnBat26 has joined #ruby
n_blownapart has joined #ruby
lggr has joined #ruby
djbpython has quit [Ping timeout: 246 seconds]
n_blownapart has quit [Read error: No route to host]
jasonkuhrt has joined #ruby
rippa has joined #ruby
robertotauille has quit [Quit: Leaving...]
dagnachewa has quit [Quit: Leaving]
lggr has quit [Ping timeout: 246 seconds]
joeycarmello has quit [Remote host closed the connection]
chrxn has quit [Remote host closed the connection]
lggr has joined #ruby
hsbt is now known as hsbt_away
jasonkuhrt has quit [Ping timeout: 264 seconds]
artOfWar has quit [Read error: Connection reset by peer]
artOfWar has joined #ruby
rabidpraxis has quit [Remote host closed the connection]
seoaqua has joined #ruby
hsbt_away is now known as hsbt
n_blownapart has joined #ruby
artOfWar has quit [Remote host closed the connection]
ph^ has joined #ruby
n_blownapart has quit [Remote host closed the connection]
bananagram has quit [Ping timeout: 268 seconds]
CannedCorn has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 252 seconds]
reset has quit [Ping timeout: 272 seconds]
dhruvasagar has joined #ruby
riley526 has quit [Remote host closed the connection]
justinmcp has joined #ruby
yasushi_ has quit [Ping timeout: 244 seconds]
ananthakumaran has quit [Ping timeout: 252 seconds]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
adkron is now known as adkron_afk
manuelitox_ has joined #ruby
lggr has joined #ruby
ananthakumaran has joined #ruby
ph^ has quit [Ping timeout: 264 seconds]
lggr has quit [Ping timeout: 246 seconds]
<emsilva>
matti: there? Remember your "Hash[*x].map { |k, v| [k.first, k.last, v.last] } }"? That can't be made to iterate over 4 entries instead of 2, right?
lggr has joined #ruby
mikepack has joined #ruby
chendo_ has quit [Ping timeout: 256 seconds]
adkron_afk has quit [Ping timeout: 256 seconds]
davidcelis has joined #ruby
xorgnak has quit [Ping timeout: 264 seconds]
lggr has quit [Ping timeout: 245 seconds]
adkron_afk has joined #ruby
chendo_ has joined #ruby
joeycarmello has joined #ruby
c0rn_ has joined #ruby
lggr has joined #ruby
discopig has joined #ruby
discopig has left #ruby [#ruby]
asdfhoqwergfiqwe is now known as _7894
seoaqua has quit [Ping timeout: 248 seconds]
manuelitox_ has quit [Ping timeout: 245 seconds]
joeycarmello has quit [Ping timeout: 265 seconds]
lggr has quit [Ping timeout: 244 seconds]
Guest64548 has joined #ruby
ph^ has joined #ruby
lggr has joined #ruby
ltsstar has joined #ruby
dhruvasagar has quit [Ping timeout: 265 seconds]
wpaulson has joined #ruby
wpaulson has quit [Client Quit]
ltsstar has quit [Quit: ltsstar]
joeycarmello has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
ananthakumaran has quit [Quit: Leaving.]
lggr has joined #ruby
ph^ has quit [Ping timeout: 264 seconds]
elico has joined #ruby
snearch_ has quit [Quit: Verlassend]
snearch has joined #ruby
wpaulson has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
slicslak has joined #ruby
jasonkuhrt has joined #ruby
manuelitox_ has joined #ruby
wuzzzzaah has joined #ruby
PragCypher has quit [Ping timeout: 246 seconds]
slicslak has quit [Ping timeout: 245 seconds]
hsbt is now known as hsbt_away
lggr has joined #ruby
mikepack has quit [Remote host closed the connection]
hsbt_away is now known as hsbt
jasonkuhrt has quit [Ping timeout: 264 seconds]
seoaqua has joined #ruby
ph^ has joined #ruby
joeycarmello has quit [Remote host closed the connection]
AlbireoX has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
mercwithamouth has quit [Ping timeout: 256 seconds]
Guest64548 has quit [Quit: Guest64548]
Rydefalk_ has quit []
mercwithamouth has joined #ruby
Rydefalk has joined #ruby
lggr has joined #ruby
PragCypher has joined #ruby
chendo_ has quit [Ping timeout: 265 seconds]
slicslak has joined #ruby
chendo_ has joined #ruby
Guest96423 has quit [Ping timeout: 264 seconds]
manuelitox_ has quit [Ping timeout: 244 seconds]
lggr has quit [Ping timeout: 256 seconds]
amskah has joined #ruby
lolmaus has joined #ruby
lggr has joined #ruby
havenn has joined #ruby
matrixise has quit [Ping timeout: 244 seconds]
sagax has joined #ruby
wwoodrum has joined #ruby
<wwoodrum>
lp
<wwoodrum>
Hi!!
<wwoodrum>
I need some help with ruby programming homework. Really basic stuff, can donate $5 to your paypal fun for help.
<bnagy>
wouldn't it be easier to do your own homework?
<bnagy>
anyway, usually people will 'help' with general stuff, for FREE even
<wwoodrum>
ive been doing it for 2 hours now and researched well over 50 sites, and the answer is not in my text book
lggr has quit [Ping timeout: 252 seconds]
<wwoodrum>
Well.. the homework is just upcasing a string, which is easy and i've done that.
<wwoodrum>
now if the string is over 3 characters I need to upcase the last 3 letters of the string. so superman ---> superMAN
rippa has quit [Ping timeout: 246 seconds]
adkron_afk has quit [Ping timeout: 256 seconds]
<wwoodrum>
so what ive got is IF string.length < 4 then string.upcase else ___________ end
uris has quit [Quit: leaving]
<wwoodrum>
any ideas?
<nightfalcon>
x[-3..-1].upcase
adkron_afk has joined #ruby
<nightfalcon>
x = string in your case
sent-hil has joined #ruby
lggr has joined #ruby
fantazo has quit [Remote host closed the connection]
<bnagy>
that will upcase all of a 3 char string though
<wwoodrum>
great ty so much
<wwoodrum>
will try
<m3pow>
but that will upcase just the last 3 Chars
<m3pow>
and he will get "MAN" if i'm not mistaking
<bnagy>
depends if "foo" is supposed to be "foo" or "FOO"
<Spaceghostc2c>
FoO
<bnagy>
yeah it also doesn't give you the whole string
<m3pow>
print x[0..4] + x[-3..-1].upcase
<m3pow>
in case of superman
<m3pow>
or puts
<wwoodrum>
ty m3 that worked but
<wwoodrum>
if i type superman
<wwoodrum>
i get supermanMAN
<m3pow>
x = "superman"
<nightfalcon>
you have to figure out
<m3pow>
puts x[0..4] + x[-3..-1].upcase
<nightfalcon>
how to remove the man part
<wwoodrum>
oh gotcha
<wwoodrum>
well its a input string
<wwoodrum>
so
<m3pow>
x[0..4] is the substring : "super"
<bnagy>
that's a really brittle approach though
<m3pow>
it is bnagy
banisterfiend has joined #ruby
<wwoodrum>
if i type jesus ill need to return jeSUS
<bnagy>
wwoodrum: what is the output you are supposed to get from "foo" ?
<wwoodrum>
but i get jesusSUS
<wwoodrum>
foo would just be FOO
<bnagy>
ok then it's easy
<wwoodrum>
anything over 4 characters needs last 3 to be caps
<bnagy>
s[-3..-1] is a way to refer to the last 3 chars
<wwoodrum>
lake --> lAKE
rakunHo has quit [Remote host closed the connection]
<wwoodrum>
s[-3..-1].upcase work?
<m3pow>
bnagy but it will only output the last 3 chars, not the whole string with the last 3 upcase'd
<m3pow>
only AKE in the lake case
<bnagy>
wwoodrum: almost
<bnagy>
you can actually assign to string ranges as well
<bnagy>
try s="foo"; s[0]='g'; p s
lggr has quit [Ping timeout: 256 seconds]
<bnagy>
it modifies the string in place
<wwoodrum>
can you use chop 3 times on a single string? then just use the "X"+"s[-3..-1].upcase"?
<wwoodrum>
because chope just takes out the last character yes?
<bnagy>
might work, but it's pretty gross
<bnagy>
did you try my inplace replacement above?
<havenn>
def cap_last_three string; string[0..-4] << string[-3..-1].upcase; end
<wwoodrum>
brb gonna try some of these. ty for all the help guys!
AlbireoX has quit [Read error: Connection reset by peer]
<havenn>
Spaceghostc2c: ?
AlbireoX has joined #ruby
justinmcp has quit [Remote host closed the connection]
bsmith_ has joined #ruby
lggr has quit [Ping timeout: 264 seconds]
bambanx has joined #ruby
<Spaceghostc2c>
havenn: I'm a ginger, I was thanking you for your kindness.
<havenn>
Spaceghostc2c: No, I meant are you single? (wwoodrum asks!) >.>
<bambanx>
guys i have a file and i wanna import some functions of the other file , how i can do it? using some like include?
<wwoodrum>
lol
<wwoodrum>
i used puts "upcased: #{word.chop.chop.chop}" + "#{word[-3..-1].upcase}"
mahmoudimus has joined #ruby
<wwoodrum>
and it works great
<wwoodrum>
thank you all so very much
xorgnak has joined #ruby
<RubyPanther>
It has to be ruby-red, and shaved like a Ruby or it doesn't count
<havenn>
RubyPanther: If only I was female and a ginger... that would be inspiring.
AlbireoX has quit [Ping timeout: 252 seconds]
PragCypher has quit [Read error: Connection reset by peer]
<havenn>
I guess I could dye my hair red and shave a ruby...
<bambanx>
i should use require for use external files?
PragCypher has joined #ruby
<RubyPanther>
Go for it, you'll be the talk the convention after-parties.
<RubyPanther>
bambanx: Usually
lggr has joined #ruby
Guest91820 is now known as hardcore
<bambanx>
i am on my current file and i wanna use some methods of the other file on the same directory RubyPanther how i can it pls?
<Spaceghostc2c>
havenn: Oh, yeah. Single.
hardcore has quit [Changing host]
hardcore has joined #ruby
<Spaceghostc2c>
RubyPanther: You're not a ginger, you can't make those decisions.
<Spaceghostc2c>
You're not part of the tribe.
<RubyPanther>
This may be news to you, Cartman, but hair color is not an ethnic group.
<Spaceghostc2c>
I think you're just jealous because you have no interesting cultural history. :(
<bambanx>
usgin this: require "motor" say cannot load file :/
frogprince has joined #ruby
wwoodrum has quit [Quit: irc2go]
<Spaceghostc2c>
bodik: It has to be in the ruby path.
<havenn>
bambanx: it isn't as common as require, but: require_relative
mirror1 is now known as bigmeow
<RubyPanther>
I'm a direct descendant of Oliver Cromwell, and Irish on the other side, surely that makes for interesting cultural history.
<bambanx>
what u mean havenn ?
jokar1 has quit [Quit: Leaving.]
<Spaceghostc2c>
RubyPanther: I couldn't be more bored. :p
jokar has joined #ruby
<havenn>
bambanx: Instead of 'require', use 'require_relative' (assuming Ruby 1.9+): require_relative 'file.rb'
<bnagy>
you don't need .rb for requires only loads
<RubyPanther>
One of my Irish-American ancestors was a cavalryman in the South, and he got some new orders... to drive his gf's people (she was Cherokee) off their land... so he stole his horse, deserted, and moved with her to NY.
<bambanx>
ty havenn
areil has joined #ruby
frogprince has quit [Ping timeout: 246 seconds]
quest88 has quit [Quit: quest88]
lggr has quit [Ping timeout: 244 seconds]
pauC has joined #ruby
ryanf has joined #ruby
h4mz1d has joined #ruby
lggr has joined #ruby
ryanf has quit [Client Quit]
<bambanx>
we have any good ocr gem?
maesbn has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
bradhe has quit [Remote host closed the connection]
lggr has joined #ruby
wereHams1er is now known as wereHamster
reset has joined #ruby
ryanlecompte has quit [Remote host closed the connection]
reset has quit [Read error: Connection reset by peer]
ananthakumaran has joined #ruby
reset has joined #ruby
wereHamster has quit [Changing host]
wereHamster has joined #ruby
frogprince has joined #ruby
aganov has joined #ruby
joeycarmello has joined #ruby
mvangala has joined #ruby
GoHuyGo has quit [Quit: Leaving]
Cache_Money has joined #ruby
mvangala_ has quit [Ping timeout: 256 seconds]
frogprince has quit [Ping timeout: 245 seconds]
budha has joined #ruby
arturaz has joined #ruby
joeycarmello has quit [Ping timeout: 265 seconds]
lggr has quit [Ping timeout: 244 seconds]
BrianJ has quit [Quit: Computer has gone to sleep.]
joshman_ has joined #ruby
lggr has joined #ruby
aces1up has quit [Remote host closed the connection]
banisterfiend has quit [Ping timeout: 250 seconds]
JohnBat26 has joined #ruby
bartj3 has joined #ruby
seoaqua has quit [Ping timeout: 245 seconds]
fboudrea1 has joined #ruby
jasonkuhrt has quit [Ping timeout: 246 seconds]
Cache_Money has quit [Ping timeout: 244 seconds]
Jck_true has joined #ruby
Chryson has quit [Quit: Leaving]
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ruby
A124 has joined #ruby
mbk has joined #ruby
elsifaka has joined #ruby
stepnem has joined #ruby
sylock has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
TommyBot1en is now known as Tommybotten
Tommybotten is now known as TommyBotten
<sylock>
hello guys. I don't really know ruby and need to install a web application (katello). I have some problems trying to resolve dependencies. Firstly I want to know how to remove the use of bundler ? I have some gems installed by system package and it didn't work. It tells me using bundle install . but it's now worse
ckrailo has quit [Quit: Computer has gone to sleep.]
<sylock>
so I'd like to revert and come back to the use of the sys gems and resolve then the problems
bradhe has joined #ruby
<Hanmac>
sylock: ask #bundler ...
<sylock>
ok ;)
ncamargo has joined #ruby
dhruvasagar has joined #ruby
lggr has joined #ruby
Bosox20051 has joined #ruby
seoaqua has joined #ruby
ncamargo is now known as BIGX333
canton7 has joined #ruby
bradhe has quit [Ping timeout: 252 seconds]
joshman_ has quit [Quit: Computer has gone to sleep.]
skogis has joined #ruby
bambanx has quit [Ping timeout: 246 seconds]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 240 seconds]
gabrielrotbart has quit [Remote host closed the connection]
lggr has joined #ruby
shiki has joined #ruby
h4mz1d has quit [Ping timeout: 246 seconds]
adkron_a1k has quit [Read error: Connection reset by peer]
pauC has joined #ruby
<Paradox>
there's a part of the earth's crust called
<Paradox>
the sandwich plate
adkron_afk has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
bodik has left #ruby [#ruby]
RichGuk has quit [Quit: WeeChat 0.3.7]
Elhu has joined #ruby
<Hanmac>
Paradox in a "correct" world, the Sandwich plate would be made of Sandwiches :(
<awestroke>
mehrdad: gem install rmagick, given you have the dependencies
<awestroke>
mehrdad: what operating system?
<sent-hil>
awestroke: is it gem conflict? it's saying no <name> found
berkes has joined #ruby
<mehrdad>
awestroke> ubuntu 12.04.1
<awestroke>
sent-hil: I pasted the wrong trace, see my updated version
BeLucid has quit [Remote host closed the connection]
<mehrdad>
awestroke: "Could not find gem 'rmagick (>= 2.0.0)' in any of the gem sources listed in your Gemfile."
<mehrdad>
awestroke: but i installed this.
<awestroke>
mehrdad: using rubygems?
<mehrdad>
awestroke: ya
pingfloyd has quit [Quit: pingfloyd]
Hamed-R has joined #ruby
Hamed-R has quit [Changing host]
Hamed-R has joined #ruby
lggr has joined #ruby
<awestroke>
mehrdad: change to only "gem 'rmagick'"
<mehrdad>
awestroke: i installed "rake" "rail"
<mehrdad>
awestroke: what!?
<awestroke>
in your gemfile
PragCypher has joined #ruby
<awestroke>
you have listed it with a version
<mehrdad>
awestroke: how?
<awestroke>
open your Gemfile
<awestroke>
and read it
<sent-hil>
awestroke: i'm guessing net-ssh-console is already requiring net-ssh, so you don't need to it
<mehrdad>
awestroke: what is loacation?
<Paradox>
borderlands 2 is awesome
BeLucid has joined #ruby
<awestroke>
sent-hil: that did it. Thanks
<awestroke>
mehrdad: sounds like a misspelled version of location
fastred has joined #ruby
justinmcp has quit [Remote host closed the connection]
justinmcp has joined #ruby
moshee has quit [Ping timeout: 240 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
Xeago has joined #ruby
lggr has quit [Ping timeout: 264 seconds]
Vainoharhainen has joined #ruby
joshman_ has joined #ruby
seoaqua has joined #ruby
lggr has joined #ruby
xeronic has joined #ruby
elico has joined #ruby
xorgnak has quit [Ping timeout: 264 seconds]
moshef has joined #ruby
<moshef>
I'm using scan to find words in a string. It finds words that are only partially included, and I'd like to find exact match only. what do I do?
GeekOnCoffee has quit [Ping timeout: 244 seconds]
adkron_afk has quit [Ping timeout: 256 seconds]
amskah has quit [Ping timeout: 246 seconds]
<bnagy>
anchors
diegoviola has joined #ruby
amskah has joined #ruby
<moshef>
?
berserkr has joined #ruby
PragCypher has quit [Quit: Leaving]
<m3pow>
animal = Animal.new(noise) is the same thing as saying animal = Animal.new ; animal.noise = noise ?
<Banistergalaxy>
No
<bnagy>
moshef: anchor your regular expressions
<Banistergalaxy>
It's not
<bnagy>
what you think of as an exact match is probably something like /\S(\w+)\S/
<m3pow>
in the same class method
<moshef>
hmm
<bnagy>
that's not a terrible sound regexp, but that's the idea
<moshef>
I'm using something like hello|world|something
GeekOnCoffee has joined #ruby
lggr has quit [Ping timeout: 265 seconds]
<bnagy>
if your expressions aren't anchored then they'll partial match, that's what regexps do
Xeago has quit [Remote host closed the connection]
<m3pow>
when i call that class method does it output the same thing ?
lggr has joined #ruby
<Xeago>
m3pow the result is the same, however using the constructor should `enforce` a more consistent model
<m3pow>
thank you very much Xeago
<Xeago>
however, it is always possible to circumvent the enforcement in ruby
<m3pow>
i just wanted to know if it's possible to do that and get the same result
<Xeago>
m3pow: consider having pre-set wrap-set and post-set bindings when setting a property
<Xeago>
in that case, the versions are not the same
<m3pow>
so it could have also be like this animal = Animal.new(noise,color); return animal
Elico1 has joined #ruby
lolmaus has quit [Read error: No buffer space available]
elico has quit [Read error: No buffer space available]
<Xeago>
return is an optional statement in ruby
cantonic_ has joined #ruby
lolmaus has joined #ruby
Banistergalaxy has quit [Ping timeout: 245 seconds]
<Xeago>
new Animal(noise,color)
<Xeago>
woud be sufficient
<m3pow>
thank you !
Tearan has joined #ruby
<Xeago>
though one could also write it without enforcing parameters, without return: a=new Animal(); a.color=color;a.noise=noise;a
timmow has joined #ruby
<Xeago>
m3pow: what's your programming experience?
<m3pow>
beginner
<Xeago>
first language?
<m3pow>
just started Ruby a week ago
<Xeago>
oky :)!
jgrevich has quit [Quit: jgrevich]
<m3pow>
sorry for the noobie questions
Banistergalaxy has joined #ruby
amskahda has joined #ruby
<Xeago>
Have you tried some calculating primes?
cantonic has quit [Ping timeout: 240 seconds]
<Xeago>
or fibonacci?
cantonic_ is now known as cantonic
<m3pow>
hmm no, not quite
amskah has quit [Ping timeout: 240 seconds]
_7894 has quit [Ping timeout: 240 seconds]
<m3pow>
i am just following some tutorials atm
<Xeago>
do you know how logic statements work?
<m3pow>
yep
<Xeago>
try doing fizzbuzz
lggr has quit [Ping timeout: 256 seconds]
<Xeago>
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."
chussenot has joined #ruby
arya_ has joined #ruby
lggr has joined #ruby
sheerun has joined #ruby
lkba has quit [Quit: Bye]
<Hanmac>
Xeago we not doing your homework :D
AndChat- has joined #ruby
<Xeago>
that's not homework
<Xeago>
it's the fizzbuzz test/challenge/problem that is common at interviews
flype has quit [Read error: Connection reset by peer]
jasonkuhrt has joined #ruby
<Xeago>
it's author says: this is hard because this kind of problem does not get taught during school
justinmcp has quit [Remote host closed the connection]
lggr has joined #ruby
Xeago has quit [Ping timeout: 252 seconds]
Banistergalaxy has quit [Ping timeout: 240 seconds]
idoru has joined #ruby
mahlon has joined #ruby
ged has joined #ruby
mahlon is now known as Guest5541
ged is now known as Guest14722
dhruvasagar has joined #ruby
arya__ has joined #ruby
Kwpolska has joined #ruby
arya_ has quit [Ping timeout: 245 seconds]
fyolnish has quit [Remote host closed the connection]
banisterfiend has joined #ruby
lggr has quit [Ping timeout: 264 seconds]
Xer0niC has joined #ruby
nari has joined #ruby
cascalheira has joined #ruby
Hamed-R has joined #ruby
Hamed-R has quit [Changing host]
Hamed-R has joined #ruby
diegoviola has quit [Ping timeout: 264 seconds]
Criztian has quit [Remote host closed the connection]
xeronic has quit [Ping timeout: 265 seconds]
lggr has joined #ruby
arya__ has quit [Ping timeout: 246 seconds]
capsule_toy has joined #ruby
rakl has quit [Quit: sleeping]
Criztian has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
Criztian has quit [Remote host closed the connection]
capsule_toy has quit [Client Quit]
justinmcp has joined #ruby
lggr has joined #ruby
sent-hil has quit [Remote host closed the connection]
<jokar>
Xeago_: hi
mucker has quit [Ping timeout: 245 seconds]
fastred has quit [Quit: fastred]
matrixis1 has joined #ruby
vlad_starkov has joined #ruby
matrixise has quit [Read error: No route to host]
lggr has quit [Ping timeout: 252 seconds]
Mon_Ouie has joined #ruby
kstephens has quit [Ping timeout: 264 seconds]
tsuru`` has joined #ruby
kstephens has joined #ruby
tsuru` has quit [Remote host closed the connection]
frogprince has quit [Read error: Connection reset by peer]
Neomex has joined #ruby
KevinSjoberg has quit [Quit: Computer has gone to sleep.]
Neomex has quit [Client Quit]
Mon_Ouie has quit [Ping timeout: 264 seconds]
lggr has joined #ruby
<Hanmac>
m3pow do you have the code yet?
virtuose has quit [Read error: No route to host]
<moshef>
I have a string and a bunch of words where I'd like to find some of them exactly within that string and some of them if just partially included. is it possible to do some 1 line regex for that?
iocor has joined #ruby
berserkr has quit [Ping timeout: 256 seconds]
troessner has joined #ruby
bbttxu has left #ruby [#ruby]
virtuose has joined #ruby
Banistergalaxy has joined #ruby
matrixis1 has quit [Ping timeout: 256 seconds]
<moshef>
or should I split it to 2 scans? one for the exact match and one for 'loose' match?
<canton7>
moshef, it's hard to visualise what you're asking. do you have an example?
<moshef>
canton7: a (loose match) = ["hi", "bye"]. b (each match) = ["canton", "ruby"]. string = "hiii guys, canton and rub are sweet"
sent-hil has joined #ruby
karn has quit []
notVert has joined #ruby
<moshef>
so hiii will be caught because it's loose match, canton because its exact. and rub won't be caught.
Averna has quit [Quit: Leaving.]
<moshef>
Hanmac: think it'll be easier if I divide this into to. I need help with the regex for .scan that match exact words only
yasushi has joined #ruby
<moshef>
because otherwise scan find 'loose' matches
<moshef>
Hanmac: thoughts? :)
lggr has joined #ruby
<canton7>
use \b ?
Xer0niC has quit []
<bnagy>
THAT'S what I was trying to think of before :)
sguselnikov has joined #ruby
justinmcp has quit [Remote host closed the connection]
futilegames has quit [Quit: futilegames]
<bnagy>
match space, $ ^ etc
<moshef>
\b ?
<canton7>
word boundary
<moshef>
yeah tried $ ^
<moshef>
but i have a bunch of words list that hi|bye
<moshef>
and I'd like to have exact match for each individually.
<bnagy>
moshef: like I said before, when you weren't listening, you need anchors
<moshef>
sorry. what are anchors?
<bnagy>
s.scan /\bfo|faao\b/
arietis has quit [Ping timeout: 252 seconds]
<bnagy>
foo|faa but whatever
<moshef>
"no bots, software or proxies .".scan /\bmoshe|bots\b/
<moshef>
awesome
Hanmac has quit [Ping timeout: 252 seconds]
cantonic_ has joined #ruby
<moshef>
so now i can combine this with the other words that I can find 'loose' right?
lggr has quit [Ping timeout: 264 seconds]
<bnagy>
you'll need to group, when you use scan
<bnagy>
"no bots, software or proxies .".scan /\b(soft|bots)\b/
<bnagy>
should only match bots
sguselnikov has quit [Client Quit]
<moshef>
tried something like that /bots|prox\bmoshe|bnagy\b/
bradhe has joined #ruby
arietis has joined #ruby
<moshef>
with /b(word|word2)\ I'm getting nil's back
seoaqua has quit [Ping timeout: 256 seconds]
Criztian has joined #ruby
<moshef>
what I did isn't ok? it does seem to work
<RubyPanther>
string = "hiii guys, canton and rub are sweet" ; loose, tight = %w! hi bye !, %w! ruby canton ! ; string.scan(/(?:#{loose.join("|")})|(?:\b(?:#{tight.join("|")})\b)/)
cantonic has quit [Ping timeout: 256 seconds]
cantonic_ is now known as cantonic
<moshef>
or not completely
Hanmac has joined #ruby
<moshef>
RubyPanther: trying
Hanmac has quit [Read error: Connection reset by peer]
Hanmac has joined #ruby
Hanmac has quit [Read error: Connection reset by peer]
Hanmac has joined #ruby
Hanmac has quit [Read error: Connection reset by peer]
<RubyPanther>
I love it when I get to write that much punctuation in a row. :) ("|")})|(?:\
bradhe has quit [Ping timeout: 265 seconds]
tadassce has joined #ruby
<bnagy>
aaaand that's why using regexps sucks
<bnagy>
starts of in games, ends up in unreadable shit like that
<moshef>
RubyPanther: I love you dude
Hanmac has joined #ruby
Hanmac has quit [Read error: Connection reset by peer]
<RubyPanther>
awwww, how sweet! Regexes are for lovers! hehehehe
Hanmac has joined #ruby
Hanmac has quit [Read error: Connection reset by peer]
lggr has joined #ruby
tadassce has left #ruby [#ruby]
tadassce has joined #ruby
ltsstar has joined #ruby
<moshef>
RubyPanther: :)
<RubyPanther>
bnagy: It depends on the value of readable
<moshef>
RubyPanther: seriously tho, how do you guys reach that level of regex? shitload of practice?
shiki has quit [Remote host closed the connection]
eddie_ has joined #ruby
<canton7>
it's just putting blocks together
tadassce has left #ruby [#ruby]
tadassce has joined #ruby
keanehsiao has joined #ruby
fixl has joined #ruby
<moshef>
well easy to say one you know which blocks to put :()
tadassce has left #ruby [#ruby]
<eddie_>
banisterfiend: There?
<RubyPanther>
moshef: I'm not sure if it is a skill *nix gnomes and dwarves are born with, or if it gets flash-burned into your brain during a Perl list context accident
<bnagy>
writing regexes like that is just like being a serial killer - you start off killing birds and cats, and gradually move up to killing and eating humans
tommyvyo has joined #ruby
tommyvyo has quit [Changing host]
tommyvyo has joined #ruby
<RubyPanther>
No it is just pattern matching, it isn't that hard once you have some experience.
lggr has quit [Ping timeout: 245 seconds]
<RubyPanther>
Once you learn to read (?:foo) as a single token, and understand the precedence of | then it is easier
skogis has quit [Ping timeout: 264 seconds]
<canton7>
the interpolation makes it look worse than it is. take that out, and it's /(?:hi|bye)|(?:\b(?:ruby|canton)\b)/, which is two parts: the loose /(?:hi|bye)/ and the tight /?:\b(?:ruby|canton)\b/ . The ?: are just so the brackets don't create a match. Take them out, and the tight is /\b(ruby|canton)\b/ , which is a boundary followed by (ruby or canton) followed by a boundary
<canton7>
* and the tight /(?:\b(?:ruby|canton)\b)/
adambeynon has joined #ruby
Hanmac has joined #ruby
Mon_Ouie has joined #ruby
Mon_Ouie has quit [Changing host]
Mon_Ouie has joined #ruby
neurotech has joined #ruby
<moshef>
canton7: thanks mate. very appreciated.
Hanmac has quit [Read error: Connection reset by peer]
SeanTAllen has quit [Changing host]
SeanTAllen has joined #ruby
x0F has quit [Disconnected by services]
x0F_ has joined #ruby
x0F_ is now known as x0F
lggr has joined #ruby
tk__ has joined #ruby
<RubyPanther>
55.88% punctuation, like a strong gastrique
tommyvyo has quit [Quit: Computer has gone to sleep.]
<canton7>
moshef, also rubular.com is good
<RubyPanther>
Paring it down to just the inside of the regex and it is a lucky 62.26% punctuation
adambeynon has quit [Ping timeout: 246 seconds]
<moshef>
RubyPanther: I'm getting a lot of "", "", "" on the array returned...
pskosinski has joined #ruby
<moshef>
canton7: I know, using it once in a while
lggr has quit [Ping timeout: 264 seconds]
Xeago_ has quit [Remote host closed the connection]
<RubyPanther>
moshef: you shouldn't, but you can add a () around the whole thing and it might help. Or pastie the data and code
<moshef>
forgot to add, v is an array of words. say v = ["hi", "/bye/", "ruby"]
<moshef>
RubyPanther canton7 thoughts?
<moshef>
I can add a reject but it seems a bit wrong..
lggr has quit [Ping timeout: 240 seconds]
Ruler_Of_Heaven_ is now known as pipopopo
und3f has joined #ruby
bartj3 has joined #ruby
wargasm1 has quit [Ping timeout: 256 seconds]
<RubyPanther>
moshef: I'd check what is actually getting into the word lists and narrow where the bug is that way first
lggr has joined #ruby
elaptics is now known as elaptics`away
justinmcp has joined #ruby
noxoc has joined #ruby
<moshef>
i have
br4ndon has joined #ruby
<moshef>
RubyPanther: updated the gist, check pls
<RubyPanther>
moshef: I see a comment that talks about what is _intended_ to go into the arrays but nothing to check what is in them before the regex.
sheerun has joined #ruby
mneorr has joined #ruby
snearch has quit [Quit: Verlassend]
<RubyPanther>
A problem should be smaller than what you have... either the lists are made wrong, or there is a bug in the regex
<moshef>
RubyPanther: the comment is actually where is there, went with a debugger to check..
<moshef>
RubyPanther: not what I think will be there...
lggr has quit [Ping timeout: 264 seconds]
hsbt is now known as hsbt_away
<moshef>
you don't get any empty strings?
<RubyPanther>
I don't care if a magic pony told you it is perfect, I can look right at the gist and see there is nothing outputting the values
<moshef>
ill puts it
<moshef>
i had a debugger (which i removed) thats why I know what it contains
<RubyPanther>
and if the values are correct, then you can just skip the blahblah and assign the arrays and then run the regex, you wouldn't have that much code in a concise problem
* RubyPanther
gets out the steel ruler.
<moshef>
is this too much code?
wargasm has joined #ruby
<moshef>
hmm
<moshef>
sec
br4ndon has quit [Ping timeout: 240 seconds]
<moshef>
RubyPanther: it happens because one of the arrays is empty, once I filled that array with something it returns just the word "software"
dhruvasagar has quit [Ping timeout: 244 seconds]
dhruvasagar has joined #ruby
<moshef>
then joins results in "" and returns for most of the words...
<moshef>
join*
<moshef>
[].join("|")
lggr has joined #ruby
DracoDan has quit [Read error: Connection reset by peer]
DracoDan has joined #ruby
Forevernade has joined #ruby
<m3pow>
Hanmac, i just managed to work out the first 2 parts of the program, to print Fizz for 3's and Buzz for 5's
bradhe has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
<moshef>
RubyPanther: should I leave out the regex part if the array is empty?
JustinCampbell has joined #ruby
xpen has quit [Remote host closed the connection]
<RubyPanther>
moshef: if some are empty that complicates things, either kludge it open with a value that will never match or else you'll have to either rework the regex or use multiple steps
bradhe has quit [Ping timeout: 256 seconds]
yshh has quit [Remote host closed the connection]
bsmith has quit [Ping timeout: 265 seconds]
monkegjinni has joined #ruby
<moshef>
RubyPanther: I can either reject empty strings, or build the regex with conditions of array present
awestroke has quit [Remote host closed the connection]
Forevernade has quit [Ping timeout: 248 seconds]
<moshef>
RubyPanther: what do you think is better?
fermion has joined #ruby
<RubyPanther>
moshef: multiple small steps is almost always better, ideally that logic would actually be like... 5 short methods that call each other
<moshef>
yeah, this method becomes too big
dhruvasagar has quit [Ping timeout: 248 seconds]
jasonkuhrt has joined #ruby
<moshef>
RubyPanther: thanks
DrShoggoth has joined #ruby
dhruvasagar has joined #ruby
lggr has joined #ruby
zodiak has quit [Ping timeout: 240 seconds]
zodiak has joined #ruby
noxoc has quit [Quit: Leaving.]
larissa has joined #ruby
artm has joined #ruby
Hamed-R has quit [Quit: Leaving]
zz_chrismcg is now known as chrismcg
jasonkuhrt has quit [Ping timeout: 246 seconds]
<shevy>
moshef! is your name josef?
Hanmac has joined #ruby
Hanmac has left #ruby [#ruby]
<moshef>
shevy: no
<m3pow>
hello shevy
<moshef>
my name is (surprisingly) moshe
<shevy>
aha, don't know that name much
<shevy>
hi m3pow
lggr has quit [Ping timeout: 252 seconds]
<shevy>
m3pow for power
<shevy>
hmm wait
<shevy>
m3pow for president!!!
<shevy>
that's better
<m3pow>
haha president ?
<m3pow>
i don't like to be a** kissed
<shevy>
hehehe
<shevy>
or being told what to say :)
<RubyPanther>
President of Your Own Desk, if you are a lucky dev
Xeago is now known as xeago
xeago is now known as Xeago
<m3pow>
Xeago gave me a task to make a program called FizzBuzz
<RubyPanther>
lol how hard can fizzbuzz be?
yasushi has quit [Ping timeout: 248 seconds]
lggr has joined #ruby
<m3pow>
well since i started ruby for ....aaa...a week
fyolnish has joined #ruby
<m3pow>
and i'm a little pather, not a big panther
<m3pow>
is good for me
<RubyPanther>
Yeah, it is good for you for sure
frogprince has quit [Remote host closed the connection]
frogprince has joined #ruby
<shevy>
m3pow what tasks must fizzbuzz solve
<moshef>
using .tr('^A-Za-z0-9', ' ') to remove all non a-z/numbers chars, would like to ignore dots too
<m3pow>
from 1..100 all the numbers that are multiples of 3 to be marked with Fizz, those by 5 with Buzz and those that are multiples of 3 and 5 with FizzBuzz
<m3pow>
instead of nil i think i get that blank space
ndrei has quit [Client Quit]
<matti>
Meh.
<workmad3>
Xeago: because puts calls to_s, and nil.to_s is ""
<matti>
FizzBuzz is like men
<matti>
Meh
<matti>
(1 .. 100).each {|i| puts (i % 15 == 0 ? 'FizzBuzz' : (i % 5 == 0 ? 'Buzz' : (i % 3 == 0 ? 'Fizz' : i ))) }
ndrei has joined #ruby
<matti>
There.
<matti>
Go over it.
<matti>
;]
<m3pow>
thank matti
lggr has quit [Ping timeout: 246 seconds]
<Xeago>
matti, try using only 2 conditionals
<workmad3>
matti: now solve it in brainfuck
ndrei has quit [Client Quit]
jasonkuhrt has joined #ruby
<workmad3>
matti: and paste it in-chan without being kicked for flooding ;)
<matti>
workmad3: I did wrote Brainfuck interpreter recently.
<matti>
workmad3: So, tempting.
Drewch_ has quit [Excess Flood]
<Hanmac>
matti my code was shorter :P
<m3pow>
you've seen that Xeago
<workmad3>
matti: but let me guess... you have better stuff to do for the next 50 years?
<bnagy>
first write a ruby -> brainfuck compiler
<bnagy>
in brainfuck, then run that in your interpreter
triptec_ has joined #ruby
<Xeago>
m3pow: yea, opening irb first
<bnagy>
I'll give you $50
<Xeago>
and then pasting in your code
<matti>
workmad3: I am at work now ;/
Drewch has joined #ruby
<workmad3>
bnagy: your challenge is to write a ruby interpreter in brainfuck :P
<matti>
Hanmac: I wrote it like that.
<matti>
Hanmac: I don't even know if it works?
<matti>
;d
<matti>
Where's the bot!
<matti>
>>> p 'Miss you, honey'
<bnagy>
workmad3: wouldn't that be like a million times easier?
<workmad3>
matti: melted down and sold for scrap
<matti>
:<
<matti>
workmad3: We should write it in 8 bit ASM now.
<workmad3>
bnagy: in all honesty, I have no idea
lggr has joined #ruby
<Hanmac>
matti okay i use p not puts, but the result was similar
<Hanmac>
this is my code: 1.upto(100){|i|p (a=(i%3==0?"Fizz":"")+(i%5==0?"Buzz":"")).empty?? i:a}
<bnagy>
workmad3: well naively, you write a LLVM bytecode -> brainfuck
<matti>
Hanmac: LOL
<bnagy>
or some IL without sideeffects
<matti>
Hanmac: You cheat.
<matti>
Hanmac: No spaces.
<matti>
;]d
<matti>
Hehehe
<m3pow>
Xeago, how do i cure that Nil ?
<bnagy>
then you just take YARV / MRI code and compile to llvm
triptec has quit [Ping timeout: 245 seconds]
triptec_ is now known as triptec
<matti>
Xeago: I like the + there.
<Xeago>
m3pow: how do you invoke your script atm?
CannedCorn has joined #ruby
<matti>
Xeago: Clever.
<joofsh>
Quick abstract question, every successfully completed action returns true in Ruby, correct? If I call a method and the last action of that method successfully completes, it will automatically return true such that its redundant to add a "return true"? So I could call a method from an if statement?
<Xeago>
that's Hanmac's code, not mine
bradhe has quit [Ping timeout: 265 seconds]
<matti>
Oh.
<matti>
Sorry.
<matti>
Hanmac: :P
<bnagy>
joofsh: no
<matti>
...
<matti>
s/Xeago/Hanmac/ in what I just said ;p
<banisterfiend>
joast quite some confusion there my friend :P
<matti>
banisterfiend: Pff
<Xeago>
joofsh: it will return the last statement's returnvalue
djdb has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
arubin has joined #ruby
quest88 has quit [Quit: quest88]
dpk has joined #ruby
<dalton_>
Is there a good resource that talks about interfaces to modules? Can modules assume that an instance variable exists in the class its mixed into? Should accessors be used instead (and is it ok to assume those accessors exist?) Thanks!
daniel_- has joined #ruby
ananthakumaran1 has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 244 seconds]
dakine has joined #ruby
frogprince_mac has quit [Quit: Leaving...]
jprovazn is now known as jprovazn_away
lggr has joined #ruby
sylock has quit [Quit: Page closed]
monkegjinni has quit [Ping timeout: 246 seconds]
adkron has quit [Ping timeout: 256 seconds]
sirecote_ is now known as sirecote
mercwithamouth has quit [Remote host closed the connection]
XedMada has joined #ruby
mercwithamouth has joined #ruby
Villadelfia has joined #ruby
matrixise has quit [Ping timeout: 244 seconds]
monkegjinni has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
ncamargo has joined #ruby
lolmaus has quit []
tommyvyo_ has joined #ruby
mengu has quit [Remote host closed the connection]
ncamargo has quit [Client Quit]
ltsstar has joined #ruby
alek_b has joined #ruby
bobbbo has quit [Quit: bobbbo]
Bosox20051 has quit [Quit: Leaving]
lucianosousa has joined #ruby
ncamargo has joined #ruby
darthdeus has joined #ruby
sagax has quit [Quit: Ухожу я от вас]
manuelitox_ has joined #ruby
mikepack has joined #ruby
ttt has quit [Ping timeout: 260 seconds]
ncamargo has quit [Client Quit]
tommyvyo_ has quit [Client Quit]
ananthakumaran has joined #ruby
sspiff has quit [Remote host closed the connection]
xpen has quit [Ping timeout: 244 seconds]
lggr has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
fantazo has quit [Remote host closed the connection]
maesbn has quit [Remote host closed the connection]
<troessner_>
dalton_, i assume it
maesbn has joined #ruby
<troessner_>
but you can make sure that they exist in something like the included callback
<Spooner>
troessner_ : I was going to suggest that, but that wouldn't work reliably based on when the module is included. e.g. if you include MyModuleThatUsesZ; attr_reader :z
xpen has joined #ruby
lggr has joined #ruby
<troessner_>
yeah, actually it was bullshit what i said on second thought
<troessner_>
:(
deryl has joined #ruby
<Spooner>
dalton_ : I'd suggest you try to use accessors though, since they'd fail if they were missing. Directly messing with @ivars is likely going to lead to trouble (unless you own both including class and included module).
ananthakumaran has quit [Ping timeout: 252 seconds]
<troessner_>
Spooner, but using attr accessors doesnt solve this problem
notVert has quit [Remote host closed the connection]
ryanlecompte has quit [Remote host closed the connection]
<troessner_>
because inclusion of modules happens before initializing any variables
<troessner_>
and before initialization you can't reliably test that they exist
maesbn has quit [Ping timeout: 264 seconds]
mneorr has quit [Remote host closed the connection]
<Spooner>
Why not? It just means you'd get a nomethod error on use, rather than at inclusion time, if the including class didn't provide them.
rabidpraxis has joined #ruby
bbttxu has quit [Quit: bbttxu]
<Spooner>
Whereas if you use ivars, unless you check whether they exist every time, they will default to nil.
ponty has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
<troessner_>
Spooner, good point, you're right
<Spooner>
Now we can discuss whether a module can add its own @ivars on the including class and get into even deeper water :D
gianlucadv has joined #ruby
davidcelis has quit [Quit: K-Lined.]
bartj3 has quit []
adambeynon has joined #ruby
<troessner_>
dalton_, quick code snippet which might help you get going:
<troessner_>
>> module M; def self.included(base); raise "OMG" unless base.new.respond_to?(:my_attr); end; end; class C; include M; attr_accessor :my_attr; end
<troessner_>
=> ni
<troessner_>
Spooner, :D
Cache_Money has joined #ruby
berkes has quit [Quit: Ex-Chat]
<Spooner>
troessner_ : You are creating a new base before it is finished. Not good :(
hoelzro is now known as hoelzro|away
<troessner_>
Spooner, yes, this might lead to weird errors, i know
<troessner_>
but how would you do it better?
lggr has joined #ruby
<troessner_>
Spooner, personally i wouldn't do this at all but rather make sure stuff doesn't break by a decent test coverage
eph3meral has quit [Quit: eph3meral]
<Spooner>
If you want to try to do it that way, you would be better off using base.public_instance_methods.include?(:my_attr)
<troessner_>
ah, nice one
<troessner_>
;)
<Spooner>
Though that doesn't work on 1.8 :D
<troessner_>
I'd still rather go with a decent test coverage
<troessner_>
:)
daniel_- has quit [Quit: WeeChat 0.3.8]
ph^ has quit [Read error: Connection reset by peer]
<Spooner>
(methods is a list of strings, not symbols, in 1.8).
bradhe has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
bradhe has quit [Read error: Connection reset by peer]
<Spooner>
Oh yes, tests are good. As long as it fails early (NoMethodError on accessing non-existant accessor, rather than missing @ivar beign nil or writing directly to an @ivar that uses some sort of validation or has secondary effects in the write method).
lggr has quit [Ping timeout: 256 seconds]
<Xeago>
Is this proper: "Input comes from VideofyMe's API."?
<Xeago>
or should it be VideofyMes ?
XedMada has quit [Ping timeout: 252 seconds]
daniel_- has joined #ruby
<Spooner>
VideofyMe's
cakehero has quit [Quit: Leaving...]
jbohn has joined #ruby
nightfalcon has joined #ruby
<Xeago>
ty
baroquebobcat has joined #ruby
lggr has joined #ruby
adac has quit [Quit: Leaving]
banisterfiend has joined #ruby
<Spooner>
I'd probably write "from the VideofyMe API" though.
iocor has quit [Quit: Computer has gone to sleep.]
hoelzro is now known as hoelzro|away
JohnBat26 has joined #ruby
jso has quit []
JarJar has joined #ruby
hadees has quit [Quit: hadees]
lggr has joined #ruby
eignerchris has joined #ruby
chrismcg is now known as zz_chrismcg
<withnale>
is there any way I could implement an OR so I found specify { :a => 1, :a => 2} ?
chussenot has quit [Read error: Operation timed out]
Vainoharhainen has quit [Quit: Leaving...]
<withnale>
found specify = could specify
asteve has joined #ruby
jso has joined #ruby
chrisja has joined #ruby
Chryson has quit [Ping timeout: 246 seconds]
haxrbyte_ has quit [Remote host closed the connection]
dpk has joined #ruby
hoelzro|away is now known as hoelzro
mikepack has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 264 seconds]
elaptics is now known as elaptics`away
XedMada has quit [Remote host closed the connection]
XedMada has joined #ruby
BrokenCog has quit [Quit: leaving]
luckyruby has joined #ruby
d1zzYLuLz has joined #ruby
<Spooner>
withnale : #any? rather than #all?
pu22l3r has joined #ruby
mikepack has joined #ruby
BrokenCog has joined #ruby
BrokenCog has quit [Changing host]
BrokenCog has joined #ruby
<d1zzYLuLz>
can somebody help me with eventmachine 0.12.10?? I get the error An error occurred while installing eventmachine (0.12.10), and Bundler cannot continue. when trying to "bundle install" w/ snorby
arubin has joined #ruby
baphled has quit [Ping timeout: 252 seconds]
nga4 has joined #ruby
love_color_text has joined #ruby
jrist-mtg is now known as jrist
lggr has joined #ruby
Xeago_ has joined #ruby
Elico1 has quit [Quit: elico1]
Xeago_ has quit [Read error: Connection reset by peer]
Drewch has quit [Ping timeout: 252 seconds]
sailias1 has joined #ruby
Xeago_ has joined #ruby
<Spooner>
d1zzYLuLz : Try #eventmachine perhaps?
lggr has quit [Ping timeout: 256 seconds]
eka has joined #ruby
Xeago has quit [Read error: Connection reset by peer]
<d1zzYLuLz>
bundle install #eventmachine? still fails
deadghost has quit [Ping timeout: 256 seconds]
jcorcuera has joined #ruby
<Spooner>
No, I mean the #eventmachine channel :D
<d1zzYLuLz>
oh. derp
<d1zzYLuLz>
lol
<Spooner>
But yes, I'd try and see if you can "gem install eventmachine" to see if it is a problem with using that older version (current is 1.0.0)
Drewch has joined #ruby
sailias has quit [Ping timeout: 246 seconds]
hadees has joined #ruby
eka has left #ruby [#ruby]
futilegames has joined #ruby
<shevy>
By the way, the :=<- idiom is called the Overbite Man.
manuelitox_ has quit [Read error: Connection reset by peer]
philcrissman has quit [Remote host closed the connection]
<RubyPanther>
I love the koi with the human face, so wise and fatherly
lggr has joined #ruby
<d1zzYLuLz>
Spooner: i think it is the issue that it's an old version, but snorby doesn't work w/ the new version
<d1zzYLuLz>
thanks for the help though
<Spooner>
d1zzYLuLz : OK. What OS, by the way?
<d1zzYLuLz>
debian
cody-- has quit [Quit: goodbye]
<Spooner>
Oh, OK, nothing unusual there (I can't compile 0.12.10 on this win64 system).
Forevernade has quit [Ping timeout: 252 seconds]
GoGoGarrett has joined #ruby
adamkittelson has joined #ruby
timmow has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 256 seconds]
dustinleer has joined #ruby
twoism_ has joined #ruby
jasonkuhrt has quit [Quit: Leaving...]
unipol has joined #ruby
twoism has quit [Ping timeout: 256 seconds]
unipol has quit [Client Quit]
Goles has quit [Quit: Computer has gone to sleep.]
mmercer has quit [Quit: WeeChat 0.3.8]
mmercer has joined #ruby
lggr has joined #ruby
kenichi-away is now known as kenichi
iocor has joined #ruby
aces1up has quit []
<Hunner>
Is the & operator on two arrays O(n^2) ?
dmiller has quit [Ping timeout: 244 seconds]
love_color_text has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 265 seconds]
bluenemo has quit [Remote host closed the connection]
<Hunner>
Also, what would the time complexity of my_array.select { |e| /some_expression/ =~ e } be? O(n) if the regular expression doesn't have to be loaded every time the block is called, I think
<hoelzro>
Hunner: why do you ask?
jeff_sebring has quit [Quit: Leaving]
<Hunner>
hoelzro: Because I'm trying to figure out if supporting an array of regex searches is worth the time and space requriements over just using string comparison
rburton- has joined #ruby
<hoelzro>
try benchmarking it =)
artm has quit [Quit: artm]
sepp2k1 has joined #ruby
lggr has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
mbk has joined #ruby
sepp2k has quit [Ping timeout: 246 seconds]
dmiller has joined #ruby
enroxorz-work has joined #ruby
<Spooner>
You should my_array.grep /some_expression/ (or premake the regexp, of course)
Forevernade has joined #ruby
diegoviola has joined #ruby
tvw has quit [Remote host closed the connection]
zommi has quit [Quit: Leaving.]
artm has joined #ruby
ij has joined #ruby
lggr has quit [Ping timeout: 264 seconds]
<Hanmac>
shevy did you read the newest what-if.kxcd.com ?
dalton_ has quit [Remote host closed the connection]
<Hanmac>
heftig: "what if we tried more power?" :D
<RubyPanther>
Hunner: The array stuff is fairly well optimized C, most of it will be whatever the normal best case is. & is fast and generally more appropriate. If you're to the point of using a string for optimization IMO you should just write it in C anyways, though, even if you still use a string.
Xeago_ has quit [Remote host closed the connection]
<RubyPanther>
Often minimizing n has better results
Mon_Ouie has quit [Remote host closed the connection]
Forevernade has quit [Remote host closed the connection]
philcrissman has joined #ruby
Mon_Ouie has joined #ruby
lggr has joined #ruby
ncr100 has joined #ruby
bricker has joined #ruby
c0rn__ has joined #ruby
<Spooner>
"Unfortunately, the laser energy flow would turn the atmosphere to plasma, instantly igniting the Earth’s surface and killing us all." - This is what Science was invented for!
<lessless>
Spooner, already watching the screencast
lggr has quit [Ping timeout: 264 seconds]
jasonkuhrt has joined #ruby
<reactormonk>
Mon_Ouie: I have to admit it's a beautiful hack of a code
lggr has joined #ruby
mark_locklear has quit [Ping timeout: 265 seconds]
etherdev has quit [Ping timeout: 268 seconds]
beneggett has joined #ruby
<lessless>
Spooner, but it still use method-source at the end! ;D
<Spooner>
Aye, it probably does, but it is more idiotproof and also allows you to see the C source (if using pry-doc as well as pry).
<reactormonk>
lessless: guess what, the same guy wrote pry and method-source
daniel_- has joined #ruby
<Mon_Ouie>
method-source was written *for* pry
Neomex has joined #ruby
alvaro_o has joined #ruby
Guest23766 is now known as issyl0
<lessless>
Okay, that's really make me like WOW
qubit has joined #ruby
joast has quit [Quit: Leaving.]
monkegjinni has joined #ruby
<Spooner>
Dont' be like that when you meet him. It goes straight to his head.
lggr has quit [Ping timeout: 265 seconds]
vaclavt has joined #ruby
Virunga has quit [Remote host closed the connection]
AlbireoX has joined #ruby
mucker has quit [Ping timeout: 245 seconds]
gfonteno_ has quit [Ping timeout: 256 seconds]
loves_color_text has quit [Remote host closed the connection]
loves_color_text has joined #ruby
gfontenot has joined #ruby
lggr has joined #ruby
axl_ has quit [Quit: axl_]
seme has joined #ruby
mark_locklear has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
completely_soake has joined #ruby
philcrissman has joined #ruby
<reactormonk>
Spooner: ;-)
k0m has quit [Quit: Computer has gone to sleep.]
willclark has joined #ruby
dpk has quit [Quit: Asleep at the keyboard.]
heisenmink has joined #ruby
<willclark>
is xsd2ruby.rb from soap4r the only utility that can parse an xsd file and generate ruby classes?
notVert has joined #ruby
vaclavt_ has joined #ruby
lushious has joined #ruby
mark_locklear has quit [Ping timeout: 246 seconds]
joast has joined #ruby
heisenmink has quit [Remote host closed the connection]
guns has joined #ruby
heisenmink has joined #ruby
peneconleche has joined #ruby
dpk has joined #ruby
vaclavt has quit [Ping timeout: 248 seconds]
vaclavt_ is now known as vaclavt
awestroke has quit [Ping timeout: 256 seconds]
lggr has joined #ruby
<shevy>
who wants to help with RubyOS
<GeekOnCoffee>
shevy: ??
<shevy>
an OS where as much ruby as possible is used
bbttxu has joined #ruby
<Spooner>
shevy : rm -rf /rubyos
<shevy>
:(
<Spooner>
Does that help?
<shevy>
that does not sound very constructive!
<shevy>
it is easier to smash down a bridge than build one
* shevy
nods wisely.
chrisbolton has joined #ruby
<rking>
shevy: Get as far as booting something, anything, into a VM, then let me know.
<GeekOnCoffee>
shevy: what's the point?
<shevy>
ok!
<rking>
shevy: Also, how much of the prior art have you studied?
<shevy>
rking pfffffft prior art stinks
<shevy>
go on the road and learn, said konfuzius!
<shevy>
and take people with you, so you can learn from them too
<deryl>
probably to showcase what ruby can do in the vein of OS management (boot scripts, after-boot system-mission-oriented) etc
<shevy>
I actually tried to replace /etc/init.d with ruby scripts (the shell scripts there)
<chrisbolton>
This is more of a logic question than a ruby questions but I've got an array of words, which I am going to loop through with an each block and see if they exist within a paragraph. If the word exists in the paragraph I want it to stop looping. Any ideas?
mercwithamouth has quit [Ping timeout: 264 seconds]
<canton7>
lessless, is that module being included somewhere?
obryan has joined #ruby
<k0m>
in sign_in cookies[:ussr] = user.id ussr supposed to be user?
<RubyPanther>
lessless: @current_user ||= Player.find(cookies[:user_id]) if cookies[:user_id] # if cookies[:user_id] is false then the @current_user value doesn't get returned. You golfed it into the rough. :)
<k0m>
or user_id
lggr has quit [Ping timeout: 256 seconds]
mercwithamouth has joined #ruby
<canton7>
k0m, I suspect it's supposed to be user_id :P
<lessless>
rofl, cookie[:user_id] :D
<lessless>
i mean cookie[:ussr]
<k0m>
so it is supposed to be ussr?
<lessless>
no, :user_id
<k0m>
ah okay :p makes more sense
gvz has quit [Quit: leaving]
jrist is now known as jrist-afk
bluOxigen has quit [Ping timeout: 248 seconds]
lggr has joined #ruby
Tearan has joined #ruby
peneconleche is now known as peneconleche|awa
mattp_ has joined #ruby
tvw has quit [Ping timeout: 264 seconds]
chimkan_ has quit [Quit: chimkan_]
jlogsdon_ has joined #ruby
joelsbeard has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 248 seconds]
alvaro_o has quit [Quit: Ex-Chat]
tvw has joined #ruby
sailias1 has quit [Quit: Leaving.]
<lessless>
RubyPanther, but cookies[:user_id] actually equals user id
geekbri has quit [Remote host closed the connection]
<lessless>
i think that if i set @current_user=user in sign_in method, than @current_user will be initialized in signed_in? and not null
<canton7>
..unless, cookies[:user_id] is *always* set when @current_user is set
lggr has joined #ruby
workmad3 has joined #ruby
iocor has joined #ruby
<RubyPanther>
lessless it might, if it is set. If it isn't set, you hit the bug. It is a bug. Something doesn't work and has known bugs, okay, it has known bugs. Maybe it also has unknown bugs. Why bother looking for unknown bugs before fixing the known bugs?
jasonkuhrt has quit [Quit: Leaving...]
qubit has left #ruby [#ruby]
obryan has quit [Remote host closed the connection]
<canton7>
lessless, you probabl want to explicitely return @current_user from the current_user method
<canton7>
lessless, depends what you want to do. You've cut out a lot of functionality
CodeFriar has quit [Quit: Leaving...]
slux has quit [Remote host closed the connection]
<lessless>
RubyPanther, what can I do... it got all my attention ;)
tvw has quit [Ping timeout: 252 seconds]
willclark_ has quit [Quit: willclark_]
CodeFriar has joined #ruby
thillux has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
<lessless>
canton7, The whole purpose of this is to maintain sessions - user may login, act according to his role, and logout
tgraham has quit [Quit: Leaving...]
tgraham has joined #ruby
thillux has quit [Client Quit]
<lessless>
set cookie on successful authorization, check on demand if is it authenticated user and delete cookie on logout or after session completes (browser close)
thillux has joined #ruby
bbttxu has quit [Quit: bbttxu]
lggr has joined #ruby
thillux has quit [Remote host closed the connection]
thillux has joined #ruby
thillux has quit [Remote host closed the connection]
<chiel>
workmad3: hmm, think i will stick with open-uri for now then :)
<workmad3>
chiel: and there are many wrappers around net/http that give you nicer interfaces for certain styles. My particular poison is normally httparty :)
lledet_ has joined #ruby
<chiel>
workmad3: it gets a +1 for the name alone. :D
lggr has joined #ruby
<canton7>
lessless, probably a very bad idea to store a user ID in a cookie. Means the user can edit it to be whatever they want
<canton7>
(unless some sort of signing system is in place)
<chiel>
workmad3: what is it that makes you choose that gem (other than the awesome name :p)
statarb3 has quit [Ping timeout: 246 seconds]
<workmad3>
chiel: it gives a nice balance between nice, clean code and control over how the HTTP request is made
<lessless>
canton7, the cookie value is encrypted and according to rails security can't be forged
<canton7>
lessless, aha fair play. I'm not a rails user
justinmcp has quit [Remote host closed the connection]
<canton7>
and authinabox was written for sinatra, as you can see
<chiel>
workmad3: cool. well, i'll use that then. :)
lledet has quit [Ping timeout: 240 seconds]
lledet_ is now known as lledet
justinmcp has joined #ruby
Guest64548 has quit [Quit: Guest64548]
lledet_ has joined #ruby
bananagram has joined #ruby
diegoviola has joined #ruby
justinmcp has quit [Remote host closed the connection]
<workmad3>
lessless: it's annoying responding in two channels to you, but as it's relevant here... 'cookies[:whatever] = value' is *not* secure
<workmad3>
lessless: it can be read and altered by the user
cody-- has quit [Quit: goodbye]
<workmad3>
lessless: you'd need to use 'cookies.signed[:whatever]' to set a cookie that is signed, meaning that it can be read but alterations are detectable
justinmcp has joined #ruby
gfontenot has quit []
<workmad3>
lessless: incidentally, that is made clear in the doc page that *you* linked to in #rubyonrails :P
adamkittelson has quit [Remote host closed the connection]
Xeago has quit [Remote host closed the connection]
justinmcp has quit [Remote host closed the connection]
<workmad3>
canton7: if you're around, ^^ also for you so you don't have rails misconceptions floating around ;)
lggr has quit [Ping timeout: 244 seconds]
lledet has quit [Ping timeout: 246 seconds]
lledet_ is now known as lledet
pettsson has joined #ruby
reashlin has quit [Read error: No route to host]
Xeago has joined #ruby
alexwh has left #ruby [#ruby]
und3f has quit [Quit: Leaving.]
<lessless>
workmad3, hmm, inspect those cookie it is encrypted, thanks for pointing this out, i'll check more
seme has quit [Ping timeout: 246 seconds]
slux has quit [Remote host closed the connection]
nwest has quit [Quit: Computer has gone to sleep.]
thillux has joined #ruby
lggr has joined #ruby
cascalheira has joined #ruby
hadees has quit [Quit: hadees]
paulovittor23 has quit [Ping timeout: 244 seconds]
BrokenCog has quit [Quit: leaving]
A124 has quit [Read error: Connection reset by peer]
GoHuyGo has joined #ruby
yalue has quit [Read error: Connection reset by peer]
<workmad3>
lessless: are you confusing base64 encoded for encryption?
<lessless>
this is how it's content look like: BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTUwMTA1NTRkNzBiZTIzNzg4ZTVlOGEzNmVmMDQzOTQ1BjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUkwRjBvL1QzbC9TT1U3ODR0Yk5EQW1nOWtrV3h3TEExcHFqYXVoNzhmNlE9BjsARg%3D%3D--89048ecaec7908394bb6162765fb3c75ef0a2985
<lessless>
not looks like base64 to me
<workmad3>
lessless: what's the name of that cookie though?
<lessless>
_tt_session
<workmad3>
lessless: yeah, that's not the cookie you're setting
<workmad3>
lessless: that's the session cookie that rails creates automatically
<workmad3>
lessless: which *is* signed
dmiller has quit [Remote host closed the connection]
frogprince_mac has quit [Quit: Leaving...]
jrajav has quit []
mmitchell has quit [Remote host closed the connection]
s0ber has quit [Read error: Connection reset by peer]
A124 has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
carloslopes has quit [Quit: Leaving.]
s0ber has joined #ruby
jlogsdon_ has quit [Remote host closed the connection]
<lessless>
okay, but still, why @current_user equal to nill although it supposed to be initialized?
haxrbyte has joined #ruby
lggr has joined #ruby
dpk has joined #ruby
A124 has left #ruby [#ruby]
elaptics`away is now known as elaptics
tommyvyo has quit [Quit: Computer has gone to sleep.]
tommyvyo_ is now known as tommyvyo
joshman_ has quit [Ping timeout: 265 seconds]
ltsstar has quit [Quit: ltsstar]
jenrzzz has joined #ruby
jjbohn has quit [Quit: Leaving...]
JarJar has quit [Quit: Leaving]
mbk has quit [Read error: Connection reset by peer]
tekacs has quit [Quit: Disappearing... *poof*]
peneconleche|awa has quit [Ping timeout: 256 seconds]
tekacs has joined #ruby
Xeago has quit [Remote host closed the connection]
murtas has quit [Quit: leaving]
linoj_ has joined #ruby
lggr has quit [Ping timeout: 248 seconds]
internet_user has quit [Remote host closed the connection]
dpk has quit [Quit: Asleep at the keyboard.]
ph^ has quit [Ping timeout: 264 seconds]
haxrbyte has quit [Read error: Connection reset by peer]
linoj has quit [Read error: Operation timed out]
lggr has joined #ruby
schaerli has quit [Remote host closed the connection]
linoj_ has quit [Ping timeout: 248 seconds]
haxrbyte has joined #ruby
triptec has quit [Read error: Connection reset by peer]
triptec has joined #ruby
haxrbyte_ has joined #ruby
Tearan has quit [Quit: Sleepy Badger....]
shobhitg has joined #ruby
daniel_- has quit [Ping timeout: 265 seconds]
tommyvyo_ has joined #ruby
manuelitox_ has quit [Ping timeout: 264 seconds]
mercwithamouth has quit [Ping timeout: 252 seconds]
headius has joined #ruby
lledet_ has joined #ruby
lggr has quit [Ping timeout: 248 seconds]
haxrbyte has quit [Ping timeout: 256 seconds]
xyzodiac has joined #ruby
daniel_- has joined #ruby
lledet__ has joined #ruby
Coolhand has joined #ruby
mrdodo has joined #ruby
lggr has joined #ruby
<mrdodo>
is there an opposite of abs? meaning it would make an integer always negative
hiroyuki has quit [Ping timeout: 245 seconds]
stepnem has quit [Ping timeout: 264 seconds]
slicslak has quit [Read error: Operation timed out]
adkron has joined #ruby
xyzodiac has quit [Client Quit]
<blazes816>
-(-1.abs)
<blazes816>
generally: -(my_var.abs)
lledet has quit [Ping timeout: 260 seconds]
lledet__ is now known as lledet
<mrdodo>
blazes816: thats what i was thinking, i just wasn't sure if there was already a method that returned it
timonv has quit [Remote host closed the connection]
<mrdodo>
blazes816: thanks
lledet_ has quit [Ping timeout: 264 seconds]
slicslak has joined #ruby
<Hanmac>
look i found this: ~(nr).abs + 1
RegEchse has joined #ruby
alvaro_o has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
Jonah11_ has joined #ruby
thone_ has joined #ruby
dmiller has joined #ruby
cpruitt has joined #ruby
<Jonah11_>
is there an easy way to parse an html <table> so that it's cell data goes into a nested ruby array, with each inner array representing one row's data?
hiroyuki has joined #ruby
lggr has joined #ruby
Guedes0 has joined #ruby
hadees has joined #ruby
thone has quit [Ping timeout: 240 seconds]
mensvaga has quit [Quit: Page closed]
chimkan_ has joined #ruby
tommyvyo_ has quit [Quit: Computer has gone to sleep.]
futilegames has quit [Quit: futilegames]
Guedes0 has quit [Client Quit]
Speed has left #ruby ["Leaving channel."]
Guedes has joined #ruby
Guedes has quit [Changing host]
Guedes has joined #ruby
peneconleche has joined #ruby
noxoc has quit [Quit: Leaving.]
<blazes816>
Jonah11_: nokogiri
nicoulaj has quit [Remote host closed the connection]
<Spooner>
You should probably put the secret stuff in a config file (say yaml), that way the secrets are separate from the code and you don't need to worry about blanking them ;)
im0b has joined #ruby
<falieson>
haha, thanks
sneakyness_wk has quit [Quit: you smell bad and you can't read good]
tar_ has joined #ruby
<Spooner>
And, if the code is going into a public repos, then you just don't add the .yml file.
mikepack has quit [Remote host closed the connection]
havenn has joined #ruby
<Spooner>
But I guess it isn't, so probably not a problem.