fflush changed the topic of #ruby to: Ruby 1.9.3-p194: http://ruby-lang.org || Paste > 3 lines of text on pastebin.com
kaen has joined #ruby
<burgestrand>
cpruitt: this includes stating the encoding of your files if you use anything other than 7-bit ASCII, which is a good practice as the default is different depending on the system environment.
kaen has quit [Read error: Connection reset by peer]
kylemcgill has joined #ruby
<burgestrand>
cpruitt: your error stems from ruby thinking your file is in one encoding (your system’s default, most likely) but you’ve written code using ♯, which is not valid in that encoding, and ruby complains loudly.
cantonic has quit [Quit: cantonic]
liluo has quit [Read error: Connection reset by peer]
<cpruitt>
OK, that makes sense. I'm still a little unsure of how to proceed. Lets say I have one file with that class defined (accidentals.rb). I use the magic encoding comment to "switch" to UTF-8 (may be mixing terms). If I have another file that is NOT UTF-8 that uses the Accidental class, will that work or does (like I'm thinking) everything using it also have to declare UTF-8?
jeff_sebring has joined #ruby
pskosinski has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
<cpruitt>
Ugh… I'm about to just use "#" and "b" instead of the real symbols. lol
emmanuelux has joined #ruby
xorgnak has quit [Remote host closed the connection]
<burgestrand>
cpruitt: unless otherwise stated, *every* file required by ruby is in the default encoding. So, say you write this ♯ in every file in your gem, you must also write the "# encoding: utf-8" in every file.
liluo has joined #ruby
<burgestrand>
cpruitt: afaik there is no way to change the global default encoding of ruby source files.
btanaka has quit [Remote host closed the connection]
ckrailo has quit [Quit: Computer has gone to sleep.]
<burgestrand>
cpruitt: i.e. writing "# encoding: your_encoding" in every file of your gem is recommended :)
<cpruitt>
burgestrand: I think I'm tracking with you. If I do that a consuming script (say a rails app for example) will also need to do that or no? That's the part that's throwing me for a loop.
<burgestrand>
cpruitt: you won’t, unless the consuming script itself contains UTF-8 characters as well that need their encoding defined. You can use a gem with all files having "# encoding: ISO-8859-1" in it, even if the consuming script is in UTF-8. It’s just that strings coming from the gem with "ISO-8859-1" in it will have their encoding in ISO-8859-1 (latin-1, western style encoding).
iamjarvo has joined #ruby
cj3kim has quit [Quit: This computer has gone to sleep]
xorgnak has joined #ruby
xorgnak has quit [Read error: Connection reset by peer]
kirun has quit [Quit: Client exiting]
kevinbond has joined #ruby
<cpruitt>
OK I think I get it. The "# encoding: your_encoding" is telling the ruby interpreter how to handle and parse out the strings in **that file** but once it's in memory it's just a collection of bytes with a note on what encoding to use. Would that be an accurate (albeit maybe poor) way of understanding it?
mengu has quit [Read error: Connection reset by peer]
xaq has quit [Remote host closed the connection]
xorgnak has joined #ruby
xorgnak has quit [Remote host closed the connection]
mengu has joined #ruby
mengu has quit [Changing host]
mengu has joined #ruby
xorgnak has joined #ruby
mrdodo has joined #ruby
<burgestrand>
cpruitt: yup, that’s pretty much it.
<burgestrand>
cpruitt: strings in ruby = collection of bytes, and an encoding.
apok has quit [Remote host closed the connection]
<cpruitt>
burgestrand: OK that clicked. Thanks for the help.
reuf has quit [Quit: Leaving]
<cpruitt>
burgestrand: would have spent half the night on that one. :-)
apok has joined #ruby
xorgnak has quit [Remote host closed the connection]
headius has quit [Quit: headius]
TechCel has joined #ruby
Freijo is now known as Fraeon
thomas is now known as Thomas
k_89 has quit [Ping timeout: 252 seconds]
zemanel has quit [Quit: Remote hottie closed the connection]
bradhe_ has quit [Remote host closed the connection]
rippa has quit [Ping timeout: 252 seconds]
Progster has quit [Ping timeout: 260 seconds]
<burgestrand>
cpruitt: :)
igotnolegs has quit [Quit: Computer has gone to sleep.]
hunglin1 has quit [Quit: Leaving.]
<burgestrand>
cpruitt: as a further note, String#force_encoding just swaps the internal encoding flag, does nothing to the bytes representing the string.
yakko_ has joined #ruby
mikeric has joined #ruby
davidcelis has quit [Quit: K-Lined.]
lorandi has joined #ruby
yakko has quit [Ping timeout: 246 seconds]
Simon3 has joined #ruby
mwilson_ has quit [Excess Flood]
Chryson has joined #ruby
mwilson_ has joined #ruby
revans has joined #ruby
Simon5 has joined #ruby
oscardelben has joined #ruby
yakko_ is now known as yakko
c0rn_ has quit [Quit: Computer has gone to sleep.]
Simon3 has quit [Read error: Connection reset by peer]
zodiak has quit [Remote host closed the connection]
celestius has quit [Remote host closed the connection]
sailias has joined #ruby
Rezwan has joined #ruby
billiamii has joined #ruby
hunglin has joined #ruby
adeponte has quit [Remote host closed the connection]
Berglund has quit [Quit: Computer died.]
adeponte has joined #ruby
andrewhl has quit [Remote host closed the connection]
k_89 has joined #ruby
Simon3 has joined #ruby
adamkittelson has quit [Remote host closed the connection]
<Petit_Dejeuner_>
Can I not inject a range? '[1..10].inject{|sum, num| sum + num}'
cwang has quit [Remote host closed the connection]
adamkittelson has joined #ruby
shadoi has quit [Quit: Leaving.]
jerm1080 has quit [Quit: Leaving]
Petit_Dejeuner_ is now known as Petit_Dejeuner
<rking>
Petit_Dejeuner_: That's actually a range wrapped in an Array
htroyack has quit []
yakko has quit [Remote host closed the connection]
<rking>
Petit_Dejeuner: Use ()s insteadda []s.
<Petit_Dejeuner>
rking, oh, thanks
<rking>
Then all your =[s will turn to =)s
adeponte has quit [Ping timeout: 244 seconds]
wvms has joined #ruby
CannedCo_ has quit [Quit: Computer has gone to sleep.]
<EstanislaoStan>
I'm confused as to why I'm getting the "undefined method '[]' for nil:NilClass" error here. Can I not pass hashes into a module? http://pastie.org/4327476
Hanmac1 has joined #ruby
jrajav has joined #ruby
Hanmac has quit [Ping timeout: 248 seconds]
<seanstickle>
EstanislaoStan: please show all your code -- how you are calling the method, etc
Speed has quit [Quit: When two people dream the same dream, it ceases to be an illusion.]
sebicas has quit [Read error: Connection reset by peer]
sebicas_ has joined #ruby
justsee is now known as justsee|away
c0rn_ has joined #ruby
justsee|away is now known as justsee
mikeric has quit [Read error: Connection reset by peer]
nopolitica has quit [Quit: Leaving.]
savage- has quit [Remote host closed the connection]
mxweas has quit [Quit: Computer has gone to sleep.]
kah_ has joined #ruby
iamjarvo has quit [Ping timeout: 244 seconds]
<EstanislaoStan>
Uh, does this help? true_name = TrueNameModule.generate_true_name(thing_name, @dungeon_things)
apok_ has joined #ruby
adeponte has quit [Remote host closed the connection]
akem has quit [Ping timeout: 244 seconds]
<seanstickle>
EstanislaoStan: line 2 in http://pastie.org/4327476 isn't doing what you think it's doing
voodoofish430 has quit [Quit: Leaving.]
<seanstickle>
EstanislaoStan: it's not setting some sort of global variable that can be used inside the method
<EstanislaoStan>
Sorry. My bad for not checking this earlier. It works if I just run this code. But in my larger program it's not. So I've got to figure out whats going on in there.
<arietis>
is it possible to make server using standard ruby library?
Progster has joined #ruby
<Petit_Dejeuner>
I would imagine you could, with sockets and threading.
alexim has quit [Quit: sleep]
sevvie has joined #ruby
gmci has joined #ruby
ringotwo has quit [Remote host closed the connection]
Axsuul has quit [Ping timeout: 252 seconds]
akem has quit [Read error: Operation timed out]
Axsuul has joined #ruby
<EstanislaoStan>
I'm having a problem finding the mistake in my code because I can't tell where the method call is happening from. The wrong object is supplied to my method and it spits out an error when it runs with it. Is there a way I can find where this method call is happening?
mxweas has joined #ruby
nadirvardar has quit [Quit: Computer has gone to sleep.]
ZachBeta has quit [Quit: Computer has gone to sleep.]
<iamjarvo>
anyone have an example on building a simple tree like structure with ruby
<Spaceghostc2c>
On that, using a #respond_to? is akin to #try, which is ucky.
<Spaceghostc2c>
not ducky.
<hemanth>
ducktypying ftw?
<Spaceghostc2c>
Petit_Dejeuner: They're useless. Why not use semicolons on every expression ending too? I only use parens when they're required and the code looks so much nicer.
<bnagy>
hemanth: why doesn't the simple alias work?
<hemanth>
bnagy, because, 1.9 has no each method
<Spaceghostc2c>
Unlike in javascript, where they actually mean something to have the parens.
julio has quit [Read error: Connection reset by peer]
<bnagy>
hemanth: that's what the alias should create
<Spaceghostc2c>
hemanth: Why not just switch to using the each_line and be 1.9 compatible without keeping aliases around?
<Petit_Dejeuner>
Spaceghostc2c, It feels weird to talk about Ruby code as yucky
<bnagy>
Spaceghostc2c: yeah I tried convincing him already :/
<Spaceghostc2c>
Petit_Dejeuner: It's easy. Ucky ruby code is written by people who mistake ruby for a language it isn't.
<hemanth>
bnagy, ha, it must be alias :each :each_line
<Spaceghostc2c>
hemanth: Good luck.
Hanmac1 is now known as Hanmac
<bnagy>
hemanth: oic, yeah I assumed you had them the right way round, arguments to alias always confuse me
<Petit_Dejeuner>
Spaceghostc2c, I though ruby existed to serve the programmer
<Spaceghostc2c>
Petit_Dejeuner: Ruby exists for adult programmers, not immature ones.
<bnagy>
it's like ln -s - no matter how many times I have used it over the years I still get it wrong every time
<hemanth>
bnagy, for me to
mockra has quit [Remote host closed the connection]
<Petit_Dejeuner>
Spaceghostc2c, ouch
<hemanth>
Spaceghostc2c, thanks :)
<Spaceghostc2c>
:D
sevvie has quit [Quit: sevvie]
<Spaceghostc2c>
hemanth: No worries, friend. Happy hacking.
Chryson has quit [Quit: Leaving]
<hemanth>
:)
<hemanth>
ln -fs bnagy
<dg73>
yeah never know whether it's source or target first when ln -s ing
<Petit_Dejeuner>
I still don't quite understand what's wrong with respond_to?.
<Spaceghostc2c>
It's source then dest
<hemanth>
Petit_Dejeuner, nothing is wrong, it's not needed
<dg73>
man page is always handy :)
<Spaceghostc2c>
Petit_Dejeuner: It's asking objects if they have methods, which isn't very ducky at all.
<bnagy>
hemanth: how are you using that construct so much anyway? Normally you'd use each_line directly on an IO
<Spaceghostc2c>
bnagy: You're right. I'd say it's closer to just being ucky in general.
<hemanth>
Petit_Dejeuner, there is some $hit code that has use .each assuming it will always get an array, but it does get Strings at times...so need to fix them
<hemanth>
bnagy, ^
<Petit_Dejeuner>
<-- confused
<bnagy>
ok well fix that code
<bnagy>
easy, no need to muck about in String
Xethron has left #ruby [#ruby]
<Petit_Dejeuner>
Ah, but mucking about in String sound so much more enjoyable than editing and refactoring a bunch of code.
<bnagy>
aliasing to create each so that type confused crap continues to work is... horrible
nadirvardar has quit [Quit: Computer has gone to sleep.]
<hemanth>
:D
AlbireoX is now known as AlbireoX`Away
<Petit_Dejeuner>
I wish I could do this kind of thing in Python. I could pretend Python3 is Python2.7 for years.
<Petit_Dejeuner>
<-- Mediocre Programmer
<bnagy>
I don't know python, but I was under the impression that Python 3 is used basically by guido and nobody else
<Petit_Dejeuner>
That assumption is more or less correct.
<Petit_Dejeuner>
I think Google might use some Python 3, what with Guido working there an all.
<Petit_Dejeuner>
The only guy I know who works at Google uses 2.7 though.
<hemanth>
Petit_Dejeuner, did you know, python3.1 came way before python 2.7 ;) ?
<Petit_Dejeuner>
No, I did not.
nadirvardar has joined #ruby
banisterfiend has joined #ruby
<Spaceghostc2c>
A later release of python 2 after python 3 came out?
Petit_Dejeuner has left #ruby ["Leaving"]
daniel_hinojosa has quit [Ping timeout: 276 seconds]
<hemanth>
Spaceghostc2c, yup
julio has quit [Ping timeout: 250 seconds]
fantazo has quit [Remote host closed the connection]
<banisterfiend>
hemanth: hello.
<hemanth>
banisterfiend, hey! I had confused bnagy as you :D
banisterfiend has quit [Read error: Connection reset by peer]
eywu has quit [Quit: Leaving.]
ananthakumaran has quit [Quit: Leaving.]
tagrudev has joined #ruby
Xethron has joined #ruby
<bnagy>
rvm is like cancer
banisterfiend has joined #ruby
<bnagy>
you can cut it out, but it keeps coming back :<
oscardelben has quit [Quit: oscardelben]
<Xethron>
Good morning everyone :D
<Spaceghostc2c>
bnagy: Good stuff in that regard.
Banistergalaxy has quit [Ping timeout: 250 seconds]
djdb has joined #ruby
nadirvardar has quit [Quit: Computer has gone to sleep.]
cpruitt has quit [Read error: Connection reset by peer]
cpruitt has joined #ruby
<banisterfiend>
bnagy: hey naggy
michaelmartinez has joined #ruby
AlbireoX`Away is now known as AlbireoX
AlbireoX is now known as AlbireoX`Away
<bnagy>
morning banisterfiend
<bnagy>
ok afternoon
<banisterfiend>
bnagy: evening here
<banisterfiend>
bnagy: hey benjamin
<bnagy>
1815 isn't evening yet
<banisterfiend>
bnagy: areyou still in singapore?
<bnagy>
no, chiangmai
maletor has joined #ruby
uris has quit [Quit: leaving]
<bnagy>
in thai, the day is divided into 6 hour sections, so 1 tum would be 1 in the evening, which is 7pm
<bnagy>
therefore evening officially starts at 7, qed
sevvie has quit [Quit: sevvie]
Eldariof-ru has quit []
mrdodo has quit [Remote host closed the connection]
banisterfiend has quit [Read error: Connection reset by peer]
ryanf has joined #ruby
banisterfiend has joined #ruby
nooodl has joined #ruby
jumpingcloud has joined #ruby
vectorshelve has quit [Quit: Page closed]
<jumpingcloud>
hey
chimkan_ has quit [Quit: chimkan_]
Dreamer3 has quit [Quit: Leaving...]
Aaton_off is now known as Aaton
adamkittelson has quit [Remote host closed the connection]
ceej has joined #ruby
<ceej>
hey, is there a reason ruby would think this is true? "2010-12-10 13:45:55 UTC >= 2011-02-09 12:03:22 UTC and 2010-12-10 13:45:55 UTC <= 2011-02-17 11:28:03 UTC"
<ceej>
the dates are ruby date objects
Aaton is now known as Aaton_off
<banisterfiend>
i can tell by your eyes that u've probably being crying for-ever
<ceej>
me?
verbad has quit []
<ceej>
lol… anyone? would love to go to bed before 2 am :)
<bnagy>
maybe if you made your question less passive agressive and vague
iamjarvo has quit [Quit: Computer has gone to sleep.]
<ceej>
maybe I shouldn't have started listing to "A Soundtrack for Coding: the 2am session by Joanna Butler'
<jumpingcloud>
hey im trying to send a string to stdin. but im having problems.
<bnagy>
jumpingcloud: silly rabbit, stdin is for input
goraxe has quit [Read error: Connection reset by peer]
apeiros_ has joined #ruby
<ceej>
bnagy what is vague? "2010-12-10 13:45:55 UTC >= 2011-02-09 12:03:22 UTC and 2010-12-10 13:45:55 UTC <= 2011-02-17 11:28:03 UTC" is coming back as true (the dates are http://www.ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/DateTime.html) I just printed what the if statement is as a string so you could see
a_a_g has joined #ruby
<bnagy>
ceej: well it works correctly for me
<jumpingcloud>
bnagy: but i want to send a password to ssh how would i work that one out?
<ceej>
2010-12-10 13:45:55 UTC is not greater or equal to 2011-02-09 12:03:22 UTC so it should be false....
<bnagy>
so either your objects aren't what you think they are, or you're misrepresenting your code
goraxe has joined #ruby
<ceej>
I'm not….
<ceej>
one se
<ceej>
c
<bnagy>
and by passive aggressive I mean yes, clearly 2010 is not greater or equal to 2011
<bnagy>
so you're implying that ruby just handles dates completely wrong, which is not the case
<bnagy>
so yeah, try gist / pastie some actual code :)
billiamii has quit [Read error: Connection reset by peer]
<apeiros_>
btw., file.dtcreated.between?(start_date, end_date) can be used too
ananthakumaran has joined #ruby
<ceej>
ah didn't know about that… ty :)
<apeiros_>
ok, I'd say those results are correct, no? 2010 is not >= 2011, and 2010 is <= 2011
<apeiros_>
so the problem is not with <= and >=
<ceej>
correct but false && true is == true because it's returning a result...
tatsuya_o has joined #ruby
<apeiros_>
certainly false && true is not == true
_bart has quit [Quit: _bart]
<ceej>
right...
<apeiros_>
I'd replace `and` with `&&` in `file.dtcreated >= start_date and file.dtcreated <= end_date`
sgronblom has joined #ruby
<ceej>
I replaced it with file.dtcreated.between? start_date, end_date same result
<apeiros_>
brb
<ceej>
k
foolovely has quit [Quit: Leaving]
wallerdev has quit [Quit: wallerdev]
nari has quit [Ping timeout: 248 seconds]
jimeh has joined #ruby
td123 has quit [Ping timeout: 244 seconds]
tatsuya_o has quit [Remote host closed the connection]
krz has quit [Quit: krz]
akem has quit [Ping timeout: 246 seconds]
workmad3 has joined #ruby
spinagon has joined #ruby
<ceej>
so I was checking if the length of matches was > than 1… and it was passing. the reason is it creates and empty record inside [[0] []]…. any reason why that code would do that?
dhruvasagar has joined #ruby
mockra has joined #ruby
<ceej>
was >= *
zodiac1111 has joined #ruby
andrewjf has quit [Quit: Lost terminal]
<ceej>
I guess it's something to do with using << as += works how I expect
franckverrot has quit [Quit: Connection closed for inactivity]
rippa has quit [Ping timeout: 244 seconds]
und3f has joined #ruby
<ceej>
would be interested to know why that is
mathie has joined #ruby
codezombie has joined #ruby
mockra has quit [Ping timeout: 244 seconds]
EricKamsky_ has joined #ruby
EricKamsky has quit [Read error: Connection reset by peer]
kjellski has joined #ruby
mxweas has quit [Quit: Leaving...]
Hien has joined #ruby
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
chichou has joined #ruby
ryanf has quit [Quit: leaving]
workmad3 has quit [Ping timeout: 244 seconds]
jarred has quit [Quit: jarred]
tatsuya_o has joined #ruby
ph^ has joined #ruby
aganov has joined #ruby
bnagy has quit [Remote host closed the connection]
hoelzro|away is now known as hoelzro
<hoelzro>
ceej: << appends to the current object; += creates a new object and assigns it, iirc
rvmeier has quit [Quit: Saliendo]
<ceej>
so << would add an empty object but += would because if it's empty it won't create anything?
savage- has quit [Remote host closed the connection]
Rochefort has joined #ruby
TPFC-SYSTEM has joined #ruby
NimeshNeema has quit [Quit: Connection closed for inactivity]
jeff_sebring has joined #ruby
tatsuya_o has quit [Remote host closed the connection]
aces1up has joined #ruby
dangerousdave has joined #ruby
me has joined #ruby
me is now known as Guest52301
Thomas is now known as thomas
tatsuya_o has joined #ruby
piotr_ has joined #ruby
<Hanmac>
ceej wrong, your code will add an empty array
andrewhl has quit [Remote host closed the connection]
jumpingcloud has quit [Ping timeout: 252 seconds]
apok has quit [Quit: apok]
cloud|office has quit [Ping timeout: 255 seconds]
thecreators has joined #ruby
jumpingcloud has joined #ruby
ph^ has quit [Remote host closed the connection]
cezar has joined #ruby
cezar has quit [Client Quit]
yxhuvud has joined #ruby
nyuszika7h has quit [Read error: Connection reset by peer]
Eldariof-ru has joined #ruby
tiripamwe has quit [Ping timeout: 255 seconds]
maletor has quit [Quit: Computer has gone to sleep.]
<apeiros_>
ceej: Array#<< and += don't do the same thing
<apeiros_>
ceej: compare: a = [1,2,3]; a << [4,5]; a # => [1,2,3,[4,5]]
tatsuya_o has quit [Remote host closed the connection]
pdelgallego has joined #ruby
<apeiros_>
vs. a += [4,5]; a # => [1,2,3,4,5]
jprovazn_away is now known as jprovazn
<apeiros_>
also with a << b --> x = a.object_id; a << b; x == a.object_id # => true -- the object is mutated in-place
<apeiros_>
with a += b --> x = a.object_id; a += b; x == a.object_id # => false -- a *new* object is created and assigned to a
<apeiros_>
it's crucial to understand those things
dangerousdave has quit [Quit: Leaving...]
Liothen has quit [Remote host closed the connection]
akem has quit [Ping timeout: 244 seconds]
<Hanmac>
ceej you may look for array.push
Bofu2U has quit [Read error: Connection reset by peer]
ceej has quit [Quit: Leaving.]
Bofu2U has joined #ruby
jesly__ has joined #ruby
imami|afk is now known as banseljaj
banisterfiend` has joined #ruby
cloud|office has joined #ruby
shiki has joined #ruby
justsee is now known as justsee|away
<apeiros_>
Hanmac: push and << are (mostly) the same
banisterfiend has quit [Ping timeout: 246 seconds]
elhu has joined #ruby
<apeiros_>
the only difference is that push accepts multiple arguments
<apeiros_>
+= is closer to Array#concat than to push
lldong has quit [Remote host closed the connection]
lldong has joined #ruby
baphled has joined #ruby
Hien has quit [Quit: Lost terminal]
cantonic has joined #ruby
BiHi has joined #ruby
<Hanmac>
apeiros_ array.push(*otherarray.select {}) try this with <<
beha has joined #ruby
lldong_ has joined #ruby
Hien has joined #ruby
sendoushi has joined #ruby
tiripamwe has joined #ruby
timonv has joined #ruby
<apeiros_>
Hanmac: as said, that's the only difference
cantonic has quit [Client Quit]
<apeiros_>
Hanmac: `09:50 apeiros_: the only difference is that push accepts multiple arguments `
<apeiros_>
Hanmac: also, instead of array.push(*args) you should use array.concat(args)
justsee|away is now known as justsee
tvw has joined #ruby
lldong has quit [Ping timeout: 276 seconds]
lldong_ is now known as lldong
pdelgallego has quit [Read error: Connection reset by peer]
_bart has joined #ruby
tvw has quit [Remote host closed the connection]
akem has joined #ruby
lldong has quit [Remote host closed the connection]
lldong has joined #ruby
affix has quit [Ping timeout: 260 seconds]
akem has quit [Max SendQ exceeded]
elhu has quit [Ping timeout: 252 seconds]
sendoushi has quit [Remote host closed the connection]
elhu has joined #ruby
akem has joined #ruby
Markvilla has joined #ruby
khakimov has joined #ruby
igotnolegs has quit [Quit: Computer has gone to sleep.]
fivetwentysix has joined #ruby
pdelgallego has joined #ruby
lldong_ has joined #ruby
lldong has quit [Ping timeout: 246 seconds]
lldong_ is now known as lldong
cpruitt_ has joined #ruby
etehtsea has joined #ruby
niklasb has joined #ruby
cpruitt has quit [Ping timeout: 250 seconds]
cpruitt_ is now known as cpruitt
Draco___ has joined #ruby
Draco_ has quit [Ping timeout: 246 seconds]
<_bart>
by doing a queue in a resque job before a Raise DontPerform, the job will be added to the back of the queue right?
stefanp has joined #ruby
stefanp has quit [Changing host]
stefanp has joined #ruby
cantonic has joined #ruby
chriskk has quit [Quit: chriskk]
cantonic has quit [Remote host closed the connection]
cantonic has joined #ruby
dhruvasagar has quit [Ping timeout: 244 seconds]
dhruvasagar has joined #ruby
Speed has joined #ruby
D4T has joined #ruby
Hien has quit [Quit: Lost terminal]
Hien has joined #ruby
fabrice31 has quit [Ping timeout: 264 seconds]
charliesome has joined #ruby
bigkm has quit [Ping timeout: 244 seconds]
Speed has quit [Ping timeout: 252 seconds]
JohnBat26 has joined #ruby
akem has quit [Read error: Connection reset by peer]
bigkm has joined #ruby
akem has joined #ruby
cloud|office has quit [Read error: Connection reset by peer]
Speed has joined #ruby
Speed has quit [Changing host]
Speed has joined #ruby
werdnativ has quit [Quit: werdnativ]
<shevy>
if I have a file called "foo.rb", and this file has no module namespacing. Is it possible to load that code into a module, and have it reside in that?
workmad3 has joined #ruby
manizzle has quit [Read error: No route to host]
tonini has quit [Remote host closed the connection]
headius has joined #ruby
headius has quit [Client Quit]
<yxhuvud>
shevy: yes, you can always load the text and eval it wherever you want.
<kjellski>
When I use CGI.excape("Küche"), this is printed as K%C3%BCche, but when I use this to be joined with '+' in an url, why is it converted to K\\xC3\\xBCche ???
<kjellski>
the % is encoded another time?
DarthGandalf has joined #ruby
shiki has quit [Remote host closed the connection]
Progster has quit [Ping timeout: 244 seconds]
<heftig>
kjellski: i can't reproduce that
<kjellski>
heftig: sorry… I just saw it was encoded by csv in the first place… do you know an encoding option for the csv gem?
<heftig>
no
nu7hatch has joined #ruby
g0rd0n has joined #ruby
nmarques has joined #ruby
<nmarques>
anyone can help me with a small issue building ruby
berserkr has quit [Quit: Leaving.]
pskosinski has joined #ruby
<Tasser>
is there a way for Array#- without the set part?
<Tasser>
aka I'd like it not to uniq, rather remove one from the left side per item on the right one
federic has joined #ruby
BiHi has quit [Quit: Computer has gone to sleep]
venkatk_ has joined #ruby
<Spooner>
tasser: I think => a.delete_if {|e| b.delete e }
nmarques has left #ruby ["Leaving"]
<Spooner>
a = [1, 1, 2, 3]; b = [1, 2]; a.delete_if {|e| b.delete e } #=> [1, 3]
<workmad3>
Tasser: so items_to_delete.each {|i| ary.delete_at(ary.index(i))}
<Spooner>
Ah yeah, better.
justsee|away is now known as justsee
dhruvasagar has quit [Ping timeout: 246 seconds]
<Tasser>
workmad3, from the numbers, it works as expected
<workmad3>
Tasser: you need to handle the case of the item you want to delete not existing though
<workmad3>
Tasser: because index returns nil at that point, and delete_at(nil) throws a conversion error
<apeiros_>
lut = Hash.new(0); items_to_delete.each do |e| lut[e] += 1 end; (ary.length-1).downto(0) do |i| if lut[i] > 0; lut[i] -= 1; ary.delete_at(i); end end
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
<Tasser>
workmad3, won't happen
<workmad3>
Tasser: cool, always good when you don't need to handle that :)
<apeiros_>
O(n) instead of O(n*m). don't know whether it's worth it.
<Tasser>
workmad3, I'd add a rescue nil and a compact :-)
<Tasser>
it's a small scripty after all
<Tasser>
apeiros_, I'll run it on the server if it's too slow for my machine
<workmad3>
apeiros_: :)
<workmad3>
apeiros_: wait... I'm not sure that works
Rochefort has joined #ruby
<apeiros_>
workmad3: it's probabilistic. whether it works is determined at the time of observation…
<Tasser>
apeiros_, huh?
<workmad3>
apeiros_: heh
<apeiros_>
what's your doubt?
<workmad3>
apeiros_: items_to_delete doesn't contain the indices of the items you want to delete
monkegjinni has joined #ruby
<workmad3>
apeiros_: but that's what you're then using them as in the second loop
<apeiros_>
workmad3: I don't use it that way
<Tasser>
workmad3, the items itself are the indices, it's a hash
<apeiros_>
workmad3: na, items_to_delete is the array with the items to delete. ary is the array from which to delete.
<workmad3>
apeiros_: yes, I kunderstand that
<apeiros_>
I iterate over ary in reverse order
<apeiros_>
and delete at the current index if the item is to be deleted
<workmad3>
d'oh, yeah, sorry
<Tasser>
apeiros_, why the reverse order?
<apeiros_>
because deletion changes index
<workmad3>
apeiros_: actually, no, I am right
<apeiros_>
but that means items are deleted from the right side :(
<workmad3>
apeiros_: lut[i] looks up in the hash using the index, not the item
<apeiros_>
workmad3: ah, lut[i] is wrong, yes
<workmad3>
apeiros_: you need to do a reversed each_with_index
<apeiros_>
lut = Hash.new(0); items_to_delete.each do |e| lut[e] += 1 end; (ary.length-1).downto(0) do |i| e=ary.at(i); if lut[e] > 0; lut[e] -= 1; ary.delete_at(i); end end
<workmad3>
apeiros_: :)
<apeiros_>
now if you want to delete from the left, you'll have to change the algorithm :-/
elhu has quit [Ping timeout: 276 seconds]
<workmad3>
apeiros_: wondering... why ary.at(i) instead of just ary[i]? :)
sgronblom has quit [Ping timeout: 246 seconds]
<workmad3>
but yeah, O(n+m) (so O(N) ) instead of O(n*m) :)
elhu has joined #ruby
<workmad3>
but more memory used and not as easy to follow...
<apeiros_>
workmad3: ary.at(i) is *slightly* faster. it doesn't have to check the argument count & type
Simon2 has joined #ruby
<workmad3>
apeiros_: hmm, interesting
sixteneighty has joined #ruby
<Mon_Ouie>
That's why I like Smalltalk-like method names better: instead of writing code to parse your arguments, different methods will be called
<workmad3>
apeiros_: again though... not sure your monkey-patchs work quite right... remove only gives you back an array of items you want to be removed, and remove! will change your array to be the items you wanted to remove...
<apeiros_>
Mon_Ouie: is that the part which objC copied?
<Mon_Ouie>
Yeah
<apeiros_>
workmad3: gah
ZachBeta has quit [Quit: Computer has gone to sleep.]
<workmad3>
apeiros_: there aren't ! versions of delete btw... they always modify in place :)
<apeiros_>
of course, with this changed one, the << must be in the else
<Mon_Ouie>
Unless you mean, explicitly specifying the class of every argument like Cocoa does (like componentsSeperatedByString: instead of split:)
<workmad3>
apeiros_: ah, good point... and yeah, that works now :)
danielpunt has quit [Remote host closed the connection]
<apeiros_>
and now with spaces instead of tabs, too
arietis has joined #ruby
<workmad3>
Mon_Ouie: I have to admit, I do miss polymorphic method calls from C++ and java at times
fivetwentysix has quit [Quit: fivetwentysix]
<apeiros_>
Mon_Ouie: I've mixed feelings about that
<apeiros_>
somehow I like the idea
<apeiros_>
somehow I'm not sure. I'd probably have to use a language which does that for a while to meaningfully judge it
sgronblom has joined #ruby
dhruvasagar has joined #ruby
vectorshelve has quit [Quit: Page closed]
kevinbond has joined #ruby
Criztian has quit []
nyuszika7h has quit [Quit: Here we are, going far to save all that we love - If we give all we've got, we will make it through - Here we are, like a star shining bright on your world - Today, make evil go away!]
blacktulip has quit [Ping timeout: 252 seconds]
jjang has quit [Remote host closed the connection]
k_89 has quit [Ping timeout: 255 seconds]
a_a_g has quit [Quit: Leaving.]
monkegjinni has quit [Remote host closed the connection]
kevinbond has quit [Quit: kevinbond]
bullicon has quit [Quit: Computer has gone to sleep.]
Speed has quit [Remote host closed the connection]
k_89 has joined #ruby
kvirani has joined #ruby
<_bart>
Will the Redis database empty itself after reboot?
awarner has joined #ruby
gryllida is now known as gry
Simon3 has joined #ruby
awarner has quit [Remote host closed the connection]
<Tasser>
_bart, does this look like a redis channel?
<banisterfiend`>
Tasser: hey
Simon2 has quit [Ping timeout: 255 seconds]
stefano_ has left #ruby [#ruby]
<Tasser>
banisterfiend`, got some bullshit for me? need to add some more text to this paper here
<banisterfiend`>
Tasser: what's the topic
davidpk has joined #ruby
baphled has quit [Ping timeout: 246 seconds]
baphled has joined #ruby
<Tasser>
banisterfiend`, bacon
<Tasser>
ehh, natural language processing
<banisterfiend`>
Tasser: there's videos on that topic on coursera
<banisterfiend`>
probably all u need
<kjellski>
what is the best way in ruby to log onto a website and authenticate with username and password in order to then process pages with nokogiri that need the authentication?
<Tasser>
banisterfiend`, this is pretty specific
yekta has quit [Quit: yekta]
<Tasser>
kjellski, mechanize
<Tasser>
kjellski, if it's too much work, curb
<kjellski>
Tasser: I'll just look them up, thanks a lot for the hint
mathie has quit [Quit: Sleeping...]
indian has joined #ruby
indian has quit [Changing host]
indian has joined #ruby
<Tasser>
kjellski, err, mechanize is more for consecutive, curb for single requests
<kjellski>
Tasser: I see it right now… =) thanks
<banisterfiend`>
indian: hey, ltns
pskosinski has quit [Ping timeout: 244 seconds]
<indian>
hey banisterfiend`
<indian>
still watching those Indian clips on youtube
<banisterfiend`>
indian: i turned into one, now i'm an indian clip on youtube watching myself typing stuff on irc to u
<indian>
lol
dhruvasagar has quit [Ping timeout: 246 seconds]
dhruvasagar has joined #ruby
Progster has joined #ruby
baphled has quit [Ping timeout: 255 seconds]
uris has joined #ruby
<shevy>
lol
nyuszika7h has joined #ruby
<shevy>
banister is bored a lot these days
ZachBeta has joined #ruby
mathie has joined #ruby
Markvilla has quit [Quit: Markvilla]
strife25 has joined #ruby
monkegjinni has quit [Remote host closed the connection]
<habib>
hey. i'm trying to install ruby from source?
<Tasser>
habib, why would you?
<habib>
i've downloaded a source of ruby and don't know how to install it
cloud|office has quit [Read error: Connection reset by peer]
<habib>
why wouldn't i?))))
BiHi has joined #ruby
<workmad3>
habib: rvm or ruby-build are your friends
<habib>
workmad3, thnx i'll try)
erichmenge has joined #ruby
<kalleth>
\o~
<kalleth>
workmad3: rbenv?
uris has quit [Read error: Connection reset by peer]
uris has joined #ruby
<shevy>
anyone adding a lot of comments to his ruby code?
<shevy>
habib, what is the name of the thing you downloaded
<shevy>
"bla-something" <-- what is that name
Simon3 has quit [Ping timeout: 246 seconds]
iamjarvo has joined #ruby
<workmad3>
kalleth: rbenv doesn't build ruby
<habib>
shevy, ruby-1.9.3-p194
<habib>
tar.gz
<apeiros_>
shevy: on serious projects I think I have about half as much comments as code
tommyvyo has joined #ruby
pskosinski has joined #ruby
<shevy>
habib ok "tar zxvf ruby*tar.gz", then "cd ruby*", then try "./configure --prefix=/usr" or use another prefix if you want to
<shevy>
apeiros_, whoa, that's a lot
NimeshNeema has joined #ruby
<JonnieCache>
thats into the territory of writing the documentation in the source though, so its kinda different
<kalleth>
workmad3: oh, right
<shevy>
well I find myself write more and more comments, but in a strange way
<shevy>
def foo
<shevy>
cleanup # Must do cleanup here, else the successive methods would fail
<shevy>
feed_the_cat
<shevy>
end
<workmad3>
shevy: that's not strange... comments should give why you're doing something IMO
<workmad3>
shevy: I'll add comments like that when I can't make it clear in plain code why I'm doing something :)
<kjellski>
Tasser: Thanks for mentioning mechanize, I've been able to login to the page. Is it possible to then just use the same agent to directly visit another page under the same domain, and if so how? Am I missing a visit method or something?
<Tasser>
j
<kjellski>
Tasser: is j the method?
<Tasser>
kjellski, ehh
blacktulip has joined #ruby
<kjellski>
Tasser: that was a vim command right? ^^
<Tasser>
kjellski, the enter isn't
niklasb has joined #ruby
<kjellski>
Tasser: ;)
ZachBeta has quit [Quit: Computer has gone to sleep.]
strnx has quit [Excess Flood]
<habib>
shevy, what is zxvf?
strnx has joined #ruby
<shevy>
habib options given to the program "tar"
<canton7>
flags to tar. z = archive is compressed with gzip. x = extract. v = verbose. f = the next argument is the archive to extract
<habib>
shevy, lol ok)))
<habib>
shevy, when "./configure" do i need sudo?
<Tasser>
habib, you shouldn't
<habib>
ok thnx
<habib>
ok i did it
<habib>
now i'm trying ruby-v
<shevy>
habib sudo is only needed during "make install"
<habib>
and it says no such file or directory
<shevy>
but I pasted a longer "./configure" line ;)
<shevy>
yes
<shevy>
after "configure" comes "make" then "make install"
<habib>
canton7, thnx
<shevy>
but ensure that configure gave you no error
bullicon has joined #ruby
<habib>
how to ensure it?
<habib>
read terminal out?
<shevy>
well, if there would be an error
<shevy>
yeah
JustinCampbell has quit [Remote host closed the connection]
<shevy>
if there would be an error, it would tell you on the terminal
<shevy>
if not, then usually there is no error. 95% chance for that then :P
<shevy>
then do "make"
JustinCampbell has joined #ruby
<habib>
it's ok. no errors
<shevy>
this will give you the ruby binary in the current directory (or in bin/ subdirectory there)
<banisterfiend`>
habib: what language were u speaking here: ыешдд сщьзшдштп
<Muz>
That looks like an attempt to write English with a Russian keymap.
<banisterfiend`>
Muz: you're russian?
<Muz>
No.
tommyvyo has joined #ruby
Poapfel has quit [Ping timeout: 245 seconds]
<shevy>
I could not even read those characters
<shevy>
habib sounds arabic :)
<Muz>
They're all cyrillic.
Jay_Levitt has joined #ruby
<Muz>
"Yesdd cshbzsdstp"
<Muz>
I think. Been a while since I last tried learning the cyrillic alphabet for transliteration purposes.
<shevy>
Muz Muz Muuuuuuuuuuuuuz!
<Muz>
Hm?
sailias has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
<shevy>
just having fun :)
nwest has joined #ruby
lldong has quit [Remote host closed the connection]
lldong has joined #ruby
<habib>
it was russian)
Guest4802 is now known as Jackneill
Jackneill has quit [Changing host]
Jackneill has joined #ruby
<habib>
so. it's made
<Muz>
Useless trivia: Russian's often type smileys without "eyes" because a colon is a pain in the arse to produce from a russian keymap.
<habib>
what then
<Muz>
Argh, superfluous apostrophe.
Petit_Dejeuner has joined #ruby
<habib>
when we type english we use the same keymap like u do
<habib>
so no sense
<Muz>
Cultural, and habitual hangover.
<habib>
just used to type smiles that way cos more emotional mustbe
<shevy>
habib well. you could do "make install"
<habib>
ok
<shevy>
that will install or rather copy the files to the --prefix option you gave
<shevy>
or "sudo make install2
<shevy>
or "sudo make install"
<shevy>
damn keyboard fail today
<shevy>
or, you could run it directly in the directory
<habib>
result is "make: *** [do-install-all] error 1"
<shevy>
like via ./bin/irb or bin/irb
<habib>
ruby - v => no such file etc
<shevy>
I dont see the error there
<shevy>
no
<shevy>
it is
<habib>
ruby -v
<shevy>
ruby -v
<habib>
yeah
<shevy>
and it works only if ruby is in your $PATH
<shevy>
try: bin/ruby -v
<habib>
same
fbernier has joined #ruby
cousine has joined #ruby
<habib>
shevy, bts where to look for it
<Petit_Dejeuner>
weird, does irb work?
jrajav has joined #ruby
<habib>
btw
<shevy>
habib did "make" finish without errors?
<habib>
yeah it did
<habib>
and make install did with error 1
<shevy>
can you use pastie.org, 10 lines from the error "make install"
<habib>
Petit_Dejeuner, and no irb
<habib>
yeah
<shevy>
if "make" finished, then you must have ruby and irb in bin/ habib
MikeWorth has joined #ruby
<banisterfiend`>
habib: In English layout in order to type a ";" you press "Shift+;". In Russian layout you press "Shift+6". You can often see Russians typing like this: "haha, funny joke)))))", where ")))))" part means retarded smilies.
<MikeWorth>
I'm trying to use readline to read to the first instance of either a space or a newline; it doesn't appear to support regexp, is there a way to do this?
<habib>
yeah but here i'm typing in english not russian
bluOxigen has quit [Read error: Connection reset by peer]
<hoelzro>
MikeWorth: could you just put the terminal in raw mode, and read a key at a time?
<habib>
so i need to do this with sudo?
<shevy>
your current user profile has not enough permission to do this action habib
<JonnieCache>
make install usually needs sudo
<shevy>
habib, that would be one way. or become superuser and go wild :D
yekta has joined #ruby
<habib>
now that's worked with sudo
<MikeWorth>
hoelzro: I'm reading tcp data from rsyslog using the relp protocol; I can't dictate what will be sent, only how I read it
<JonnieCache>
either that or rerun ./configure with a --prefix that you can write to
<shevy>
and "ruby -v" works now?
<Petit_Dejeuner>
mikalv, is there a ruby version of getchar()?
<habib>
thnx for all))))))
<habib>
yeah ruby -v worked
<shevy>
he did those ) smileys
<shevy>
:P
<habib>
haha
yekta has quit [Client Quit]
linoj has joined #ruby
<shevy>
well, good!
<shevy>
you could even install into your $HOME dir, then you would not need to use sudo
<habib>
yeah i did. when we type ":)" it means a smile and when "))))))))" it means happiness gladness and so on)))
<hoelzro>
MikeWorth: so you're not reading from a terminal, but from a socket?
<MikeWorth>
hoelzro: yes, the class is TCPSocket
xorgnak has quit [Remote host closed the connection]
<hoelzro>
MikeWorth: can't you read a character at a time from it?
k_89 has quit [Ping timeout: 250 seconds]
<MikeWorth>
hoelzro: so manually read characters one at a time and assemble the string manually?
<Petit_Dejeuner>
Sounds ineffecient, maybe keep a list of characters?
<Petit_Dejeuner>
Wait, I'm thinking in Java
<Petit_Dejeuner>
ignore me
<Petit_Dejeuner>
Strings are mutable so it wouldn't matter, right?
<JonnieCache>
yep
<hoelzro>
MikeWorth: yeah
Markvilla has joined #ruby
mdickens has joined #ruby
<MikeWorth>
hmm, ok then. Thanks for your help
sepp2k has quit [Ping timeout: 246 seconds]
sailias has quit [Quit: Leaving.]
MikeWorth has left #ruby ["Leaving"]
devdazed has quit [Quit: Bye]
Gavilan has left #ruby [#ruby]
mvangala has joined #ruby
und3f has joined #ruby
lorandi has joined #ruby
verbad has joined #ruby
noyb has quit [Quit: Leaving.]
hoelzro is now known as hoelzro|away
mvangala_ has quit [Read error: Connection reset by peer]
jgarvey has joined #ruby
prateekp has joined #ruby
<prateekp>
i have got html content of wikipedia page ... and also the ruby command that generated that content ... now if i embed this ruby code in an html file will that prints out the whole html code
flype has joined #ruby
Berglund has joined #ruby
qko_ has joined #ruby
<banisterfiend`>
prateekp: wtf is up with yoru nickname
<prateekp>
why ?
<prateekp>
what ?
<banisterfiend`>
"prateekp" one of the weirdest sounding words i've read in a while
Berglund has quit [Client Quit]
<Petit_Dejeuner>
Says someone named banisterfiend
<JonnieCache>
looks like a transliterated name
<JonnieCache>
indian?
flype has quit [Client Quit]
flype has joined #ruby
sspiff has quit [Read error: Connection reset by peer]
<prateekp>
yes indian
<prateekp>
i have got html content of wikipedia page ... and also the ruby command that generated that content ... now if i embed this ruby code in an html file will that prints out the whole html code
sspiff has joined #ruby
jhunter has quit [Ping timeout: 264 seconds]
blast_hardcheese has quit [Ping timeout: 264 seconds]
xorspark has quit [Ping timeout: 264 seconds]
jhunter has joined #ruby
qko has quit [Ping timeout: 264 seconds]
xorspark has joined #ruby
kpshek has joined #ruby
dv310p3r has joined #ruby
<prateekp>
i have got html content of wikipedia page ... and also the ruby command that generated that content ... now if i embed this ruby code in an html file will that prints out the whole html code
<prateekp>
what is html_safe
<JonnieCache>
thats rails' xss protection
federic has quit [Remote host closed the connection]
<kalleth>
prateekp: <%= raw my_variable_containing_html_code %> will use the raw html
leoncamel has joined #ruby
<kalleth>
if you don't want it turning < into < etc
<kalleth>
:)
<kalleth>
wait
<kalleth>
i see no mention of rails
* kalleth
goes back to sleep
daniel_hinojosa has joined #ruby
jrist-afk is now known as jrist
deryl has quit [Read error: Connection reset by peer]
fermion has quit [Quit: P]
manolo has joined #ruby
davidpk has quit [Quit: Computer has gone to sleep.]
deryl has joined #ruby
blast_hardcheese has joined #ruby
stoffus has quit []
chussenot_ has quit [Quit: chussenot_]
hoelzro|away is now known as hoelzro
kvirani has quit [Remote host closed the connection]
chussenot_ has joined #ruby
bbttxu has joined #ruby
ryannielson has joined #ruby
nateberkopec has joined #ruby
krusty_ar has joined #ruby
linoj_ has joined #ruby
kiela has joined #ruby
axl_ has joined #ruby
milestone has joined #ruby
<milestone>
hi is module Streamline included in rails now, or is that a framework on top of rails? I have googled, but only found references to streamlinedframework.org, but that is no longer maintained ...
davidpk has joined #ruby
linoj has quit [Ping timeout: 246 seconds]
linoj_ is now known as linoj
arturaz has quit [Ping timeout: 246 seconds]
uris has quit [Quit: rails]
krusty_ar has quit [Read error: Operation timed out]
krusty_ar has joined #ruby
mrFrog has joined #ruby
reuf has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
mucker has joined #ruby
fermion has joined #ruby
samuel02 has joined #ruby
justsee is now known as justsee|away
<Tasser>
milestone, #rubyonrails
reuf has quit [Client Quit]
samuel02 has quit [Remote host closed the connection]
JustinCampbell has quit [Remote host closed the connection]
JustinCampbell has joined #ruby
lldong_ has joined #ruby
mrFrog has left #ruby [#ruby]
minijupe has joined #ruby
canton7 has quit [Remote host closed the connection]
mneorr has joined #ruby
joshman_ has joined #ruby
lldong has quit [Ping timeout: 246 seconds]
lldong_ is now known as lldong
bowlowni has joined #ruby
<milestone>
Tasser: thx
andrewhl has joined #ruby
lldong has left #ruby [#ruby]
pdelgallego has quit [Read error: Connection reset by peer]
<nooodl>
thinking up a method name was much tougher than writing the method to be honest
Jackneill has quit [Quit: Jackneill]
julio has quit [Ping timeout: 276 seconds]
Progster has quit [Ping timeout: 272 seconds]
<JonnieCache>
there are only two hard problems in computer science: cache invalidation, and naming things
<JonnieCache>
all other hard problems can be reduced to instances of those two
mockra has quit [Remote host closed the connection]
prateekp has quit [Ping timeout: 245 seconds]
swills has joined #ruby
<burgestrand>
JonnieCache: there are two hard problems in computer science: cache invalidation, naming things and off-by-one errors.
<nooodl>
i'm googling "cache invalidation" but all i'm finding is that quote. huh
<JonnieCache>
really?
<JonnieCache>
cache invalidation is deciding when to throw something out of cache
<JonnieCache>
and its hard
<JonnieCache>
or rather, deciding what to throw out at any given time
swills has left #ruby [#ruby]
jprovazn has quit [Remote host closed the connection]
vipulnsward has joined #ruby
jjbohn has joined #ruby
devdazed has joined #ruby
axl_ has quit [Read error: Connection reset by peer]
jprovazn has joined #ruby
verto is now known as verto|off
axl_ has joined #ruby
billiam has joined #ruby
blazes816 has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
hynkle has quit [Quit: Computer has gone to sleep.]
mahmoudimus has joined #ruby
the_jeebster has joined #ruby
lkba has joined #ruby
tagrudev has quit [Quit: Me = Awesome]
aganov has quit [Remote host closed the connection]
bier has quit [Ping timeout: 276 seconds]
strife25 has quit [Quit: Computer has gone to sleep.]
oscardelben has joined #ruby
duder has joined #ruby
duder has quit [Client Quit]
r00t_l00p has joined #ruby
vipulnsward has quit [Quit: Leaving]
<r00t_l00p>
I come from a Java background, and i have been learning Ruby for a month or so, but i need some help when it comes to the OO structure of Ruby, like with classes and instance variables and such. Does anybody know where I could find the answers for my various questions?
<tommylommykins>
Here might be good
<burgestrand>
r00t_l00p: google, here, and possibly a few of the popular ruby books.
<burgestrand>
It’s kind of dependent on what kind of questions you have.
<tommylommykins>
or amybe the ruby-talk mailing-list/forum if not :)
<r00t_l00p>
Alright, so my main question is how do i get instance variables like i have in java?
<burgestrand>
r00t_l00p: you don’t, this is ruby.
<r00t_l00p>
i dont? O_o
<burgestrand>
You don’t! \o/
<burgestrand>
r00t_l00p: well, could you elaborate?
<burgestrand>
r00t_l00p: look upon us as if we don’t know what java is (even though most of us do, some of us very well).
* tommylommykins
doesn't \0/
obryan has joined #ruby
<r00t_l00p>
well, i mean i can make an object in java where i can access certain things about it, like its name (String), or other things like that
jbw has quit [Ping timeout: 264 seconds]
<burgestrand>
r00t_l00p: where does it get it’s name from?
TPFC-SYSTEM has left #ruby [#ruby]
<r00t_l00p>
I can just say stuff like "public static String name();", and then set the name later
<burgestrand>
r00t_l00p: that pastie is the basics of how you add properties to objects in ruby
PaciFisT has joined #ruby
<tommylommykins>
mm, the page I linked shows the common shortcut way of doing it
br4ndon has joined #ruby
<r00t_l00p>
burgestrand: thanks!!!! that should help a lot :)
<burgestrand>
different to many other languages, you don’t define them before you create the object, and as such you cannot set their values before you create the object either
<burgestrand>
r00t_l00p: ^
i0n has joined #ruby
<burgestrand>
because, before the object exists, it has no instance variables either
bier has joined #ruby
<r00t_l00p>
ohhhhh, that makes sense, i never thought of that before...
jesly__ has quit [Ping timeout: 246 seconds]
<burgestrand>
r00t_l00p: also, ruby does not have static functions like you’re used to in Java, but we have something that is very similar and for most purposes the same thing
<r00t_l00p>
I just used statics because they worked, btw im a freshman in highschool, and i dont know a ton about java
<burgestrand>
r00t_l00p: :)
williamcotton_ has joined #ruby
BiHi has quit [Ping timeout: 252 seconds]
<burgestrand>
r00t_l00p: the statics in java are special because you don’t need to create a new object to access them, you can just call them
<burgestrand>
r00t_l00p: my last pastie is something similar, you don’t need to create a thingy with Thingy.new, you can just… Thingy.hello!
geekbri has joined #ruby
<Tasser>
burgestrand, I assume you kind of misunderstood the use of static functions... :-P
blazes816 has quit [Read error: Connection reset by peer]
<r00t_l00p>
that makes sense now :) i just used them because if i dont, i get an error because main() is always static
<burgestrand>
Tasser: I don’t bother too much with details and 100% correctness with newcomers, too many details cloud the point I’m trying to get across :)
<burgestrand>
Tasser: if I were to start speaking of class instances, and that all methods are instance methods, his mind would explode
<r00t_l00p>
Wait, what is the "!' used for? i see it a lot when i type whatever.methods
<Tasser>
burgestrand, OO vs. functional
pdelgallego has quit [Read error: No route to host]
mikepack has joined #ruby
<hoelzro>
r00t_l00p: ! usually indicates a method that is "unsafe"
<burgestrand>
r00t_l00p: in ruby, you can use "!" as part of a name for a method
<hoelzro>
what "unsafe" means is kind of vague, though
<burgestrand>
r00t_l00p: you can also use "?", say door.open?
<Tasser>
r00t_l00p, depends on the context. in ruby, it's "dangerous method" (there are some dangerous methods that aren't marked, like delete*) - dangerous as in they change the object
BiHi has joined #ruby
<r00t_l00p>
hoelzro: its the kidna thing that i would need to throw an exception for in java, right?
<Tasser>
r00t_l00p, in activerecord, it's "throw me an error if things go wrong"
<Tasser>
r00t_l00p, nope
<hoelzro>
r00t_l00p: not exactly
<r00t_l00p>
but the basic idea?
cousine has joined #ruby
<hoelzro>
well, a typical is add/add!
<Tasser>
r00t_l00p, "use with caution"
<tommylommykins>
but just to be clear in foo.method!, the ! is actually part of the method name
pdelgallego has joined #ruby
<tommylommykins>
it's not an operator or anything like that
<hoelzro>
add might add an object to the receiver, and return the result
<Hanmac>
dangerous are only marked with "!" when there is an un-dangerous method too
<hoelzro>
add! might add the object to receiver, mutating it
<r00t_l00p>
BIG WORDS!!!! O.o haha
iamjarvo has joined #ruby
<r00t_l00p>
confusing me a tad, but i can sift through it :)
<burgestrand>
r00t_l00p: usually it’s a good practice to not use "!" if you do not have a method with the same name without "!"
<burgestrand>
(like usual, usually means usually, not always)
<burgestrand>
:p
<r00t_l00p>
burgestrand: so just dont use it unless i know that i need to use it?
<burgestrand>
r00t_l00p: yeah, pretty much, most often you don’t need ! :)
jamiejackson has joined #ruby
strife25 has joined #ruby
<r00t_l00p>
burgestrand: alrighty, gotcha there
indian has quit [Ping timeout: 276 seconds]
<r00t_l00p>
in your pasties, you made classes, and is that the same kinda structure i should use with making classes of my own?
areil has quit [Remote host closed the connection]
<burgestrand>
r00t_l00p: I just did you a template, not the solution :)
<r00t_l00p>
burgestrand: ohh, i just wrote my own :)
* tommylommykins
chuckles
<burgestrand>
r00t_l00p: the Koans is good if you just want something to try ruby with
<JonnieCache>
array.inject(:+)
<i0n>
anyone here came from perl? is there anything like $_ in ruby?
<burgestrand>
personally I find them a bit confusing
<burgestrand>
i0n: what is $_?
crankycoder has joined #ruby
verbad has quit []
<tommylommykins>
it's mnost likely the same in ruby?
<tommylommykins>
I thought most of the dollar-variables are copied directly from perl
<burgestrand>
Yeah, they’re perlisms
<r00t_l00p>
the Koans is like RubyMonk
<hoelzro>
i0n: I don't behave $_ is there
<hoelzro>
$_ is the "default variable" in Perl
<i0n>
yea
tk__ has quit [Quit: ばいばい]
<i0n>
okay so I have a method that finds a bunch of files and puts them into an array.. I need another method that zips up each file in this array. how would you call each file into the zipup method?
andrewhl has quit [Remote host closed the connection]
<burgestrand>
r00t_l00p: hehe :)
<r00t_l00p>
:)
<burgestrand>
r00t_l00p: now try using Array#each or Array#reduce
jbohn has joined #ruby
<burgestrand>
r00t_l00p: it’d be the more idiomatic approach, i.e. what most rubyists would try with
br4ndon has joined #ruby
<r00t_l00p>
burgestrand: thats a trip to the api docs..
<burgestrand>
r00t_l00p: oh, by Array#each I mean using the "each" instance method of array
<burgestrand>
r00t_l00p: indeed :)
<tommylommykins>
mmm, as a related sidenote, you don't often need to access elements of an array by their index
Emmanuel_Chanel has quit [Quit: Leaving]
ckrailo has joined #ruby
<fowl>
ruby is good for its numerous metalprogramming abilities. ruby has the power of telekinesis which it uses to move objects. ruby has the power of super strength which is used for moving boulders. ruby can fly faster than the speed of light and have mastery over time and space
strnx has quit [Excess Flood]
bluOxigen has quit [Read error: Connection reset by peer]
bluOxigen has joined #ruby
<burgestrand>
r00t_l00p: avoid the example of Array#reduce (actually Enumerable#reduce), it contains the solution :p
<r00t_l00p>
burgestrand: and i did not copy and paste from the api docs :)
tewecske has joined #ruby
_justin has quit [Ping timeout: 244 seconds]
pdelgallego has joined #ruby
pdelgallego has quit [Client Quit]
<burgestrand>
r00t_l00p: inject is a bit special, but you could ask yourself why you have two three mentions of sum
<burgestrand>
hehe, two three :)
sebastorama has joined #ruby
<burgestrand>
r00t_l00p: mainly thinking about line #2, versus { |sum, x| … }
TorpedoSkyline has joined #ruby
<banisterfiend`>
burgestrand: burg, do u like the stabby lambda
<r00t_l00p>
burgestrand: haha, but im guessing that the reason that it didnt add the last number is because of the difference in the curly brackets, right?
<r00t_l00p>
not the inject method itself
<r00t_l00p>
nvm, that made no sense
<r00t_l00p>
:P
<burgestrand>
r00t_l00p: yeah, it’s a difference in how inject behaves in the first iteration :)
<burgestrand>
r00t_l00p: and local vs. block variables
<shevy>
cool... first time I managed to compile gtk3 from source myself
<burgestrand>
r00t_l00p: { |sum, x| … } both sum and x here are block variables, they are alive only for the duration of the block
<r00t_l00p>
burgestrand: do block variables have any java cousins?
<burgestrand>
r00t_l00p: however, in line #2 you also define a local variable, sum = 0
<burgestrand>
banisterfiend`: I don’t find many uses for it D:
Morkel has quit [Quit: Morkel]
<burgestrand>
banisterfiend`: been thinking of using it when placing lambdas in hashes
<burgestrand>
but no, haven’t felt a need for it yet
<r00t_l00p>
burgestrand: so if i get rid of the sum = 0, will it work?
<banisterfiend`>
burgestrand: ah ok
blazes816 has joined #ruby
ackz has quit [Read error: Connection reset by peer]
jeremy_ has joined #ruby
strnx has joined #ruby
<burgestrand>
r00t_l00p: you afraid to try? ;)
jeremy_ is now known as Guest30221
beneggett has quit [Ping timeout: 244 seconds]
<r00t_l00p>
burgestrand: haha, already did, but it doesnt because there is no variable "sum" after the block, so there is nothing to return at the end of the method
<r00t_l00p>
right?
tvw has quit [Remote host closed the connection]
<burgestrand>
r00t_l00p: maybe! but… what does Enumerable#inject return?
<r00t_l00p>
burgestrand: lemme check...
<billybobjoe299>
r00t_l00p: try something like sum=array.inject{|s,x| s+x}
julio has joined #ruby
verto|off is now known as verto
<r00t_l00p>
Enumerable#inject returns an object... so wouldnt "sum" become an object if i used what billybobjoe299 said?
cakehero has quit [Quit: Computer has gone to sleep.]
<banisterfiend`>
burgestrand: bsically i wanted 2 blocks :P
<burgestrand>
r00t_l00p: last sentence of second paragraph of the method documentation states what it *really* returns
<burgestrand>
banisterfiend`: yeah, I’ve been thinking of using it for passing two blocks
jprovazn has quit [Ping timeout: 276 seconds]
bglusman has joined #ruby
<r00t_l00p>
burgestrand: i cant quite wrap my head around what it is trying to say....
<burgestrand>
r00t_l00p: the deal with inject is that it walks a list, and gives you two variables: an accumulated value, and the current item in the list
indian has joined #ruby
<burgestrand>
r00t_l00p: whatever you return from the block during the iteration becomes the accumulated value for the next iteration
bluenemo has joined #ruby
<burgestrand>
r00t_l00p: in your case, sum = sum + 1, is the last expression of the block, and in ruby the return value of a block (or a method) is the result of the last expression, i.e. the sum up until this point in the iteration
billybobjoe299 has left #ruby [#ruby]
brianpWins has quit [Quit: brianpWins]
<burgestrand>
r00t_l00p: this means that the sum is the accumulated value for the next iteration, i.e. the sum in { |sum, x| … }
<burgestrand>
r00t_l00p: the return value of Enumerable#inject is the accumulated value of the last iteration
<r00t_l00p>
burgestrand: so if i just get rid of the return statement, it will work, since i dont explicitly have to declare what i am returning (like i have to do in java)
<r00t_l00p>
right?
<burgestrand>
r00t_l00p: right!
Spooner has quit [Ping timeout: 276 seconds]
<r00t_l00p>
burgestrand: alright, lets give it a shot :)
<burgestrand>
r00t_l00p: essentially, it becomes this: array.inject { |sum, number| sum + number }
sailias has quit [Quit: Leaving.]
sendoushi has joined #ruby
andrewhl has joined #ruby
<burgestrand>
r00t_l00p: it might help if you do this on paper, and write out the value of each variable at every iteration
<jonathancutrell>
Hey folks. I'm using Zip::ZipFile in this: http://pastebin.com/0pdFkwyi and I'm getting an error, "undefined method `bytesize' for nil:NilClass" at file: zip_entry.rb location: read_c_dir_entry line: 302
<jonathancutrell>
Is my implementation correct?
<jonathancutrell>
(in the paste)
tatsuya_o has joined #ruby
dv310p3r has quit [Ping timeout: 252 seconds]
eywu has joined #ruby
beneggett has quit [Ping timeout: 276 seconds]
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
fraser has joined #ruby
dv310p3r has joined #ruby
Petit_Dejeuner has quit [Ping timeout: 255 seconds]
<jonathancutrell>
very quiet in here.
blazes816 has joined #ruby
tatsuya_o has quit [Remote host closed the connection]
<fraser>
Indeed, maybe people are hard at work... Or hardly working
elhu has quit [Quit: Computer has gone to sleep.]
<jonathancutrell>
Indeed.
<jonathancutrell>
I feel like working in that sentence begs to have it's "g" dropped.
<jonathancutrell>
workin.
<sernin>
fo' the man.
<jonathancutrell>
tha.
<sernin>
jonathancutrell: And I'd hazard a guess that your zipfile is not being found, or otherwise not populated, but this isn't caught
<fraser>
I guess it does. Although I always hate missing letters off words
<jonathancutrell>
sernin: erg. It's showing up in the uploads folder correctly. Perhaps a permissions issue?
<jonathancutrell>
But if it's writing it,
<jonathancutrell>
I'm assuming it would by default have permissions to read it...
<sernin>
jonathancutrell: Make sure explicitly.
<sernin>
jonathancutrell: Although I see what you're saying.
williamcotton_ has joined #ruby
<jonathancutrell>
I'm seeing rw r r
mdickens has joined #ruby
erichmenge has joined #ruby
<sernin>
Then you're fine, but perhaps the path being looked for is wrong, subtly
williamcotton has quit [Ping timeout: 240 seconds]
williamcotton_ is now known as williamcotton
krz has joined #ruby
<jonathancutrell>
Would a .zip need x?
<sernin>
*shrug* I'm just making slightly educated guesses.
<sernin>
No. Only directories need x for traversal, or anything that needs to be written.
<sernin>
sorry, executed
imami|afk is now known as banseljaj
<sernin>
That, and you would need write permissions in the dir where you're creating these files, as well as x for traversing into anything created that's new (mode 0755)
hynkle has quit [Read error: Connection reset by peer]
manolo has quit [Ping timeout: 246 seconds]
<jonathancutrell>
I've got rwx xr x on the parent dir
manolo has joined #ruby
Pathou has joined #ruby
apeiros_ has quit [Remote host closed the connection]
Russell^^ has joined #ruby
a_a_g has joined #ruby
Pathou has left #ruby [#ruby]
cbuxton1 has joined #ruby
<jonathancutrell>
I'm puts-ing the location of the file, and it's outputting correctly.
<sernin>
(outputsing? heyyooo)
fermion has quit [Quit: P]
<jonathancutrell>
sernin: sneaky sneaky.
the_mechanic has joined #ruby
<the_mechanic>
Hi
<sernin>
jonathancutrell: Yeah, that's just where I'd start to look, in any case. For me, it's nothing obvious in your code, but perhaps others could share some insight.
cbuxton has quit [Ping timeout: 276 seconds]
mathie has joined #ruby
<Ionic`>
jonathancutrell: use p, not puts
<jonathancutrell>
sernin: Hrm. I did it directly from irb - same error.
MasterIdler_ is now known as MasterIdler
<the_mechanic>
I am writing a module which contains a class that deals with network device API. I am declaring a bunch of def self.create self.delete type methods which accepts a connection handler as an argument
<Ionic`>
hmm
<the_mechanic>
but I am also declaring an instance variable @connhandle which will be passed when .new is called
robozahn has joined #ruby
<Hanmac>
jonathancutrell you didnt tell us your ruby version
<Ionic`>
is there something like select/find_all, but which breaks?
<the_mechanic>
is there a conflict, is that an okay practice?
<jonathancutrell>
Rubyzip is not compatible with 1.9.3 according to some dude on SO.
mrsolo has quit [Quit: This computer has gone to sleep]
timonv has joined #ruby
<Ionic`>
hmmm
<the_mechanic>
actually my question had just become 2 question
<the_mechanic>
if I declared @varname and then I have def method(varname='') that shouldn't cause me any grief ?
mwilson_ has quit [Excess Flood]
mwilson_ has joined #ruby
Bosma has joined #ruby
companion has quit [Ping timeout: 265 seconds]
mrsolo has joined #ruby
mrsolo has quit [Remote host closed the connection]
abra has quit [Ping timeout: 276 seconds]
mrsolo has joined #ruby
<Ionic`>
the_mechanic: no, why would it?
<the_mechanic>
just making sure they won't shadow/overwrite each other in some way
<Ionic`>
the local variable will be varname
<the_mechanic>
right
<Ionic`>
also
<Ionic`>
you can't just use varname to access @varname
abra has joined #ruby
<the_mechanic>
yes
<Ionic`>
anywhere
MasterLambaster has joined #ruby
<the_mechanic>
yes, that is fine
<Ionic`>
thus... how could it be overwritten?
<Ionic`>
or shadow'd
<Ionic`>
impossibru!
<the_mechanic>
good, that is what I thought
workmad3 has joined #ruby
<blazes816>
what about an accessor? if there's an accessor for @varname, could it not cause issues?
<the_mechanic>
so declaring a bunch of self.method(varname) is totally acceptable, even if I have @varname decalred and used in the non class instance methods
<the_mechanic>
yes?
<Ionic`>
blazes816: probably, but you can specify it via varname() vs. varname
<Ionic`>
sure
<blazes816>
Ionic`: for sure, just figured I'd point out a possible issue later on, if it wasn't handled correctly.
<shevy>
boobs!
cbuxton1 has quit [Quit: Leaving.]
<Ionic`>
boobs?
minijupe has joined #ruby
<the_mechanic>
but when I do MyClass.varname only the accessor is in play
<the_mechanic>
so the scope shouldn't conflict, or is that wrong?
<shevy>
Ionic` sorry, tried to get the discussion down to my level
<shevy>
Ionic`, yeah I think that is unprofessional. not because they mention boobs, but because I believe in engineering, the thinking pattern should try to focus on the problem at hand
<shevy>
a robot would have no need to use such names
mrdodo has quit [Remote host closed the connection]
dv310p3r has quit [Ping timeout: 276 seconds]
<Ionic`>
shevy: I think it's moot or rather showing the real issue all along (i.e., lawyers)
Criztian has quit [Remote host closed the connection]
abra has quit [Remote host closed the connection]
abra has joined #ruby
davidpk has joined #ruby
ryan0x2 has quit [Remote host closed the connection]
ringotwo has joined #ruby
companion has joined #ruby
jimeh has quit [Ping timeout: 252 seconds]
morodin has joined #ruby
cek has joined #ruby
beneggett has joined #ruby
bigkevmcd has quit [Ping timeout: 248 seconds]
<cek>
What's a good mail distribution solution written in ruby? With unsub support, with user management, with ui possibly?
ryan0x2 has joined #ruby
jimeh has joined #ruby
Spooner has quit [Ping timeout: 276 seconds]
fbernier has quit [Ping timeout: 246 seconds]
<i0n>
i hate this zipzip library
timonv has quit [Remote host closed the connection]
<the_mechanic>
why doesn't Integer have a new method?
<jonathancutrell>
Looks like my zip file wasn't making it all the way.
i0n has quit [Quit: leaving]
<jonathancutrell>
(it's corrupted, apparently)
pdtpatrick has joined #ruby
<Mon_Ouie>
Because it doesn't make sense to "create" an new integer since you'd need to pass an integer to create another integer
<blazes816>
the_mechanic: every integer is already an instance of Integer
timonv has joined #ruby
<cek>
integer is not an object
<Mon_Ouie>
Plus the Integer class itself never gets instanced, and due to optimizations, there are Fixnums that cannot be instanced at all
asdfqwer_ has joined #ruby
Draco___ has quit [Remote host closed the connection]
<Mon_Ouie>
(tagged pointers)
beneggett has quit [Ping timeout: 276 seconds]
<Hanmac>
cek ?? integer numbers are ruby objects, and the class Integer is an object too
<fowl>
RUBY!
asdfqwer_ is now known as asdfqwer
br4ndon has quit [Quit: Lorem ipsum dolor sit amet]
_bart has joined #ruby
elux has joined #ruby
<cek>
inegers are not web-scale
<fraser>
Correct me if I'm wrong, but isn't almost everything an object in ruby?
dv310p3r has joined #ruby
<Mon_Ouie>
Every value you can manipulate, yes
<Mon_Ouie>
The "almost" just comes from the fact that code isn't data in Ruby (unlike Lisp)
bbttxu has joined #ruby
anomaly has joined #ruby
hashpuppy has joined #ruby
Lachryma has quit [Quit: Leaving]
<hashpuppy>
i've posted this poll in #haskell, #scala, #clojure, and a few other channels. i've received quite a few responses. i would like 20 more, though. if you guys get a few minutes, would you guys help me by filling out this poll on productivity and health in software engineering: https://docs.google.com/spreadsheet/viewform?pli=1&formkey=dGZpbHExdHZteXY4VkpaRnBQUzRPRHc6MQ#gid=0
beneggett has joined #ruby
kichawa has quit [Quit: Changing server]
duder has joined #ruby
wilmoore has joined #ruby
asdfqwer has quit [Client Quit]
i0n has joined #ruby
i0n has quit [Client Quit]
<Ionic`>
hmmm
faulkner- is now known as faulkner
theRoUS has quit [Read error: Operation timed out]
<cek>
no we won't submit your poll fat mister with big suitcase from gartner
<fowl>
hashpuppy, please file a E4T D1CK request with the main office
<fowl>
yeah you fascist pig
<hashpuppy>
haha. i've asked in 6 other channels. and all have been really friendly about this
<cek>
not in ruby!
<hashpuppy>
heh. i'm sorry
<sernin>
no ruby for you. one year.
<hashpuppy>
thanks for those that have submitted
<shevy>
lol
<hashpuppy>
i love ruby, though!
<fowl>
go back to the friendly world you know
<shevy>
you must use php now
<jonathancutrell>
So in my uploading portion… How might that file have not gotten completely copied over? The upload uses the tempfile.read of a multipart form, and reads it in in chunks.
<otters>
I just submitted it
<otters>
oh lawdy
bigkevmcd has joined #ruby
<otters>
is that poll only for people who are out of high school
<shevy>
jonathancutrell is that rails
MasterLambaster has quit [Quit: MasterLambaster]
<sernin>
shevy: looks like sinatra
<jonathancutrell>
shevy: nope - Sinatra.
<shevy>
cool
<hashpuppy>
otters: for anyone who develops software
xorgnak has joined #ruby
<shevy>
hmm
<otters>
oh okay
<shevy>
what about those guys who do not develop software but just write code
sebastorama has quit [Read error: Operation timed out]
<the_mechanic>
If I have a class Foo and it load module Bar and Module bar has a class Foo also
<the_mechanic>
would that work?
<shevy>
the_mechanic, yeah. the second class Foo is in a namespace
<Ionic`>
shevy: how can you write code without developing software?
<jonathancutrell>
in particular, the line I think isn't working is --> while blk = tmpfile.read(65536)
<shevy>
(1) class Bar (2) module Foo; class Bar; <--- two different classes
apeiros_ has joined #ruby
<shevy>
Ionic` poetry! creativity! getting nothing done, rather than getting things done :)
i0n has joined #ruby
mengu has joined #ruby
<Ionic`>
shevy: getting nothing done and being verbose about it?
<the_mechanic>
would I have to do Bar::Foo.method in class Foo which is not in the module Bar?
<xorgnak>
that sounds like an extremely bad idea.
<shevy>
Ionic`, lol yeah. and creative about it... I mean, we have languages like brainfuck
<fowl>
Ionic`, long ago he finished the tron world and has been lost in it ever since, irc is his only method of communication to the outside
robbyoconnor has quit [Ping timeout: 246 seconds]
i0n has quit [Client Quit]
<Ionic`>
hehe
<shevy>
the_mechanic, yes, you must scope properly via ::
<shevy>
well
<shevy>
inside class Foo you can just call the methods
ramblex has joined #ruby
<shevy>
you could also do include Bar
<xorgnak>
wouldn't it make far more sense to generalize the class between the two and then just include the class in the module?
<shevy>
then you can omit the Bar:: stuff
a_a_g has quit [Ping timeout: 255 seconds]
<the_mechanic>
well I have a class which deals with a load balancer pool
<the_mechanic>
I build a module which is LoadBalancerInterfaces , and that talks to the load balancer
beneggett has quit [Ping timeout: 252 seconds]
<the_mechanic>
now I want to write a separate class which deals with pools without touching the load balancer interfaces
dhruvasagar has quit [Ping timeout: 246 seconds]
i0n has joined #ruby
<xorgnak>
different name maybe?
<the_mechanic>
so I can instantiate pools, convert format etc in the general business logic class and then only deal with the load balancer when I need persistence
ananthakumaran has quit [Quit: Leaving.]
<the_mechanic>
that way I could test them separately as well
<Ionic`>
hmm
<Ionic`>
rb_block_call
<Ionic`>
gimme implementation
<shevy>
module Foo; class Bla; module Yippie; class Bla <--- two different class Bla
tatsuya_o has joined #ruby
mwilson_ has quit [Excess Flood]
chussenot has joined #ruby
mwilson_ has joined #ruby
<the_mechanic>
yes but the problem is I wnt bla in foo to talk to bla in yippie when it is time to save the object to the device
<xorgnak>
grab
<sernin>
so you use Yippie::Bla instead of just Bla
<the_mechanic>
that is all I asked :)
<the_mechanic>
I was just wondering if I included yippie and then called Blah.method_from_yippie_blah
<Ionic`>
hmmm
<shevy>
well it is no different than two classes talking to one another even if they haven't been put into any module
<Ionic`>
Enumerator::Lazy (r2.0)
MasterLambaster has joined #ruby
<shevy>
and Blah.method is a class method, isn't it? There is no instance of Blah anywhere in that
xorgnak has quit [Remote host closed the connection]
<Ionic`>
shevy: show me src for rb_block_call!
xorgnak has joined #ruby
xorgnak has quit [Remote host closed the connection]
mwilson_ has quit [Excess Flood]
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
mwilson_ has joined #ruby
mwilson_ has quit [Excess Flood]
mwilson_ has joined #ruby
ciopte7 has joined #ruby
a_a_g has joined #ruby
xorgnak has joined #ruby
<Ionic`>
right
<Ionic`>
about github
xorgnak has quit [Remote host closed the connection]
<Ionic`>
you can't search for stuff
kirun_ has joined #ruby
mxweas has joined #ruby
xorgnak has joined #ruby
<apeiros_>
o0
<apeiros_>
of course you can
<Ionic`>
how?
<Ionic`>
well
<Ionic`>
you can't "git grep" the repo
<Ionic`>
this has always pissed me off
xorgnak has quit [Remote host closed the connection]
<apeiros_>
cek: more work for ruby for a single character. but yes, premature optimization.
<Ionic`>
,*_?
sendoushi has quit [Remote host closed the connection]
<apeiros_>
Ionic`: he means |sect,*_| instead of |sect,_,_|
<apeiros_>
*_ will "unsplat" the rest of the args into an array
jchauncey has joined #ruby
<vectorshelve>
can anyone explain this concept -> http://pastie.org/4332165 line 7 is just name of another class.. and there is no instantiation happening there shouldnt it be TaxMediator.new ?
jchauncey has quit [Client Quit]
<Ionic`>
ah
<cek>
modules can't be instantiated
anothervenue has quit [Quit: WeeChat 0.3.8]
<vectorshelve>
cek: TaxMediator is a class and not module
ringotwo has quit [Read error: Connection reset by peer]
vlad_starkov has quit [Remote host closed the connection]
Goles has joined #ruby
ringotwo has joined #ruby
verbad has joined #ruby
s0ber_ has joined #ruby
<apeiros_>
vectorshelve: classes are normal objects
<apeiros_>
and this method happens to return an object that happens to be a class
<Ionic`>
hmm
<Ionic`>
where do I find this stuff
s0ber has quit [Read error: Operation timed out]
<apeiros_>
without context, there isn't much more to say about that
<vectorshelve>
apeiros_: u mean to say I dont need to do TaxMediator.new ?
s0ber_ is now known as s0ber
<apeiros_>
vectorshelve: I mean to say that you only do TaxMediator.new when you actually want an instance of TaxMediator. obviously he doesn't
Jake232 has joined #ruby
Lachryma has quit [Read error: Connection reset by peer]
Lachryma has joined #ruby
Lachryma has quit [Read error: Connection reset by peer]
<kbanman>
I'm working on installing gitlab, and am running into this error:
<kbanman>
rake aborted!
<kbanman>
cannot load such file -- omniauth/ldap
<kbanman>
any ideas?
<apeiros_>
you're missing the omniauth/ldap library?
<kbanman>
is that its own gem?
<apeiros_>
no idea, I'd google and/or check rubygems.org
<apeiros_>
it's either part of omniauth or its own lib
joch_n has joined #ruby
<kbanman>
I have omniauth installed, but googling that error gives me zero
mdickens has quit [Ping timeout: 244 seconds]
<kbanman>
ah, yep. it's a separate gem: omniauth/ldap
ringotwo has quit [Read error: Connection reset by peer]
<kbanman>
err, omniauth-ldap
ryanRT has quit [Read error: Connection reset by peer]
ryanRT has joined #ruby
ringotwo has joined #ruby
a_a_g1 has quit [Ping timeout: 276 seconds]
<Ionic`>
apeiros_: where can I find documentation about replacing "ignored" members with _ or *_?
alekst has joined #ruby
<apeiros_>
Ionic`: _ is a valid variable name
<Ionic`>
oh
<apeiros_>
I could have written |sect,foo,bar| too
<apeiros_>
but _ is a better indicator for "not used"
<Ionic`>
and obviously redefining/overwriting it is no problem
cek has quit [Quit: Object superclasses!]
Spooner has joined #ruby
baphled has joined #ruby
<apeiros_>
nope
<Mon_Ouie>
I prefer when the name is still there. Because someday, maybe someone will want to change the block, and they will need to use one of the other arguments, but won't know right away which does what.
<apeiros_>
yes, sect,_key,_value is also a common pattern
Morkel has joined #ruby
chson has joined #ruby
Morkel has quit [Client Quit]
cbuxton has joined #ruby
Criztian has joined #ruby
Morkel has joined #ruby
elhu has joined #ruby
ghaydarov has joined #ruby
<apeiros_>
Ionic`: as for *foo - google for 'ruby splat'
<apeiros_>
I'm sure you'll find a good explanation
kbanman has left #ruby [#ruby]
vectorshelve has quit [Ping timeout: 245 seconds]
kaen has joined #ruby
strife25 has joined #ruby
<kaen>
can anyone give me a clue as to why this returns false:
sepp2k has quit [Read error: Connection reset by peer]
xorgnak has quit [Remote host closed the connection]
Morkel has quit [Quit: Morkel]
berserkr has quit [Quit: Leaving.]
vlad_starkov has quit [Remote host closed the connection]
bequick has quit [Read error: Operation timed out]
xorgnak has joined #ruby
xorgnak has quit [Remote host closed the connection]
kvirani has quit [Remote host closed the connection]
jonathancutrell has joined #ruby
erichmenge has joined #ruby
paval has quit [Quit: Leaving]
<sernin>
Will something like o.match(some_regex) { if o.match(another_regex) ...} not work as expected? I'm thinking that the match is consumed on the first iteration.
xorgnak has joined #ruby
bbttxu has quit [Quit: bbttxu]
<sernin>
Sorry if that's confusing, but, basically, I am just wondering if I need to store this data elsewhere or I can just abuse String#match as above
sailias has quit [Ping timeout: 276 seconds]
blaxb has quit [Remote host closed the connection]
ringotwo has joined #ruby
Simon3 has joined #ruby
dangerousdave has quit [Quit: Leaving...]
xorgnak has quit [Remote host closed the connection]
spinagon has quit [Ping timeout: 276 seconds]
the_mechanic has joined #ruby
xorgnak has joined #ruby
the_mechanic has quit [Client Quit]
shavus has joined #ruby
stringoO has quit [Read error: Connection reset by peer]
stringoO has joined #ruby
workmad3 has quit [Ping timeout: 246 seconds]
xorgnak has quit [Remote host closed the connection]
kpshek has quit []
mxweas has quit [Quit: Leaving...]
xorgnak has joined #ruby
chevdor_ has joined #ruby
nedbat has joined #ruby
<chevdor_>
Hello, I am running into an issue and I was hoping someone could give my a clue(hint. I have described the topic here: http://goo.gl/b1uDN
xorgnak has quit [Remote host closed the connection]
wedgeV has joined #ruby
bradhe_ has quit [Remote host closed the connection]
<chevdor_>
In short I am migrating an installation of Gitorious and rake is giving me a hard time
xorgnak has joined #ruby
Banistergalaxy has joined #ruby
morodin has quit [Read error: Operation timed out]
Simon3 has quit [Ping timeout: 246 seconds]
xorgnak has quit [Remote host closed the connection]
xorgnak has joined #ruby
etehtsea has quit []
verbad has quit []
chimkan_ has quit [Quit: chimkan_]
xorgnak has quit [Remote host closed the connection]
chimkan_ has joined #ruby
xorgnak has joined #ruby
stringoO has quit [Quit: stringoO]
xorgnak has quit [Remote host closed the connection]
lorandi has quit [Quit: Leaving]
bluOxigen has joined #ruby
banseljaj is now known as imami|afk
obryan has quit [Quit: Konversation terminated!]
jonathancutrell_ has joined #ruby
xorgnak has joined #ruby
crankycoder has quit [Remote host closed the connection]
jonathancutrell has quit [Ping timeout: 244 seconds]
jonathancutrell_ is now known as jonathancutrell
erichmenge has quit [Quit: Be back later]
xorgnak has quit [Remote host closed the connection]
xorgnak has joined #ruby
Asher has quit [Ping timeout: 245 seconds]
stephenjudkins has quit [Ping timeout: 255 seconds]
erichmenge has joined #ruby
xorgnak has quit [Remote host closed the connection]
xorgnak has joined #ruby
manizzle has quit [Ping timeout: 244 seconds]
indian has joined #ruby
bbttxu has joined #ruby
manizzle has joined #ruby
blacktulip has quit [Remote host closed the connection]
<shevy>
sernin, hmm dont think I saw that before
wangr_ has quit [Ping timeout: 252 seconds]
chevdor_ has left #ruby ["Verlassend"]
stephenjudkins has joined #ruby
atmosx has joined #ruby
thone_ has joined #ruby
<sernin>
shevy: Yeah, I'm going to tackle it when I get home. Enough BS for one day. :)
<sernin>
(at the office, at least)
<Ionic`>
urgh... that's ugly
xorgnak has quit [Remote host closed the connection]
Progster has joined #ruby
xorgnak has joined #ruby
cj3kim has joined #ruby
cj3kim has quit [Changing host]
cj3kim has joined #ruby
yoklov has joined #ruby
thone has quit [Ping timeout: 252 seconds]
prometheus has joined #ruby
xorgnak has quit [Remote host closed the connection]
piotr__ has quit [Remote host closed the connection]
<Ionic`>
I actually need return [ @kv_pairs.detect { |sect,k,_value| (sect == section) && (key == k) } ].map { |_sect,_key,value| value }
pskosinski has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
Dr4g has quit [Quit: Connection closed for inactivity]
mehlah_ has joined #ruby
celm has joined #ruby
celm has quit [Client Quit]
xorgnak has quit [Remote host closed the connection]
xorgnak has joined #ruby
xorgnak has quit [Remote host closed the connection]
<Ionic`>
at least if there is only one solution... crap
cantonic has quit [Quit: cantonic]
xorgnak has joined #ruby
Gavilan is now known as gavilan2
<apeiros_>
o0
<apeiros_>
I think you're breeding too much over details
<apeiros_>
add some tests
khakimov has quit [Quit: Computer has gone to sleep.]
<apeiros_>
get the thing working
pskosinski has joined #ruby
<apeiros_>
then when you have too much time and prefer cleaning up over adding features (and cleaning up is a good idea), go and refactor code…
<Ionic`>
wait what? it did work fine before, I'm just prettifying it with your suggestions :p
<Ionic`>
but I'm running into some problems
pskosinski has quit [Client Quit]
xorgnak has quit [Remote host closed the connection]
xorgnak has joined #ruby
EricKamsky_ has quit [Ping timeout: 250 seconds]
bigkm has quit [Ping timeout: 276 seconds]
<Ionic`>
hum no, the hell
xorgnak has quit [Remote host closed the connection]
bigkm has joined #ruby
brianpWins has quit [Quit: brianpWins]
xorgnak has joined #ruby
xorgnak has quit [Remote host closed the connection]
xorgnak has joined #ruby
<Ionic`>
ah, my bad
<blazes816>
I just interviewed for a job over the phone. He asked how much I made currently. I told him (and the answer is about $20k less than the advertised salary) and he went off about how it was way too high. I fucking hate looking for work.
balki_ has joined #ruby
xorgnak has quit [Remote host closed the connection]
balki has quit [Read error: Connection reset by peer]
verto is now known as verto|off
chichou has quit [Remote host closed the connection]
chichou has joined #ruby
<shevy>
blazes816 haha yeah, but hey. those are the times where you grab a beer, drink that, and don't think too much about anything else than the beer ;)
Markvilla has quit [Ping timeout: 244 seconds]
mpereira has quit [Ping timeout: 244 seconds]
<blazes816>
shevy: beat you there
Markvilla has joined #ruby
xorgnak has joined #ruby
[Neurotic] has joined #ruby
Dreamer3 has joined #ruby
wedgeV has quit [Quit: wedgeV]
xorgnak has quit [Remote host closed the connection]
xorgnak has joined #ruby
nedbat has quit [Disconnected by services]
<xclite>
blazes816 I really feel like a lot of hiring managers are clueless
chichou has quit [Ping timeout: 276 seconds]
<Progster>
xclite: duh :)
nedbat_ has joined #ruby
graspee has joined #ruby
<blazes816>
definitely
<blazes816>
except me
<xclite>
it's kind of like the
<xclite>
"required: 6 years of knowledge in something that's been out for 4 years" thing
<blazes816>
haha yeah
<xclite>
or "you must know php, python, perl, ruby, oracle, mysql, sqlite, and postgres"
<xclite>
it's like
<xclite>
...
<fowl>
wallstreet sociopaths
Nisstyre has quit [Remote host closed the connection]
theRoUS has quit [Ping timeout: 246 seconds]
Nisstyre has joined #ruby
axl_ has quit [Quit: axl_]
dv310p3r has quit [Ping timeout: 276 seconds]
CannedCorn has quit [Quit: Computer has gone to sleep.]
<apeiros_>
Ionic`: um, why did you replace select with detect?
xorgnak has quit [Remote host closed the connection]
xorgnak has joined #ruby
<Ionic`>
apeiros_: I didn't replace it, (keys() is using select), value is returning one value and I want it to break once the section and key match (only detect does that)
<Ionic`>
it's really more of an optimization
weasels has quit [Quit: WeeChat 0.3.8]
shiki has joined #ruby
otters has joined #ruby
wvms has joined #ruby
<apeiros_>
Ionic`: ah, you're in a different method
artOfWar has quit [Remote host closed the connection]
jeff_sebring has quit [Quit: Leaving]
jrist is now known as jrist-afk
xorgnak has quit [Remote host closed the connection]
nari has joined #ruby
zeen` has quit [Ping timeout: 248 seconds]
nedbat has quit [Ping timeout: 276 seconds]
artOfWar has joined #ruby
nedbat has joined #ruby
emmanuelux has joined #ruby
MasterIdler has quit [Quit: MasterIdler]
artOfWar has quit [Read error: Connection reset by peer]
artOfWar has joined #ruby
kjellski has quit [Quit: This computer has gone to sleep]
akem has quit [Read error: Connection reset by peer]
caveat- has joined #ruby
jonathancutrell has quit [Quit: jonathancutrell]
S1kx has quit [Read error: Connection reset by peer]
S1kx has joined #ruby
S1kx has joined #ruby
xorgnak has joined #ruby
deryl has quit [Quit: deryl]
xorgnak has quit [Remote host closed the connection]
jimeh has quit [Ping timeout: 246 seconds]
cantonic has joined #ruby
yxhuvud has quit [Ping timeout: 276 seconds]
balki_ is now known as balki
IceDragon has joined #ruby
asobrasil has left #ruby [#ruby]
Criztian has quit [Remote host closed the connection]
ceej1 has joined #ruby
ceej has quit [Read error: Connection reset by peer]
pdtpatrick_ has joined #ruby
LBRapid has quit [Quit: Computer has gone to sleep.]
pdtpatrick has quit [Read error: Connection reset by peer]
pdtpatrick_ is now known as pdtpatrick
mvangala_home has joined #ruby
Rojo has quit [Quit: Leaving]
ForSpareParts has quit [Disconnected by services]
oscardelben has joined #ruby
ForSpareParts has joined #ruby
<tightwork>
I am trying to use ruby 1.9.2 with rails in rvm but when I run rails s it segfaults with a problem in json further stating it is using ruby 1.8.7? http://dpaste.com/775416/
<tightwork>
help please
<ForSpareParts>
Is there an easy way to reinstall gem? I installed a new version of ruby and my system is a bit of a mess, new ruby doesn't see gems when I install them...
akem has joined #ruby
<ForSpareParts>
If it matters at all, I'm using Ubuntu 12.04.
akem has quit [Remote host closed the connection]
ceej1 has quit [Quit: Leaving.]
ramblex has quit [Ping timeout: 250 seconds]
<tightwork>
ForSpareParts: I recall gem pristine --all should reinstall all gems... at own risk when taking advice like that from newb of course :)
<ForSpareParts>
tightwork: Unfortunately, I believe my gems are in the wrong place -- I want to actually reinstall gem itself...
<tightwork>
ForSpareParts: I forget, did gem come with ruby or is it a separate package? you could apt-get install --reinstall
rvmeier has joined #ruby
<ForSpareParts>
I didn't get either of them from apt. Or, I did at one point, but I got rid of those -- I think they were out of date...?
<Spooner>
Gem comes with ruby. It generally isn't the best plan to use apt-get to install ruby, ratehr than rvm/rbenv/etc., since they generally give you out of date versions.
<ForSpareParts>
Spooner: That was what I thought, yeah.
<CaptainJet>
apt-get ruby1.9.1 actually gives you 1.9.2
<CaptainJet>
even then it's still not up to date
nateberkopec has quit [Quit: Leaving...]
stephenjudkins has quit [Quit: stephenjudkins]
Guedes has joined #ruby
<ForSpareParts>
If I installed ruby from RVM, would I have to start a new terminal session for it to acknowledge the update gem utility?
<Spooner>
ForSpareParts : Not sure what you mean by gems being in the wrong place. Are they not where you expect with "gem which GEM" or does gem not even recognise that it has them?
nateberkopec has joined #ruby
<Spooner>
You can just "source ~/.bash_profile" (I think it is that dot file; not sure)
<ForSpareParts>
Spooner: require '[name of gem]' is complaining that I haven't satisfied my dependencies, even after a gem install on everything I need.
<ForSpareParts>
Spooner: Well, I already killed my SSH session and started a new one. Oh well.
<ForSpareParts>
I'm doing gem install again right now, and maybe this'll fix it...
<otters>
to be fair, homebrew installs ruby 1.9.3-p194
nari has quit [Read error: Operation timed out]
xorgnak has joined #ruby
xorgnak has quit [Remote host closed the connection]
<ForSpareParts>
By the way, is there a reason that installing gems takes so long? Especially the documentation? Seems like it ought to be quick, I mean, these (generally) aren't massive packages, right?