apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
<davidcelis> PEACE
<delinquentme> you deserve this icecream im eating
jfelchner has joined #ruby
jfelchner has joined #ruby
<_ack> delinquentme [*'a' .. 'z']
mdhopkins has joined #ruby
Drewch has joined #ruby
jfelchner has joined #ruby
wereg0st has joined #ruby
wereg0st has quit [#ruby]
jfelchner has joined #ruby
<davidcelis> Whitespace in a range? ಠ_ಠ
Mekkis has joined #ruby
wereg0st has joined #ruby
<_ack> davidcelis yes. a left over from Perl :-)
gen0cide_ has joined #ruby
Drewch has joined #ruby
weregh0st has joined #ruby
weregh0st has quit [#ruby]
Mchl has joined #ruby
h4mz1d has joined #ruby
<rking> If you want to be super lazy, but also want to add a bit of options parsing to a script, what's a good lib?
<rking> In this case it's also a bonus if it doesn't require adding a new gem.
Drewch has joined #ruby
pabloh has joined #ruby
<CombatWombat> That doesn't make sense.
<rking> OptionParser looks fine.
<rking> CombatWombat: Mine?
raz has joined #ruby
<raz> Time.now is very slow. is there a faster way to get at time()?
Bosma has joined #ruby
nari has joined #ruby
<CombatWombat> `date`
<apeiros_> CombatWombat: Date is a good deal slower than Time
<rking> Wow. It would be faster to shell out?
<CombatWombat> apeiros_: I was being silly.
<rking> Aha.
<apeiros_> raz: not really. how is Time.now being too slow for you?
<raz> apeiros_:
<raz> 1.050000 1.850000 2.900000 ( 2.996536)
<raz> 0.170000 0.000000 0.170000 ( 0.167213)
<apeiros_> I mean, it takes like 1 microsecond here… (= 0.000001s)
<apeiros_> raz: numbers without code is meaningless/useless
<raz> 100k iterations, the upper Time.now; foo +=1, the lower only foo +=1
<delinquentme> are there any ruby strings which dont evaluate to 0?
<apeiros_> raz: yes, so you need Time.now 100'000 times per second?
<delinquentme> ( with .to_i )
<apeiros_> raz: if so, ruby *may* be the wrong language for whatever you do…
<rking> delinquentme: I don't get it. "123".to_i == 123
<delinquentme> rking, i mean strings of letters
<raz> apeiros_: i just need the raw unix-time, Time is slow because of the object wrapping
<davidcelis> You're trying to .to_i a string of letters?
<davidcelis> What?
brianstorti has joined #ruby
<delinquentme> basically i've got this div which acts as a bunch of links to iterations of a page
<delinquentme> it contains page 1 2 3 ... kind of like the bottom of a google search right?
<rking> delinquentme: Hehe, oh, I don't think so. You mean a string that matches /^\w*$/ ?
<apeiros_> raz: you'll have to write an extension then.
<delinquentme> i need to get the max number thats listed in the div
shevy has joined #ruby
jrhorn424 has joined #ruby
<delinquentme> the links also contain text ... but if i convert something like %w( 1 5 2 'rosko' 8 7 'benny' )
<delinquentme> and each of those with to_i ... all of the TEXT will == 0
<delinquentme> so i can easily get the max
<rking> delinquentme: And you're afraid of some pathological string breaking the rule?
<delinquentme> yeap
<CombatWombat> delinquentme: What exactly are you wanting to do?
edogawaconan has joined #ruby
<delinquentme> CombatWombat, i just need to know if i can feed any reserved string into the .to_i method
<delinquentme> and get something OTHER than 0 back
<CombatWombat> sounds stupid, honestly.
brianstorti has joined #ruby
<CombatWombat> Write a test.
<rking> CombatWombat: What part of that is stupid?
<rking> CombatWombat: And how do you test for such things?
<rking> CombatWombat: Build a string with all possible character substrings then check to see if it returns any ints?
<CombatWombat> rking: You write a test that expects not 0 and use a fabricator to make a bunch of strings that it runs through.
<delinquentme> ...
<rking> CombatWombat: "a bunch of strings" <-- Now /that/, sounds dumb.
<rking> CombatWombat: For something like this you have to think it through.
<delinquentme> ^
<CombatWombat> rking: I guess you're not that pro with testing.
<delinquentme> CombatWombat, i invite you
<delinquentme> to create some function which creates every possible combination of words
<CombatWombat> No thanks.
<burgestrand> delinquentme: the documentation for String#to_i says that it will return 0 if there is no number at the start of the string, and that it will never raise an exception as long as the base of the number (the optional parameter to to_i) is valid.
<delinquentme> its much simpler to find out if there is a particular reason why any string would evaluate to != 0
<rking> delinquentme: I'm getting the Ruby source so I can look at the exact implementation of String#to_i
<CombatWombat> It's much simpler to read the code that defines #to_
<burgestrand> So, "a".to_i(16) will return a number, because a is valid in base 16.
<CombatWombat> It's much simpler to read the code that defines #to_i
<delinquentme> CombatWombat, respectable answer
zeroeth has joined #ruby
<CombatWombat> delinquentme: Yeah, I guess it occurs to me that it's simpler to rtfs and rtfm then write tests than to come into IRC asking silly questions.
edogawaconan has joined #ruby
<delinquentme> ahhh! "8tons".to_i # => 8
<rking> CombatWombat: So you never get stuck and want a second opinion?
<delinquentme> rking, apprech , burgestrand appresh
<rking> delinquentme: But, isn't that a number? I.e., if they had written "8 tons" would you not want it to find the 8?
Drewch has joined #ruby
<CombatWombat> rking: Not really. What I mostly do is I do everything I possibly can, include writing tests, and then go back and see what I can glean. I've delved into ruby source before coming into IRC.
<CombatWombat> I learn a lot more that way.
<delinquentme> CombatWombat, good for you
<delinquentme> im happy
<CombatWombat> I bet you are.
<CombatWombat> I'm sure of it.
<apeiros_> raz: http://pastie.org/3747619 - not that I think the 2.8x is worth it
<rking> CombatWombat: It's a different kind of "learn a lot more". For example, if I hadn't started #ruby'ing, I'd still be using irb instead of pry. It took somebody 2 seconds to make my tasks a lot better.
<CombatWombat> rking: Cool.
<CombatWombat> I'm glad you found a method of acquiring information that gets the job done for you.
<shevy> :(
<shevy> ruby is so small
<raz> apeiros_: thx
<shevy> at least python aint that far ahead here
<raz> apeiros_: 2.8x matters when using time as guard in a tight loop. ruby is slow enough as it is.
<CombatWombat> Which reminds me, r is something I should learn soon.
<apeiros_> raz: the C is probably bad and wrong and all, but you can take it as a starting point
<apeiros_> raz: as said, ruby may be the wrong language for what you do
<raz> yes, i'm fiddling an ext right now
<apeiros_> :)
<apeiros_> probably a good idea
<rking> shevy: I wonder what in the world "processing" is. But yeah, I stopped caring about what a huge group of coders that don't care about their own efficiency use.
<raz> apeiros_: ruby is the wrong language for any kind of crunching, yet there's no reason a simple "if Time.now - ..." multiplies execution time
<shevy> rking HORDES OF JAVA HACKERS
* rking watches them go running off their favorite cliff.
<shevy> lol
<apeiros_> raz: why do you recalculate it on every loop then?
<apeiros_> raz: if it is a tight loop, get the value once
<raz> apeiros_: because it's the guard, e.g. for printing a progressbar
<raz> you know, ruby needs progressbars
<apeiros_> I usually use modulo for that
d2dchat has joined #ruby
<raz> yes, that's nasty because you have to tweak it all the time
<apeiros_> not really
<apeiros_> but you need the total number of iterations
surfprimal has joined #ruby
<apeiros_> usually a resolution of 1% or 0.1% is sufficient. so iters/1000 == your modulus
<raz> you need all sorts of preconditions, when all you want is do is do something at wallclock intervals
<apeiros_> *shrug*
<apeiros_> time doesn't really matter if not enough happened to update the bar…
<apeiros_> and with the above, you know exactly when enough happened. regardless of time.
<raz> my progressbars have ETA and elapsed
<raz> your turn :P
<apeiros_> have a thread.
<raz> hehe
<apeiros_> unless you want to do a stupid "12.3242s remaining"
<raz> now we're pulling straws, no?
<apeiros_> no. I'm serious.
<raz> yea, because ruby thread scheduling works so awesome
<apeiros_> a sleeping thread doesn't consume cpu
<raz> especially with tight loops
* raz nods
<apeiros_> um, it works well enough for something like that…
<apeiros_> if things go really really awry (some C ext blocks for a long time) your progressbar isn't being updated. big deal.
<CombatWombat> apeiros_: BUT I NEED A REALTIME!!!! PROGRESS BAR!
<apeiros_> CombatWombat: yes, with microseconds displayed. I know. :(
<rking> apeiros_: I got the 'inline' gem, but it's something like readline. Where is the C thing?
<CombatWombat> apeiros_: you dont unnerstand, need real time.
<apeiros_> rking: what?
<rking> apeiros_: "gem install inline" gives, "A library for definign (sic) custom key bindings and perform line editing operations".
<ryanf> it's RubyInline
<rking> apeiros_: Not the thing like Inline::C that you used.
<rking> ryanf: Thanks. =)
<apeiros_> rking: I specificially mentioned the required gem install in the pastie…
<rking> apeiros_: Sure did. =) I scrolled past it.
<apeiros_> shame on you then :-p
<rking> I actually noticed this week I have a habit of skipping all introductions and conclusions when I'm reading web pages. =\
pu22l3r has joined #ruby
ZachBeta has joined #ruby
<apeiros_> rking: that's probably fine, but I think the moment you ran into problems is when you should have read it a second time, and that time completely.
<rking> apeiros_: Good point.
<rking> I wonder what the behavior is, now that I have done gem install inline RubyInline.
gurugeek_ has joined #ruby
<rking> I guess the second thing you install would overwrite the inline.rb
<apeiros_> hm?
<apeiros_> one gem can't overwrite another gem's files
matti has joined #ruby
<rking> apeiros_: I first ran "gem install inline", which causes "require 'inline'" to work, but for a different thing. Then I did "gem install RubyInline", and it seems to be working for "require 'inline'" on that, now.
<apeiros_> gem 'RubyInline' to get a specific activated
<delinquentme> whats the term used to describe an operation which could be made ... stronger?
<rking> apeiros_: Aha.
<delinquentme> like " this works " ( its ghetto ) and it needs to be improved
<delinquentme> and = but
<rking> delinquentme: You're looking for an adjective to describe weak "operation"s?
<delinquentme> # FIXME: ghetto-rigged
<delinquentme> thats what im putting in the code
<rking> delinquentme: That works for me.
<delinquentme> :D
<apeiros_> improvable?
<apeiros_> # TODO: improve
<apeiros_> or CSI style: enhance!
<BrianJ> What is analogous in rails to a java war?
<delinquentme> LOL
<delinquentme> ENHANCE
<apeiros_> BrianJ: a java war.
<apeiros_> (jruby :-p)
<apeiros_> BrianJ: also note, this is #ruby, not #rubyonrails
<BrianJ> ops
<BrianJ> my bad.
<delinquentme> soo im scraping the website of this absolutely massive publisher ... on the other side of the world .. upwards of 2000 journals
<delinquentme> and it is SLOOOOWWWW
<CombatWombat> delinquentme: Oh whoa. A publisher allows scraping? Crazy world.
<delinquentme> O_o;;;
<delinquentme> eh?
<delinquentme> CombatWombat, i understand you're an angry animal
<delinquentme> but you dont need to be perpetually in-character
zemanel has joined #ruby
<gurugeek_> did anyone use kirbybase in stade of sqlite?
<CombatWombat> delinquentme: Just a thought.
nif has joined #ruby
fayimora has joined #ruby
savage- has joined #ruby
apeiros_ has joined #ruby
nif has joined #ruby
nif has joined #ruby
RORgasm has joined #ruby
brianstorti has joined #ruby
ZachBeta has joined #ruby
fayimora_ has joined #ruby
looopy has joined #ruby
ZachBeta has joined #ruby
tomzx has joined #ruby
wroathe has joined #ruby
shtirlic has joined #ruby
eph3meral has joined #ruby
<eph3meral> can I accomplish this: values.map{ |val| val * Math.log2(val) }.inject(:+) but with inject alone?
<eph3meral> without a need for map?
<eph3meral> this version works fine, really
<eph3meral> just wondering
odinswand has joined #ruby
mxweas_ has joined #ruby
drake10 has joined #ruby
mikepack has joined #ruby
<ryanf> eph3meral: values.inject(0) { |sum, val| sum + val * Math.log2(val) }
redgetan has joined #ruby
lukeholder has joined #ruby
ceej has joined #ruby
<eph3meral> ryanf, ahh, that might have been my issue, I didn't provide 0 as a starting value
zakwilson has joined #ruby
<eph3meral> cuz I tried values.inject { |sum, val| sum + (val * Math.log2(val)) }
Sailias has joined #ruby
Synthead has joined #ruby
<ryanf> and got undefined method + for NilClass?
<ryanf> whoa, no
<ryanf> I have no idea what it does if you don't provide a starting point but do provide a block, actually
<ryanf> oh, it just uses the first value unaltered. duh.
sacarlson has joined #ruby
radic has joined #ruby
mxweas_ has joined #ruby
ziggles has joined #ruby
richardlxc has joined #ruby
guns has joined #ruby
richardlxc has joined #ruby
richardlxc has joined #ruby
luke3321 has joined #ruby
Teddy2steper has joined #ruby
CannedCorn has joined #ruby
affix has joined #ruby
robdodson has joined #ruby
<robdodson> is there a succinct way to generate an array of 1,000 booleans all set to true?
<CombatWombat> robdodson: Do they need to exist early in the lifecycle?
<robdodson> CombatWombat: not sure what you mean… total ruby newbie
csprite has joined #ruby
<CombatWombat> robdodson: Do they need to exist before anything is ran or can they be instantiated?
<robdodson> they can be instantiated
noyb has joined #ruby
sacarlson has joined #ruby
two- has joined #ruby
pu22l3r has joined #ruby
<CombatWombat> Create them as necessary during instantiation then. Either in the method argument_name=false or however.
<robdodson> i was just wondering what method would be the cleanest
<robdodson> fewest lines of code
<robdodson> inject?
<robdodson> basically i want to create a fixed size array and fill it with booleans. i was wondering if there is a method that will do this for me or should i just do n.times { my_array << true }
ZachBeta has joined #ruby
autodidakto has joined #ruby
frishi has joined #ruby
savage- has joined #ruby
Teddy2steper has joined #ruby
autodidakto has quit ["ERC Version 5.3 (IRC client for Emacs)"]
wallerdev has joined #ruby
<ryanf> you could do [true] * 1000
<ryanf> or arr = []; arr.fill(true, 0, 1000)
seanstickle has joined #ruby
brngardner has joined #ruby
sacarlson has joined #ruby
Teddy2steper has joined #ruby
startling has joined #ruby
Bonkers has joined #ruby
gurugeek_ has joined #ruby
lolsuper_ has joined #ruby
lolsuper_ has joined #ruby
Drewch has joined #ruby
Asebolka has joined #ruby
cryptops1 has joined #ruby
<cryptops1> is there a ruby to C translator?
gloomer has joined #ruby
<CombatWombat> Yeah, it's called a developer.
drake10 has joined #ruby
drake10 has quit [#ruby]
savage- has joined #ruby
<species> developers have poor performance though
shaggy2dope has joined #ruby
<species> they should be replaced with machines at any opportunity
poorlilrichboy has joined #ruby
<seanstickle> Depends on whether they are the system constraint.
<CombatWombat> Developers are self-deprecating by nature.
andrewhl has joined #ruby
RORgasm has joined #ruby
<mistergibson> cryptops1: one approach may be to use jruby and find a java-bytecode to C translator
tommyvyo has joined #ruby
ofthelesser has joined #ruby
mxweas_ has joined #ruby
otters has joined #ruby
ryanf_ has joined #ruby
Cyrus has joined #ruby
sacarlson has joined #ruby
Teddy2steper has joined #ruby
moshee has joined #ruby
mikeric has joined #ruby
<delinquentme> this threaded code is not behaving as im expecting it to https://gist.github.com/2334580
<delinquentme> its not sending out a ton of request right off the bat .. instead its running rather slowly
<delinquentme> im guessing because there are additional loops within the threads? ( IDK im guessing as per the previous error messages )
dnyy has joined #ruby
sacarlson has joined #ruby
gtuckerkellogg has joined #ruby
tomzx_ has joined #ruby
Teddy2steper has joined #ruby
cmasseraf has joined #ruby
joaoh82 has joined #ruby
RubyPanther has joined #ruby
crm11four has joined #ruby
davidcelis has joined #ruby
Akuma has joined #ruby
redgetan has quit ["Leaving"]
rippa has joined #ruby
<crm11four> anyone having trouble connecting to the rubyonrails channel?
<davidcelis> No?
<davidcelis> Are you registered with NickServ?
<crm11four> yes
<crm11four> #rubyonrails :Cannot join channel (+r) - you need to be identified with services
<crm11four> oops
<davidcelis> ...
wallerdev has joined #ruby
<davidcelis> lul
dql has joined #ruby
ZachBeta has joined #ruby
crm11four has joined #ruby
<crm11four> thanks davidcelis
robdodson has joined #ruby
fbernier has joined #ruby
Teddy2steper has joined #ruby
josh has joined #ruby
Teddy2steper has joined #ruby
joaoh82 has joined #ruby
<RubyPanther> If you login with a server login in your client then you don't see the warnings, but if you use NickServ then you get the warning but it lets you in anyways
tk___ has joined #ruby
mikeric has joined #ruby
lkba has joined #ruby
mistergibson has quit ["PART #rubylearning.org :PART #rubunity :QUIT :Leaving."]
jfelchner has joined #ruby
_class_ has joined #ruby
jfelchner has joined #ruby
ziggles has joined #ruby
ofthelesser has quit [#ruby]
Teddy2steper has joined #ruby
jfelchner has joined #ruby
libertyprime has joined #ruby
ifaria has joined #ruby
nfluxx has joined #ruby
MrGando has joined #ruby
edogawaconan has joined #ruby
dql has joined #ruby
moshee has joined #ruby
richardlxc1 has joined #ruby
Monofu has joined #ruby
<Monofu> I'm just getting into TDD and have having trouble understanding Mocks vs. Stubs. Anyone have any suggestions for references? Thanks!
akiress has joined #ruby
moted has joined #ruby
RORgasm has joined #ruby
richard_ has joined #ruby
Karmaon has joined #ruby
<Monofu> :_ack In the process of reading that atm. Still a little lost. But thanks a lot!
Cache_Money has joined #ruby
Cache_Money has joined #ruby
ben225 has joined #ruby
richardlxc has quit [#ruby]
Cache_Money1 has joined #ruby
Cache_Money has joined #ruby
nfluxx has joined #ruby
tommyvyo has joined #ruby
<Cache_Money> I've been watching golf all day and have a bet with some friends -- we each pick 5 players and whoever has the best score (sum of all 5 players score) wins the bet. I want to write a script to scape ESPN for the players scores and display the running score in real-time. I'm having trouble picking the scores out of http://espn.go.com/golf/leaderboard Any ideas?
<seanstickle> What trouble are you having?
<Cache_Money> For example, I need to go through each <tr> ... </tr> and pick out the player name and score but unsure how to compose the regex
<seanstickle> Are you using a regex for this whole thing?
<seanstickle> Stop, drop, and roll.
<seanstickle> And then go and use Nokogiri instead
x0F_ has joined #ruby
<Cache_Money> I was just going to use it to pull out each player name and score combination, then store it in a hash
pencilcheck has joined #ruby
<seanstickle> Use Nokogiri. Do not use regexes.
<Cache_Money> You're right, I should be using Nokogiri... THanks!
<pencilcheck> anyone using nokogiri? I can require in irb or pry but if I do it in a script and run it with ruby it says the file is not found
<seanstickle> pencilcheck: post the whole error
<seanstickle> pencilcheck: and also the require block at the top of your script
<Cache_Money> did you do require 'rubygems' ?
<pencilcheck> Cache_Money: no, I didn't
<pencilcheck> seanstickle: it's only one line, require 'nokogiri'
<seanstickle> What version of Ruby?
<pencilcheck> 1.8.7
<seanstickle> require "rubygems"
<seanstickle> Add that to the top
<pencilcheck> ok
<seanstickle> And upgrade to 1.9
<pencilcheck> 1.9 is slow
<pencilcheck> slow as hell
<pencilcheck> especially with rails
<seanstickle> Yeah, no.
<davidcelis> Lawl
<davidcelis> No.
<seanstickle> I think you might be confusing this with some other universe
<davidcelis> 1.9.2 was slow with Rails because of how it handled requiring files.
<pencilcheck> same in 1.9.3
<davidcelis> 1.9.3 is most certainly not slow.
<pencilcheck> not much better
<davidcelis> Yeah. No.
<pencilcheck> lol
<davidcelis> My rails 3 apps on 1.9 start in 2-3 seconds.
<pencilcheck> I upgraded through homebrew to 1.9.3, still slow
<pencilcheck> and 1.8.7 is lightning fast
<pencilcheck> also with bundler too so fast in 1.8.7
<davidcelis> jruby
ZachBeta has joined #ruby
jfelchner has joined #ruby
<Cache_Money> seanstickle: I need help with Nokogiri...
<seanstickle> Cache_Money: speak
<Cache_Money> How do I loop thru each <tr> in the <div class="containter">?
<seanstickle> .each
nirjhor has joined #ruby
<Cache_Money> How do I access them? Having trouble with the syntax of Nokogiri
<nirjhor> why do we have to use symbol in Ruby whereas no other languages use it?
<seanstickle> nirjhor: other languages do use it
<seanstickle> Cache_Money: pastie.org your code
<seanstickle> Cache_Money: I don't work with shared imagination
mrsrikanth has joined #ruby
<nirjhor> seanstickle: what is the use of it actually? couldn't we do without it?
<nirjhor> say like properties/fields in other languages
<seanstickle> nirjhor: read and learn yourself
weszlem has joined #ruby
ZachBeta has joined #ruby
<Cache_Money> I'm getting this error when trying to run a script with Nokogiri http://pastie.org/3748553
<seanstickle> Super. Post your code.
<Cache_Money> using this site: http://espn.go.com/golf/leaderboard
<seanstickle> And you've gem installed nokogiri, right?
<Cache_Money> yes
<Cache_Money> I used RVM to install Ruby and Rails, do you think that has anthing to do with it?
n1x has joined #ruby
krusty_ar has joined #ruby
<seanstickle> Nope
<seanstickle> Drop the require "rubygems" line
<seanstickle> And try again
<Cache_Money> k
<Cache_Money> same result
<Cache_Money> seanstickle: I re-ran 'gem install nokogiri' and this time it worked
<seanstickle> Huh
<Cache_Money> Now, how do I grab a players name and then their score, and then store it as a key:value in a hash?
bluOxigen has joined #ruby
baniseterfiend` has joined #ruby
<Cache_Money> This is an example <tr> ... </tr> http://pastie.org/3748568
yxhuvud has joined #ruby
Teddy2steper has joined #ruby
<Cache_Money> This is an example <tr> ... </tr> http://pastie.org/3748568
<Cache_Money> oops
mikeric has joined #ruby
looopy has joined #ruby
<Cache_Money> I'm having trouble accessing the first <td class="textcenter score">-9</td> and skipping the second
eam has joined #ruby
testsan has joined #ruby
Teddy2steper has joined #ruby
surfprimal has joined #ruby
codezombie has joined #ruby
Eldariof-ru has joined #ruby
jgrevich_ has joined #ruby
<pencilcheck> is it possible in ruby to get hold of a string with string interpolations and evaluate later?
<baniseterfiend`> pencilcheck: wrap it in a proc
n1x has joined #ruby
<pencilcheck> baniseterfiend`: cool, never thought about that before
zeroeth has joined #ruby
Teddy2steper has joined #ruby
gtuckerkellogg has joined #ruby
nirjhor has quit [#ruby]
WiiW has joined #ruby
<Cache_Money> seanstickle: I have successfully created a hash with key:value pairs of "Player Name":"Score"... It's not pretty but it works http://pastie.org/3748664
<seanstickle> Cache_Money: tighten it up a bit...
<seanstickle> And it looks right nice
<Cache_Money> seanstickle: definitely a lot cleaner
<Cache_Money> I've never built a webpage using Ruby, I've always used Rails. Is there a way I can take advantage of this script I just created to update fields on a webpage?
<seanstickle> Just write out HTML from your script
timonv has joined #ruby
Indian has joined #ruby
funkdified has joined #ruby
<funkdified> hi
<Cache_Money> Say for example I want to create tables like this http://pastie.org/3748721 But I want the score (XXXXXXX) to be dynamically generated from the corresponding value in the generated hash
<funkdified> anyone know how to gain access to #rubyonrails
<Cache_Money> funkdified: you need to register your nickname
<funkdified> where do you do that, thanks
<Cache_Money> type this "/msg nickserv help register"
<funkdified> maybe someone in here can help me .. or is rails talk off-topic
weszlem has joined #ruby
RORgasm has joined #ruby
nemesit has joined #ruby
jamesbrink1 has joined #ruby
nemesit has joined #ruby
CheeToS has joined #ruby
<Cache_Money> register your nickname, then identify your nickname with nickserv
<Cache_Money> 1. "/msg nickserv register"
<Cache_Money> 2. register
<Cache_Money> 3. "/msg nickerv identify"
eam has joined #ruby
<pencilcheck> how do I slice an array that only exclude the first 2 elements?
<Cache_Money> *2. Verify with email
flaggy has joined #ruby
burgestrand has joined #ruby
LMolr has joined #ruby
ZachBeta has joined #ruby
<jfelchner> pencilcheck: [1, 2, 3][2..-1] #=> [3]
Zolrath has joined #ruby
d34th4ck3r has joined #ruby
JohnBat26 has joined #ruby
<pencilcheck> jfelchner: cool, the negative numbers are not mentioned in the doc it seems
senthil has joined #ruby
<Mon_Ouie> They are
ukwiz has joined #ruby
<Mon_Ouie> "Negative indices count backward from the end of the array"
Cache_Money has joined #ruby
<jfelchner> pencilcheck: Works with strings as well.
<pencilcheck> oh
<pencilcheck> :P
<jfelchner> "Hello"[2..-2] #=> "l"
<jfelchner> errr "ll" :)
Cache_Money has joined #ruby
dfamorato has joined #ruby
kaneda has joined #ruby
<WiiW> "Hello"[2..-1] #=> "llo"
dfamorato_ has joined #ruby
lockweel has joined #ruby
mike has joined #ruby
proffalken has joined #ruby
pen_ has joined #ruby
codezombie has joined #ruby
d3vic3 has joined #ruby
Gesh has joined #ruby
ZachBeta has joined #ruby
Kireji has joined #ruby
ap0gee has joined #ruby
ZachBeta has joined #ruby
Indian has joined #ruby
alem0lars has joined #ruby
joukokar has joined #ruby
bier has joined #ruby
baniseterfiend` has joined #ruby
WiiW has quit [#ruby]
kirun has joined #ruby
Eldariof59-ru has joined #ruby
gift has joined #ruby
mfridh has joined #ruby
Morkel has joined #ruby
rushed has joined #ruby
joukokar has joined #ruby
mikeric has joined #ruby
Indian has joined #ruby
PehnisSujo has joined #ruby
sohocoke has joined #ruby
davidpk has joined #ruby
hackeron has joined #ruby
Eldariof27-ru has joined #ruby
musee has joined #ruby
_musee has joined #ruby
decaf has joined #ruby
musee has joined #ruby
kidoz has joined #ruby
c0rn has joined #ruby
weszlem has joined #ruby
RORgasm has joined #ruby
d34th4ck3r has joined #ruby
richardlxc has joined #ruby
weszlem has joined #ruby
tatsuya_o has joined #ruby
richardlxc has joined #ruby
francisfish has joined #ruby
peterhil has joined #ruby
CrazyPickles has joined #ruby
<CrazyPickles> anyone got any c++ experience and could tell me how in c++ I can get a value and pass it to another interger variable ?
<CrazyPickles> ahh int index = int index :D
apeiros_ has joined #ruby
<musee> :)
SuperNewb1 has joined #ruby
_ack has joined #ruby
<CrazyPickles> looks like I'm going to have to create a function that has a file iterator/3d model parser/loader I think
krusty_ar has joined #ruby
Foxandxss has joined #ruby
Deele has joined #ruby
richardlxc has quit [#ruby]
Eldariof-ru has joined #ruby
Floydzy has joined #ruby
waxjar has joined #ruby
Eldariof59-ru has joined #ruby
Sou|cutter has joined #ruby
nari has joined #ruby
mcwise has joined #ruby
greenarrow has joined #ruby
ephemerian has joined #ruby
musee has joined #ruby
niku4i has joined #ruby
davidpk has joined #ruby
dbgster has joined #ruby
_ack has joined #ruby
emmanuelux has joined #ruby
ThewyBread has joined #ruby
Derander has joined #ruby
mrsrikanth has joined #ruby
shruggar has joined #ruby
davidcelis has joined #ruby
<fowl> RUBY
libertyprime has joined #ruby
Pavel has joined #ruby
<shevy> CrazyPickles include ruby bindings
<bounce> heh. "how to write c++: include ruby bindings. make ruby do the work"
<bounce> but honestly now, there's better places to ask about C++ than in #ruby
frishi has joined #ruby
decaf has joined #ruby
KL-7 has joined #ruby
poorlilrichboy has joined #ruby
<fowl> RUBAH!
<fowl> i am your humble servant RUBAH
mashed has quit [#ruby]
<CombatWombat> RUBAH, ain't not one but you.
CodeFriar has joined #ruby
weszlem has joined #ruby
sbanwart has joined #ruby
ThewyBread has joined #ruby
mengu_ has joined #ruby
lkba has joined #ruby
tatsuya_o has joined #ruby
tuxaddicted has joined #ruby
shruggar has quit [#ruby]
<shevy> bounce well I think it would be cool if more C or C++ projects would use ruby
<shevy> but they seem to have a python fetish
<banisterfiend> shevy: hey :D
<shevy> now we just need to profit from the mess that is the python 3 transition
<banisterfiend> shevy: i saw you actually got many UPVOTES on reddit for once :P
<shevy> :(
<banisterfiend> shevy: congrats, it was a good comment
<shevy> I still hate everyone and everything
<shevy> especially all upvoters
<banisterfiend> shevy: even skyrim?
<shevy> well
<shevy> fowl is back ... I dont think I can still rant against it
<shevy> he is different, but back
<shevy> so I guess... skyrim is somewhere in the middle between being just a game, or something that steals people
<shevy> I used to play warcraft 3 a lot
<shevy> dont want to count how many hours died that way :(
<shevy> the rubyOS would be already finished without games!
<shevy> hmm
mutewinter has joined #ruby
<shevy> how much would the development of a rubyOS cost, in euro?
<shevy> probably too much
<Spaceghostc2c> More money than I ever want to own
iocor has joined #ruby
<somebody> shevy: what would a rubyOS be?
<Spaceghostc2c> somebody: Objectional! :p
<shevy> somebody hmm good question ...
<somebody> there is already a linux distro which uses ruby for all its scripts
<shevy> hmm which one is that?
<somebody> I don't remember the name of it
<Spaceghostc2c> Rubuntu, likely. :(
<banisterfiend> anyone know of a syntax highlighting lib for objc/c/c++ that has a permissive license and can highlight ruby code?
<fowl> rubyx, good luck finding it
<shevy> no idea banisterfiend
<somebody> Spaceghostc2c: no iirc it was pre-ubuntu
<somebody> though maybe there's more than one now
mdw has joined #ruby
<Spaceghostc2c> somebody: I was being facetious.
CodeFriar has quit ["Linkinus - http://linkinus.com"]
<shevy> well rubyX died a long time ago. I think there is some brazilian distribution which uses ruby scripts, i.e. for its installer
<shevy> in ruby-gtk
<shevy> I forgot the name :(
<Mon_Ouie> banisterfiend: Shelling out to pygmentize? :p
<banisterfiend> Mon_Ouie: no thx :P
<banisterfiend> Mon_Ouie: shelling out for every character press is kind of ugly ;) and porbably slow
<banisterfiend> objc seems kind of barren when it comes to this
<banisterfiend> ruby and python hvae a glut
<somebody> banisterfiend: the syntax highlighter can't just be in the language you are using; it is also going to have to be compatible with whatever internal representation you are using for colors :(
<shevy> does coderay not work?
<banisterfiend> somebody: im not an idiot ;)
<somebody> banisterfiend: I know
<shevy> hmm ok it is in ruby ...
<banisterfiend> shevy: Yeah
<somebody> banisterfiend: I'm just saying that your question isn't precise enough
<somebody> banisterfiend: but if you make it more precise, it might help you find an answer
<banisterfiend> somebody: thanks for the tip
<shevy> there was some small C library ... I forgot the name...
<fowl> banisterfiend, your objc interface, its just a client basically?
<gogiel> i want to extract and replace content from html files. any gem for doing that, or just stick to nogokiri?
<banisterfiend> fowl: Yeah
etehtsea has joined #ruby
<shevy> gogiel you mean you wanna edit a html file from within ruby ?
<gogiel> shevy: yes, but i want to edit content. i don't care about xpaths, html tags etc.
<somebody> gogiel: there's also hpricot
<somebody> I can't remember which of the two I liked better
<shevy> hmm
<gogiel> but after editing i want to put everything back. don't want to only extract text
<somebody> definitely love/hate with both of them
<shevy> cant remember any gem that does that
<gogiel> like edit html content in place
<somebody> gogiel: is there no way to ask for "everything before" and "everything after" ?
lkba has joined #ruby
<fowl> gogiel, write your own regex
<fowl> >_>
<gogiel> fowl: regex are no good for parsing xml like files
<gogiel> if there's no such gem i will make my own using any html/xml parsing lib
<fowl> oh you could do it, you just have to forget about having nice looking code
<gogiel> fowl: yeah, but i don't want to see that regexp ;)
<gogiel> fowl: yeah, i'll use nokogiri
moshef has joined #ruby
odilon has joined #ruby
<shevy> gogiel yay!
<shevy> that is the old ruby spirit
<shevy> write things from scratch
<gogiel> shevy: just wanted to save some time
<gogiel> wanted to made sure i'm not making something that's already done
irmbrady has joined #ruby
fr0gprince_mac has joined #ruby
decaf has joined #ruby
weszlem has joined #ruby
d34th4ck3r has joined #ruby
species has joined #ruby
johndbritton has joined #ruby
<shevy> oh man
<shevy> sometimes I manage to compile things... sometimes not
<shevy> there are cursed days
sgmac has joined #ruby
<shevy> today, everything that failed yesterday, suddenly compiles :(
cafesofie has joined #ruby
blacktulip has joined #ruby
<matti> shevy: Universe hates you.
<shevy> not today!
<shevy> yesterday true :)
<matti> ;]
lkba has joined #ruby
sgmac has quit [#ruby]
linoj has joined #ruby
sgmac has joined #ruby
<shevy> but see, that's what I am going to do
<shevy> a platform to replace all the shell scripts, GNU autoconfigure and all other components that constitute the GNU craptools
<shevy> in ruby!
sgmac has quit [#ruby]
<fowl> i like to imagine shevy sitting in a lavish lair, with a red light over his head, wringing his hands and laughing forebodingly when he talks like this :)
falena has joined #ruby
<shevy> hmm
<shevy> except for the laughing
mikeric has joined #ruby
<shevy> I am more like hitting angrily on things
irmbrady has joined #ruby
<fowl> wth, how is the sound of music on my tv
bubu has joined #ruby
mdw has joined #ruby
weszlem has joined #ruby
n1x has joined #ruby
d3vic3 has joined #ruby
shruggar has joined #ruby
h4mz1d has joined #ruby
richardlxc has joined #ruby
Asebolka has joined #ruby
Russell^^ has joined #ruby
ThewyBre_ has joined #ruby
mdw_ has joined #ruby
phinfonet has joined #ruby
indeterminate has joined #ruby
<phinfonet> hi
poga has joined #ruby
td123 has joined #ruby
<shevy> hi phinfonet
<shevy> learning ruby?
<phinfonet> yes
richardlxc has joined #ruby
<fowl> RUBY!
<phinfonet> shevy: you use a desktop framework with ruby?
richardlxc has joined #ruby
fr0gprince_mac has joined #ruby
sgmac has joined #ruby
elalande has joined #ruby
td123 has joined #ruby
<d34th4ck3r> why there is no rubysoc these years?
AndChat| has joined #ruby
<shevy> phinfonet hmm not really ... I used to build some ruby-gtk apps years ago
<phinfonet> hmm
<phinfonet> i`m try bowline
<phinfonet> but no works
<phinfonet> the ruby-gtk broke my rvm
<phinfonet> ?(
<phinfonet> :(
dn2k has joined #ruby
evilgeenius has joined #ruby
<richardlxc> who use irssi?
<musee> obv not me
RORgasm has joined #ruby
<richardlxc> and any good script?
<musee> i don't really use any scripts other than freenode's cap_sasl.pl
<richardlxc> i will try it
<dn2k> i'm using irssi
<musee> it's only for connecting to freenode via SSL
<musee> and authenticating oneself
<richardlxc> ok
richardlxc has joined #ruby
dql has joined #ruby
richardlxc has joined #ruby
guestx has joined #ruby
virunga has joined #ruby
LBRapid_ has joined #ruby
LBRapid_ has joined #ruby
dn2k has quit [#ruby]
dn2k has joined #ruby
lkba has joined #ruby
mickn has joined #ruby
LBRapid_ has joined #ruby
richardlxc has joined #ruby
gurugeek_ has joined #ruby
lkba has joined #ruby
Drewch has joined #ruby
timonv has joined #ruby
sgmac has quit [#ruby]
bluOxigen has joined #ruby
Sailias has joined #ruby
antanix has joined #ruby
phinfonet has joined #ruby
peaple has joined #ruby
peaple has quit [#ruby]
<antanix> hi there, here is a Ruby metaprogramming question: is it possible to set the provacy of a method programmaticaly?
richardlxc has joined #ruby
<antanix> say I have a public class method called Entry::create. I would like to change it into a protected method when my module is included/extended
<cryptops1> no
<cryptops1> i usually set the provolone to 30 seconds in the microwave and then eat it
<cryptops1> has anyone attempted a ruby to C translator?
thone_ has joined #ruby
joukokar has joined #ruby
dql has joined #ruby
<shevy> cryptops1 hmm
<shevy> not sure
<shevy> antanix you could try to act on a hook-event
<Mon_Ouie> I doubt transcompiling Ruby to C would be more useful than compiling it at runtime
<fowl> <cryptops1> i usually set the provolone to 30 seconds in the microwave and then eat it
<fowl> you eat provolone by itself?
<antanix> shevy: thanks, that helps
<shevy> antanix I find the hooks in ruby a bit cumbersome to use though
KL7 has joined #ruby
mdhopkins has joined #ruby
<antanix> shevy: Yep, I guess all Ruby metaprogramming is powerful but also prone to be abused...
Squarepy has joined #ruby
<shevy> yeah
alx- has joined #ruby
<antanix> shevy: The reason why I am looking into it is that I am monkey patching an existing library, and now I want to prevent exteternal calls to a specific method which my module is messing up with
<shevy> hehe complicated
kvirani has joined #ruby
<fowl> kill it mit fire
Squarepy has joined #ruby
<antanix> shevy: yep, sometimes this is an alarm bell.. will consider alternative/simpler solutions later
mengu_ has joined #ruby
mengu_ has joined #ruby
raz has quit ["*fump*"]
trivol has joined #ruby
mcwise has joined #ruby
_|christian|_ has joined #ruby
alek_b_ has joined #ruby
strife25 has joined #ruby
tewecske has joined #ruby
<kish> this is cool
<kish> ruby1.9.1 -e "puts(Time.now + 172800)"
bawerd has joined #ruby
<kish> how do i find ruby source code so i can read it and learn how programming works
<kish> what's the closest place for source
seanstickle has joined #ruby
<shevy> kish github
nimred has joined #ruby
<shevy> when you understand all that goes inside those two .rb files, you should know about 90% of ruby
zeroeth has joined #ruby
nif has joined #ruby
<kish> thankws
<kish> can i rip ruby source code from within the ruby command line?
<shevy> or other github ruby projects
<kish> i know you can do that in perl
<shevy> it may be possible, do gem install method_source, then use method_source
<shevy> hmm
<shevy> or did it have another name...
<kish> another thing: i have to execute ruby by typing ruby1.9.1 in a terminal, is this normal?
<shevy> foo = A.instance_method(:foo).source_location
<shevy> perhaps it was .source_location
<kish> i dont have anything called gem installed
<shevy> and https://github.com/ngty/sourcify may be useful for that too
<shevy> wait what
<shevy> you have ruby 1.9.x but not gem?
<shevy> you must use the crippled ruby from debian, I bet
<kish> that's right
<kish> should i uninstall it?
<shevy> there is no easy solution
dql has joined #ruby
<kish> maybe i should go with another language
<shevy> but I can tell you what people who use the source do. you can get the command "gem" from rubygems source package like http://rubyforge.org/frs/?group_id=126&release_id=46657
<shevy> it's not ruby's fault.
<shevy> blame debian
<shevy> in ruby 1.9.x source distribution, gem is available
<shevy> but debian developers hate ruby
zeroeth has joined #ruby
Drewch has joined #ruby
ZachBeta has joined #ruby
<td123> is there any use case for using ruby gems provided by debian?
Teddy2steper has joined #ruby
<kish> okay so i must compile ruby from source. i can do that, easy
<bawerd> anyone tried to build ruby 1.9.3-p125 on smartos (opensolaris derived) ?
<shevy> dunno, hopefully they made sure that it "works" properly when you stay within debian
<bawerd> I get this when doing 'make test': http://pastie.org/3750306
<shevy> kish, if you decide to abandon debian ruby, you could also consider using RVM - http://beginrescueend.com/
<kish> i dont want to use rvm
<species> apt installed like ruby 1.7 and rails 0.5 from the ubuntu repos :|
<species> i was fuming
<shevy> hehe
<shevy> come on... not even debian is so slow to use 1.7 ... :P
lkba has joined #ruby
<yxhuvud> hmm, modern ubuntus do ruby 1.8.7 by default, and 1.9.2 if you ask it to.
<shevy> \o/
Sou|cutter has joined #ruby
<species> ok i was exaggerating, but it did install an ancient version of rails
* kish gone
<species> i tried to follow a tutorial
<yxhuvud> most retarded thing about that is that the package with 1.9.2 is called 1.9.1 ..
<kish> ill see what i cn do when i return later
<yxhuvud> species: upgrade rubygems, and use that to install a modern version instead
strife25 has joined #ruby
<species> its OK, im using rvm now
<species> i dont like it, but its a solution
<species> im still only learning anyay, doing the koans
<species> got to like 30 or something
<species> already thought "wtf ruby" a few times
<species> i come from a c++ background... i thought C# was exotic
<species> ruby is like WOAH *slap in the face*
<yxhuvud> well c# is still a static language.
<yxhuvud> anything special you were surprised by?
silverhand has joined #ruby
<species> array behaviour
<silverhand> How do I get the name of a class extending a module?
<species> im used to "everything is an object" from javascript but ruby takes it to a whole new level
<silverhand> (From within the module that is being extended)
<shevy> yxhuvud hahahaha they call the 1.9.2 package 1.9.1???
<species> also object id's for fixnums; thats a wtf moment
<species> false being 2 is also wierd
<shevy> silverhand hmm what do you need? object.name ?
<species> false being an OBJECT is wierd as well
<yxhuvud> shevy: yes. I think they motivate it by that is the c-api version of it. Very helpful for the libraries that depend on newer non-C code ..
<shevy> oops
<shevy> x.class
<shevy> species, fixnums are a bit cheaters
<yxhuvud> silverhand: define self.extended base; ..; end in the module, and in the body of that method base is your class that you extends with
<silverhand> shevy: I need to refer to whatever CLASS is extending a module, from within the module
<shevy> x = 5; def x.hi; puts "hi"; end
<shevy> TypeError: can't define singleton method "hi" for Fixnum
<silverhand> yxhuvud: I don't understand. There isn't a direct call I can make to get the extending class?
<yxhuvud> silverhand: You define self.extended in the module. That method takes an argument hcih is the extending class.
<yxhuvud> it will get invoked automatically when you extend it
<yxhuvud> species: what should false be if not an object?
<species> well in c++ its a boolean literal
<species> there is no The False Object anywhere
<species> its not a problem, just different
<shevy> at least you know C++
<shevy> I got lazy after using ruby for a longer time :(
<cryptops1> uh no dumb-shit, it's called a translator
<cryptops1> there's tools for this
c_rl has joined #ruby
<cryptops1> do you know what a construction worker is?
<fowl> uhh
<cryptops1> they use a hammer and other tools to turn bricks into buildings
<shevy> lies!
<cryptops1> its not called god
<species> buildings werent made by man, they were made by god 3 days ago
<cryptops1> there's perl<->C , V8 javascript engine converts to C actually
<shevy> I use robots to build houses
<fowl> cool
<cryptops1> god made a building ...
<fowl> go convert some code then you dumb nigger
<cryptops1> in My Documents
<fowl> or be cool and write ruby
<cryptops1> i think people in general like the ruby syntax style
<fowl> either way -- please stfu
* species distance himelf from the conversation now
shaggy2dope has joined #ruby
<shevy> ruby has a lot of crappy syntax
<shevy> like ->
<cryptops1> it's a totally legitimate question among established communities
<cryptops1> does ruby natively support unicode?
<shevy> here is a lengthier explanation http://blog.grayproductions.net/articles/ruby_19s_string
<shevy> abc = "abc"; puts abc.encoding.name # >> US-ASCII
<shevy> abc.force_encoding("UTF-8"); puts abc.encoding.name
andrewhl has joined #ruby
wallerdev has joined #ruby
toddmorrill has joined #ruby
brngardner has joined #ruby
d3c has joined #ruby
<toddmorrill> Hi guys, I just started learning ruby, come from a c++ background and first time on channel :)
c_rl has quit [#ruby]
<burgestrand> \o.
c_rl has joined #ruby
Chryson has joined #ruby
<Squarepy> \o/
<shevy> hey burgestrand
<shevy> what happened to your arm?
richardlxc has joined #ruby
<burgestrand> I lowered it
<shevy> hmmm
<Squarepy> hmmm
* shevy scoots away from burgestrand
<shevy> \o/
<shevy> toddmorrill you are like species here then
<shevy> <species> i come from a c++ background... i thought C# was exotic
<toddmorrill> thanks
<shevy> hmm though I have to say, he is right, C# is strange indeed
<Squarepy> F#
mdw has joined #ruby
<rking> ...and strangely popular.
<fowl> c# is legit
<shevy> yeah
Sailias has joined #ruby
<shevy> wheeee! C wins finally!
<shevy> wth is NXT-G ...
<toddmorrill> I am starting with just doing ruby, and will add rails later, for my first script I am making something that scrapes reedit, and returns a list urls of subreddit images (which i will then turn into some screensaver)
<shevy> omg, LEGO ... :(
<shevy> good toddmorrill
<shevy> use classes !
<toddmorrill> so i am trying to parse headers atm, and wondering which class to use
<shevy> most who start with ruby dont use classes, nor methods, nor have any real structure in their code. it is horrible to look at it
<toddmorrill> ahh, yea i am using classes
<shevy> dunno... open-uri ... net-something, not sure
<shevy> It's a bit fighting through some docu ... http://ruby-doc.org/stdlib-1.9.2/libdoc/open-uri/rdoc/OpenURI.html
eam has joined #ruby
<yxhuvud> shevy: more interesting is that it claims php is half as big as two years ago
<toddmorrill> I have
<toddmorrill> response = RestClient.get imgurl, :accept => 'image/jpeg'
<toddmorrill> puts response.headers
<toddmorrill> resonse.headers.inspect
<shevy> hmm no idea what is RestClient
<shevy> it was not written by you though or?
<yxhuvud> toddmorrill: use a pastie of some sort please.
<toddmorrill> ok sorry
<Squarepy> lesson 1
<shevy> otherwise I would be surprised that you already use :accept ;)
<yxhuvud> shevy: RestClient is a nice rest client library
<shevy> ok
<shevy> never saw it before
<shevy> tells you how www-savvy I am :)
<yxhuvud> it's been around quite long
delinquentme_ has joined #ruby
Kireji has joined #ruby
<delinquentme_> Id try it but im not really sure what they're doing here...
<yxhuvud> toddmorrill: but I have no idea to the answer of the question though. I'd guess you shouldn't parse headers manually but instead use accessors for them. Do you seen anything relevant when you do response.methods.sort?
sgmac has joined #ruby
sgmac has quit [#ruby]
<toddmorrill> i am commenting my code bether :)
<cryptops1> never ask if anything is an issue with ruby in #ruby
<rking> delinquentme_: I assume so, yes. That would be an issue in C or Asm.
<toddmorrill> yxhuvud: i have to run a min (GF and breakast calling) thanks for your intent to help, i will ping u when i am back, i am looking to ideally turn the results into a hash key set…
kawa_xxx has joined #ruby
nemesit|osx has joined #ruby
wallerdev has joined #ruby
<toddmorrill> when i run inspect on the item that restlient returns i get unknown method… so i guess it doesn't return an object? although i thought all items were objects
<rking> delinquentme_: Or at the grocery store. Which would be easier, to purchase 1440 eggs by buying 120 cartons of 12, or by buying 12 boxes that contain 10 cartons each?
<delinquentme_> yeah im reading it again
<yxhuvud> toddmorrill: sounds like a typo in your code.
<toddmorrill> code - https://gist.github.com/2338068
RORgasm has joined #ruby
<rking> delinquentme_: You could simplify it by looking at is as int[100000][1] vs int[1][100000]
timonv has joined #ruby
pedrohenrique has joined #ruby
<toddmorrill> shouldn't you be able to inspect strings?
<yxhuvud> you are.
InfiniteJest has joined #ruby
<toddmorrill> I don't understand why if s = 'dfdsd", running s.inspect on next line fails for me
<gogiel> toddmorrill: not sure if trolling of stupid
<yxhuvud> 'fasd" is not a valid string
<rking> gogiel: That's not necessary.
Eldariof-ru has joined #ruby
<toddmorrill> i mean "dfsdfsd"
phinfonet has joined #ruby
<yxhuvud> works for me.
<toddmorrill> i can puts s.inspect but it just returns the string, thought there would be some info in object
<toddmorrill> like the length or somethng
<rking> toddmorrill: If s == 'asdf'; then s.inspect will definitely work.
<gogiel> toddmorrill: string is a string. there's no extra information
<yxhuvud> if you want the length, ask the string for its length (or size). don't use inspect
<rking> toddmorrill: Nah, .inspect doesn't mean "Show me every possible fact about this object." It only means, "Convert this into something suitable for a debug print."
<toddmorrill> ok thanks
<toddmorrill> i am just getting started, on this path, and i like getting a firm hold of the basics
<toddmorrill> i expected more
<rking> toddmorrill: You could easily define Object.tminspect that does more stuff, and override it per class as you need.
<toddmorrill> thanks
c_rl has joined #ruby
quest88 has joined #ruby
richardlxc has quit [#ruby]
savage- has joined #ruby
richardlxc has joined #ruby
MissionCritical has joined #ruby
<richardlxc> uptime: 35m 2s
<richardlxc> hello
<richardlxc> who use irssi?
<rking> richardlxc: Me and probably most of the people in #irssi
<richardlxc> wow
<richardlxc> i now use putty on my phone to connect to my pc
<rking> richardlxc: Yep, I started doing something similar, recently, and I like it.
<richardlxc> yeah
<richardlxc> i will go to sleep
philips has joined #ruby
<richardlxc> good night everyone
<rking> Later!
Bartzy has joined #ruby
<Bartzy> Hi
<Bartzy> How do I see description for a gem ?
<Bartzy> from the command line ?
<rking> Bartzy: One you've yet to install?
<Bartzy> rking: Yes.
<Bartzy> rking: And I'l extend my question to ones that I did install ?
eph3meral has joined #ruby
<rking> Bartzy: Hrm, I'm not sure. I use Google, but there's probably another way.
lkba has joined #ruby
<Bartzy> yeah I want some 'gem show' :p
<rking> Bartzy: For the one's you did install I'd recommend "gem server" then look at http://0.0.0.0:8808
<rking> Bartzy: Or, of course, load up pry on it.
<Bartzy> pry ?
<rking> Bartzy: gem install pry, for sure. It's a far better "irb"
<rking> Bartzy: It keeps the context of where you are with "cd"... so you can do "cd String" then "ls" and see stuff about String. You can do "? 'abc'.reverse" and see dos for the String#reverse method, or "$ 'abc'.reverse" to see the source of that method (though for that particular case you'll need pry-doc so you can see inside the core methods), and it has gist support builtin, and probably 100s of other things I don't yet know about.
<rking> s/dos/docs/. No Microsoft allowed. =|
rippa has joined #ruby
moshef has joined #ruby
mxweas_ has joined #ruby
apeiros_ has joined #ruby
io_syl has joined #ruby
io_syl has joined #ruby
dagnachewa has joined #ruby
Beakr has quit [#ruby]
<shevy> I wanna see DOS reversed!
<apeiros_> SOD
<apeiros_> there
<shevy> argh :(
<apeiros_> glad to be of help :-p
<Bartzy> Can I ask about capistrano here ? :p
doug11 has joined #ruby
<rking> Bartzy: Might want to try #capistrano, first. Not sure how active it is.
<Bartzy> rking: Not so much :|
<rking> Ahh.
<Bartzy> I'll ask, , maybe someone knows
<rking> Then shoot.
<Bartzy> Capistrano question: How can I tell if a deploy was unsuccessful inside a task that is specified to happen after the deploy task ?
<Bartzy> Also, how much time did the deploy took?
* rking doesn't know, and can't drop what he's doing to find out. I hope you find out for the both of us, though.
<shevy> no idea, dont use capistrano
ZachBeta has joined #ruby
<shevy> but the word alone makes me want to eat pizza :(
* rking , too. =(
<rking> I won't list all the software things that make me hungry, because by the end I'll be starving -- but trust me.
jetblack has joined #ruby
guardian has joined #ruby
<guardian> hi there
<guardian> never really used ruby, i want to use nanoc. just installed lion on my mac laptop. should I rather sudo gem install nanoc? go homebrew? go rvm?
<guardian> what would you recommend
<any-key> rvm
ZachBeta has joined #ruby
<any-key> rvm gem install nanoc
<any-key> oops
<any-key> make that "rvm all do gem install nanoc"
mikeric has joined #ruby
<guardian> ok
waxjar has joined #ruby
JohnBat26 has joined #ruby
wroathe has joined #ruby
<wroathe> I have a require_relative at the top of my gemspec that looks like this: require_relative 'lib/gem_name/version'
<wroathe> and I get cannot infer basepath when I run gem build
<wroathe> Any idea what's up?
tommyvyo has joined #ruby
tobym_ has joined #ruby
ceej has joined #ruby
mneorr has joined #ruby
MrGando has joined #ruby
mikeric has joined #ruby
c_rl has joined #ruby
fr0gprince_mac has joined #ruby
atmosx has joined #ruby
tomzx has joined #ruby
<shevy> no idea wroathe sorry
<shevy> ok... which of the testing frameworks for ruby is fun to use?
<shevy> or, if none is fun ... which is littlest work?
<rking> shevy: I certainly haven't tried them all, but what I've used of rspec has been pleasant, for sure.
<seanstickle> Diaspora's test framework was not much work
<seanstickle> "Write code, post to Github, let other people find the problems"
<seanstickle> You might try that :)
<shevy> hmm hmm hmm
tommyvyo has joined #ruby
<shevy> decisions ...
noyb has joined #ruby
h4mz1d has joined #ruby
Teddy2steper has joined #ruby
dfamorato has joined #ruby
dfamorato_ has joined #ruby
mattp_ has joined #ruby
kevinbond has joined #ruby
danielvdotcom has joined #ruby
jgrevich has joined #ruby
pepachino has joined #ruby
c_rl has joined #ruby
Eldariof59-ru has joined #ruby
eph3meral has joined #ruby
<shevy> note to self, should I ever make a programming language, I'll try to reduce the amount of decisions one has to do a lot
mattyoho has joined #ruby
<shevy> I swear the ruby toolkits are so dead
sharms_ has joined #ruby
Indian has joined #ruby
QKO has joined #ruby
sharms has joined #ruby
LMolr has joined #ruby
Morkel has joined #ruby
Clordio has joined #ruby
pac1 has joined #ruby
elalande1 has joined #ruby
Cache_Money has joined #ruby
simao has joined #ruby
Eldariof-ru has joined #ruby
startling has joined #ruby
flaggy has joined #ruby
mcwise has joined #ruby
<bawerd> anyone in this channel that runs ruby on OpenSolaris/NetBSD/Illumos?
<Kovensky> hmm
cloke has joined #ruby
<Kovensky> is there a way to make a regexp such that I can give arguments to the match portion
<Kovensky> or do I need to keep it stringified and insert the arguments in it before running the match
<yxhuvud> /#{"hello"}/
<Kovensky> oh, I read the regexps from a yaml file
<Kovensky> it's sth like
linoj has joined #ruby
<Kovensky> { defines: [ regex1: ...%argument%... ], accept: [ { regex1: name1 }, { regex1: name2 }, ... ] }
<shevy> looks simple
<Kovensky> so after loading it'd behave as if the yaml had been { accept: [ ...name1..., ...name2... ] }
<Kovensky> I can just do the replacements myself (by keeping the regex stringified and rewriting accept: in memory), but it'd be cool if I could just compile regex1 and feed the arguments as needed
davidd___ has joined #ruby
snearch has joined #ruby
mxweas_ has joined #ruby
jamespharaoh has joined #ruby
domenico has joined #ruby
shadoi has joined #ruby
<domenico> ciao a tutti
<domenico> !lista
<Kovensky> ...even on freenode you have these bots? :S
<alindeman> :(
<alindeman> People still use IRC for file sharing in a lot of places
abstrusenick has joined #ruby
artOfWar has joined #ruby
danielvdotcom has quit [#ruby]
artOfWar has joined #ruby
guestx has quit [#ruby]
c_rl has joined #ruby
guestx has joined #ruby
guestx has quit [#ruby]
jarred has joined #ruby
riyonuk has joined #ruby
<riyonuk> Can someone tell my why the script runs, but I don't see the .zip file anywhere? :/ - http://pastie.org/3751236
alem0lars has joined #ruby
<toddmorrill> any noobs in the room that want to collaborate on a learning project? I am doing my first ruby script that basically scrapes reddit for images, and will put them on a rotating gallery, i figured might as well do it with someone who is learning, and we can collar via github, and learn together
c_rl has quit [#ruby]
<toddmorrill> this would add also the possibility of getting my git skills up :)
c_rl has joined #ruby
Sailias has joined #ruby
c_rl has quit [#ruby]
Kireji has joined #ruby
eam has joined #ruby
proxie has joined #ruby
havenn has joined #ruby
Rizzle has joined #ruby
<Spaceghostc2c> toddmorrill: git goin'!
<Bartzy> real ruby newbie : How do I specify everything other than 'y' or 'Y' in an if statement ?
nlc has joined #ruby
mxweas_ has joined #ruby
berserkr has joined #ruby
jesly has joined #ruby
MasterIdler has joined #ruby
<jesly> in eventmachine does the call to an external function via ffi happens in a non-blocking manner??
Rizzle has quit [#ruby]
ViperMaul has joined #ruby
kevinbond has joined #ruby
<gurugeek_> anyone interested in a ruby freelance job ?
Ilithya has joined #ruby
lkba has joined #ruby
td123 has joined #ruby
Teddy2steper has joined #ruby
<toddmorrill> Bartzy: want to join my ruby nubby club?
<toddmorrill> Bartzy: looking for people to work on a collar learning prom for noobs
<jesly> toddmorrill: nubby club!! wots that??
<toddmorrill> newby club
<toddmorrill> :)
<jesly> toddmorrill: i m8 be interested
<eph3meral> anyone know how I can preview what the table of contents will look like on rubydoc.info when I push my gem to rubygems.org ?
<eph3meral> I'm just using Markdown
<Bartzy> I settled on =~ /[Yy]/ :p
<jesly> shevy: wake up.. :) i need help
<shevy> what
<jesly> shevy: in eventmachine does the call to an external function via ffi happens in a non-blocking manner??
_ack has joined #ruby
iocor has joined #ruby
<shevy> I never used eventmachine nor ffi
<jesly> shevy: okay :(
<shevy> if the docu does not show it, these projects suck, in which case I recommend you to drop both :P
<jesly> shevy: i wish i could. but it will earn me a F in college
Floydzy has joined #ruby
<toddmorrill> jesly: i am refactoring the code now, so its a little messy…. the master is in a refactored state
<jesly> toddmorrill: wow!! i would love to join. r8 now i'm in middle of a mess.. need to clean it up
<jesly> SOS!!
<toddmorrill> skye me at morrillt
<toddmorrill> i have a yoga class now
Squarepy_ has joined #ruby
<jesly> toddmorrill: does it work by using josn o/p from an api??
<jesly> fairly simple i guess.
Squarepy_ has joined #ruby
<jesly> I would suggest you to keep ur git repo slightly clean
<jesly> put the functionalities in a folder named lib
<jesly> and tests in test folder
<jesly> :)
<Spaceghostc2c> Make sure to take it out for a walk often. Air it out, keep it groomed.
burgestrand has joined #ruby
<jesly> SOS!! Any FFI/Eventmachine experts??
Axsuul has joined #ruby
Axsuul has joined #ruby
<jesly> i am running on a segmentation fault in ruby. I thought it was only achievable in C
<burgestrand> jesly: you can do it with ffi as well, real easy
Axsuul has joined #ruby
<jesly> i know
<jesly> i done it with ffi
<burgestrand> Figured as much, what’s your actual question?
<jesly> now the issue is that the orginal C function can handle it w/o a buffer overflow
<jesly> but ffi cant
<examancer> My girlfriend has decided she wants to learn programming. She has a strong math/accounting background, but no real exposure to coding. Anyone have any good book recommendations for someone who doesn't yet know the basics?
<jesly> i was developing a bufferover flow attack blocker
<shevy> ...
<burgestrand> examancer: chris pine’s Learn to Program
nfluxx has joined #ruby
<burgestrand> examancer: also, math does not help much when it comes to programming, different kind of thinking
<shevy> jesly, your college is strange
<jesly> and now my blocker is running into a buffer overflow
ceej_ has joined #ruby
<shevy> examancer tell her to start here http://pine.fm/LearnToProgram/?Chapter=00 work through it as quickly as possible
<jesly> shevy: i know. I been assigned an IEEE paper, i need to implement it up
<examancer> burgestrand: higher level math uses lots of functions. they are conceptually similar to functions/methods in programming
<burgestrand> examancer: sure they are, I’m just saying math is not a dead giveaway somebody can learn to program
<examancer> feeding input, running it through logic, and getting an output... its a decent conceptual basis to start with
<examancer> yeah, i see what you're saying
<examancer> doesn't mean she can program, but means she has a leg up on someone who doesn't know math very well
<burgestrand> Yeah but it’s not math :p
<examancer> it is math. my rails/sinatra/whatever apps are a bunch of formulas that take input and produce output. the difference is the math is mostly with strings instead of numbers
altivec_ has joined #ruby
<jesly> burgestrand: pastie here http://pastie.org/3751438
<shevy> examancer there is no substitute for writing code on your own
Tearan has joined #ruby
<jesly> examancer: ruby is functional programming language??
<shevy> if she is a supermather she could use haskell
<examancer> shevy: ok. not sure what that is in response to though. maybe you mean she probably didn't write the functions she used in math class? that's not always true, but i guess i see the point
<shevy> every time I read what is a monad, I end up being wtf-ed
<jesly> shevy: amen to that
<examancer> jesly: ruby can absolutely be used as if its a functional language
<shevy> examancer, you wrote that programming is math. I tell you, I stink in math but I think I am ok in ruby
<shevy> I totally and will forever more suck in haskell
<burgestrand> Haskell is just a different way of thinking. Closer to the mathy side of things, but still not close.
<shevy> there is one part of math which comes close to programming, which is logic
<Squarepy> hmm
<burgestrand> Yeah, but even then, how often are you exposed to complex logical expressions?
<Squarepy> lambda-calculus
<shevy> a + b = c
<shevy> :D
<examancer> shevy: i think you'll find that the better you become and programming the easier it is to go back and conquer the math that was hard for you
<shevy> I find math very difficult
<jesly> can anybody help me with my poor buffer overflow here.. :P http://pastie.org/3751438
<shevy> jesly stop writing a virus!
<examancer> the real thing people who are good at math learn is not how to be good at "doing" math, but good at leveraging the formulas and logic to solve actual problems... THAT is very similar to programming
<burgestrand> jesly: the backtrace is not giving much except telling us where the error stems from
<burgestrand> jesly: (proxy.rb line 4, ud_disassemble method)
<shevy> and jesly stop segfaulting ruby pls :P
<burgestrand> Most likely you’re feeding it something it does not expect and it screams at you
<burgestrand> examancer: math is a huge topic
<jesly> i am feeding it a 12k characters long request/string
<shevy> examancer perhaps. for me, math helped me nothing at all in programming though.
<jesly> buffer overflow happen only at that length of input
<shevy> the only thing that really helps in programming is:
<shevy> practice !
<examancer> shevy: you didn't learn how to use variables from math? the concept of a symbol holding some value was a lot easier to tackle in programming after i learned it in algebra
<examancer> shevy: yes, like just about every skill :-)
<shevy> symbol?
francisfish has joined #ruby
<examancer> x, y, z, whatever..
<jesly> shevy: my project is all about segfaulting :(
<shevy> jesly, good!
<shevy> examancer, oh, the logic part of math is fine
<shevy> if I have 12 apples and 5 banans
<shevy> *bananas
<shevy> will I be hungry in 5 days if I eat 0.8 apples and 1.3 banans per day?
<shevy> man
<shevy> my keyboard hates bananas
<burgestrand> I’d be hungry in less than one day
<examancer> the word problems you had to solve all throughout your K-12 education probably did more to prepare you for programming than you realize
<shevy> burgestrand I once tried it for a diet... only water + 1 apple per day
<shevy> it worked very well
<shevy> then I started to eat like usual again
<burgestrand> shevy: for how long?
<shevy> there I failed
<shevy> burgestrand about 2 months. I have to admit though, I also ate a little bit of chocolate
<examancer> yes, starving yourself is an effective (and unhealthy) way to loose some weight
<shevy> but that was still ok
<shevy> only when I stopped with the apple (and chocolate) did I regain it all
BSaboia has joined #ruby
<shevy> losing weight is much easier than holding the weight :(
<jesly> i should have done it in C/ Java. OMG!! ruby hates me :(
doug11 has quit [#ruby]
<shevy> yes
gurugeek_ has quit [#ruby]
<shevy> when you want to build a pyramid
<shevy> and you use sand for it
<shevy> dont be surprised if the wind will hate your pyramid
<jesly> shevy: it seems i need to cheat on my project.. :D smoke it up.. no one knows ruby. for profs it alien script :D
Drewch has joined #ruby
atmosx has joined #ruby
<shevy> know what
<shevy> write something else in ruby
<shevy> and use C instead
<shevy> :P
<jesly> no time... i need to present it in 3 days
emmanuelux has joined #ruby
zetradr has joined #ruby
wroathe has joined #ruby
strife25 has joined #ruby
_|christian|_ has joined #ruby
Shamgar has joined #ruby
robbyoconnor has joined #ruby
atmosx_ has joined #ruby
Teddy2steper has joined #ruby
joaoh82 has joined #ruby
Araxia_ has joined #ruby
senthil has joined #ruby
ablemike has joined #ruby
atmosx_ has joined #ruby
<eph3meral> given an array such as [0.1, 0.2, 0.5, 0.2, 0.4, 0.2, 0.6, 1.3, 1.9, 0.8] how could I find the max value that's also under a threshold, say, the largest number under 0.7?
<eph3meral> specifically I'm wondering if there is a standard for doing this or if I should just .select() and then .max()
KL-7 has joined #ruby
<atmosx_> eph3meral: this sounds like a statistics question, not sure that there's a specific method
<atmosx_> eph3meral: there might be a gem if you google though
<Mon_Ouie> You can do max with a block, and return false when the compared element is greater than your threshold
RORgasm has joined #ruby
dfamorato has joined #ruby
tobago has joined #ruby
<eph3meral> Mon_Ouie, interesting, cool thanks
jgrevich has joined #ruby
Kireji has joined #ruby
mitu has joined #ruby
sam113101 has joined #ruby
vandemar has joined #ruby
looopy has joined #ruby
robdodson has joined #ruby
robdodson has joined #ruby
zakwilson has joined #ruby
waxjar has joined #ruby
Araxia has joined #ruby
Deele has joined #ruby
kmurph79 has joined #ruby
Synthead has joined #ruby
davidpk has joined #ruby
joaoh82 has joined #ruby
<Kovensky> is there a way to run a map on a Hash?
<Kovensky> as in, I want to run a block where I have both key and value available, and I want the block's result to replace the existing value for the current key
helichopter has joined #ruby
greenarrow has joined #ruby
shaggy2dope has joined #ruby
Araxia has joined #ruby
<rcs> You can do something like "hash = { one: 1, two: 2 }; hash.each { |k,v| hash[k] = v*v }"
d34th4ck3r has joined #ruby
<rcs> Or f you want non-destructive: "> hash = { one: 1, two: 2 }; new_hash = Hash[hash.map { |k,v| [k,v*v] }]"
nif has joined #ruby
<Kovensky> < rcs> You can do something like "hash = { one: 1, two: 2 }; hash.each { |k,v| hash[k] = v*v }" <-- wouldn't that break the iterator, or does iterate on a copy of keys
<Kovensky> +it
<rcs> Huh. That's a damn fine question. I don't actually know. hash.keys.each and hash[k]*hash[k] ?
ryanf has joined #ruby
dbgster has joined #ruby
<Kovensky> I'm doing it like a mix of your idea
<Kovensky> "hash = { one: 1, two: 2 }; new_hash = {}; hash.each { |k,v| new_hash[k] = v }; hash = new_hash"
<gogiel> Kovensky: why don't you use map! ?
<Kovensky> you can map! on a hash?
<gogiel> oops, sorry
<gogiel> my bad
<Kovensky> I don't see why it shouldn't be possible, but due to the lack of documentation I have no idea whether that's implemented correctly or at all :S
<gogiel> Kovensky: use merge
<gogiel> hash.merge(hash) { |k,o| o*o }
<gogiel> if this is what you are trying to do
baroquebobcat has joined #ruby
<atmosx> Is there any good free ebook or set of tutorials for non programmers? for ruby?
<Squarepy> Athanasius, wpgtr
<Squarepy> oops
<Squarepy> atmosx,
<atmosx> ah no
<atmosx> I dislike that
<Squarepy> haha
<Squarepy> you said non programmers
<atmosx> yes
<atmosx> but that one is way too childish etc
<Squarepy> well it has a soundtrack
<Squarepy> \o/
<atmosx> hahahahahaha
<atmosx> that's cool
<Kovensky> < gogiel> hash.merge(hash) { |k,o| o*o } <-- what happens to the third argument
Mohan has joined #ruby
Mohan has joined #ruby
<gogiel> Kovensky: nothing, we just don't need it
<gogiel> because in our case oldval always equals newval
<Kovensky> oh, I see
<Kovensky> I thought it'd verify the arity of the block
* Kovensky is implementing something that'll do http://pastie.org/private/sr7pfx2bxvsbtslebrwig
<gogiel> you can also ues inject
<gogiel> hash.inject({}) {|s, (k,v)| s[k]=v*v; s }
Drewch has joined #ruby
Bartzy has joined #ruby
<gogiel> Kovensky: not sure what it does
<cryptopsy> atmosx: yes, "by example" suffix to your goog
<cryptopsy> search goog, search!
<Kovensky> gogiel: the defines: section defines macros (just substitutions)
<cryptopsy> dripping, glistening
<Kovensky> gogiel: the accept list can use the macros defined in the defines section, and the YAML loader will recursively expand the macros in that section until no more macros are used
<Kovensky> and macros can have arguments (doesn't make much sense to have one without one)
<Kovensky> so if there is, e.g., a
<Kovensky> - macro3: text
<Kovensky> entry
<Kovensky> it'll be replaced by
EzeQL has joined #ruby
<gogiel> i get it
<Kovensky> - macro1: [ macro3, text ]
<Kovensky> etc
<Kovensky> the ultimate purpose is to reduce the regexp duplication in my settings file
<Kovensky> it has quite some large regexps, and most of them are repeated except for a single token <_<
Dantas has joined #ruby
mengu_ has joined #ruby
<Dantas> Hello, my mind is blowing, what is the difference between class << User do validates_confirmation_of :password end and User.class_eval do validates_confirmation_of :password end
zeroeth has joined #ruby
<Dantas> There is any difference between the class_eval and opening the singleton class ( anonymous class, virtual class whatever )
<Dantas> ?
<gogiel> Dantas: are you sure you can pass block to class << User ?
zodiak has joined #ruby
davidpk has joined #ruby
<Dantas> hi gogiel , Sorry, my bad
<gogiel> Dantas: that's the difference :)
<Dantas> class << User validates_confirmation_of :password end
<Dantas> gogiel: but both the SELF is the USER, right ?
<Dantas> when i try class << User validates_confirmation_of :password; end raise undefined method `validates_confirmation_of' for main:Object
gurugeek_ has joined #ruby
<Dantas> The User is a ActiveRecord::Base Object
<gurugeek_> hello is anyone available for a 1 hour - 2 hour paid job ? :D
emmanuelux has joined #ruby
<Dantas> My idea was: I created a module called Auth::Model::ClassMethods and in the hook method self.included(base) i tried class << base validates_confirmation_of :password ; end
<gogiel> Dantas: why not extend?
zetradr has joined #ruby
<Dantas> i tried too
<Dantas> and instead of included
<Dantas> i tried self.extended(base)
<gogiel> extended?
<Dantas> def self.extended(base)
<gogiel> why
<gogiel> there's idiom for that using modules
<gogiel> wait, i'll try to find it
<Dantas> thanks
<Dantas> first i tried, using the included and include hook will extend my ClassMethods module
<wroathe> So here's kind of an oddity in 1.9.3... lists = Histogram.new []
<wroathe> lists[key] << 'val'
<wroathe> << apparently modifies the default [] object for the entire hash
<Dantas> My problem is basically the difference between class << User and User.class_eval
<wroathe> so every key now equals 'val'
<burgestrand> wroathe: same in 1.9.2 and 1.8.7 for hashes with default value
<burgestrand> wroathe: use hashes with a default proc to create a new array for each unset key accessed
<wroathe> For some reason I would've thought it would instantiate array for each key
<Dantas> gogiel: thanks anyway
mneorr has joined #ruby
<burgestrand> wroathe: it’s a common misconception
n1x has joined #ruby
d3c has joined #ruby
nif has joined #ruby
<gogiel> Dantas: there's great book, Eloquent Ruby
<gogiel> Dantas: not sure, but i think it's explained somewhere there
francisfish has joined #ruby
moshef has joined #ruby
<Dantas> gogiel: thanks Obey Fernandez i think
zeroeth has joined #ruby
nif has joined #ruby
gurugeek_ has quit [#ruby]
looopy has joined #ruby
<gogiel> class << doesn't require object, not Class?
<gogiel> like class << object ?
<gogiel> wait, class is an object, sorry ;)
<gogiel> i just don't get why not class_eval?
<Dantas> gogiel: yeah, im only trying figuring out the differences
Drewch has joined #ruby
bluOxigen has joined #ruby
robdodson has joined #ruby
chimkan has joined #ruby
wallerdev has joined #ruby
<gogiel> Dantas: isin't class << Class works on classes singleton class?
kevinbond has joined #ruby
<gogiel> Dantas: and you want to work on actuall class
Guest71832 has joined #ruby
<Dantas> gogiel: easy, metaprogramming will blow my mind
Teddy2steper has joined #ruby
icy` has joined #ruby
icy` has joined #ruby
<gogiel> Dantas: that singleton class is like pure instance of Class i think. it doesn't inherit from anything
<Dantas> gogiel: humm, nice
<gogiel> and when you try to run a method of User it first looks up all classes
<gogiel> and singleton_class is one of them
<Dantas> User -- Singleton Class -- ActiveRecord::Base
<Dantas> right ?
<Dantas> the lookup path
Clordio has joined #ruby
<gogiel> not sure. i've got Eloquent Ruby at my house. i'm at parents' now ;)
<Dantas> nice !
<Dantas> what im thinking is that when u execute some code inside a singleton_class the path is different
<gogiel> Dantas: you can doclass << User; print self; print self.public_methods; end
<gogiel> see it's just different class
helichopter has joined #ruby
_AlbireoX has joined #ruby
ryanf has joined #ruby
<Dantas> class << User puts self; end will print the User
<gogiel> Dantas:
<gogiel> #<Class:User(
<Dantas> yeah, see
<Dantas> User
<gogiel> User.singleton_class
<gogiel> that's it
<Dantas> yeah ;)
<Dantas> and the superclass of singleton_class i think is Object
avalarion has joined #ruby
<Dantas> so are two different lookup path
<Dantas> i guess
<Dantas> not sure
nif has joined #ruby
<burgestrand> superclass of singleton class is Class
<burgestrand> for classes
<Dantas> perfect
zakwilson has joined #ruby
<Dantas> so, we found the answer right now
zakwilson_ has joined #ruby
<burgestrand> it’s the class of the object you singleton class for
<burgestrand> So the singleton class’ class is class for Class
<burgestrand> :D
<gogiel> burgestrand: seems legit ;)
<burgestrand> gogiel: I’d say classy
zemanel has joined #ruby
noyb has joined #ruby
dubios has quit [#ruby]
<gogiel> is there a use of metaclass of metclass?
mattyoho has joined #ruby
EzeQL has joined #ruby
bluOxigen has joined #ruby
sgmac has joined #ruby
<burgestrand> don’t know, haven’t found one myself at least
kevinbond has joined #ruby
sgmac has quit [#ruby]
<ryanf> I have I think. I kind of forget why though
<ryanf> oh
RORgasm has joined #ruby
nate_h has joined #ruby
<ryanf> if you want to use 'macro' style class methods from inside the metaclass's body, that has to be defined on the metaclass's metaclass
<ryanf> e.g. 'attr_accessor'
<ryanf> (that one doesn't count since it comes predefined, but if you wanted to add your own, that's where you would be defining it)
helichopter has joined #ruby
nfluxx_ has joined #ruby
mmokrysz has joined #ruby
Mohan has joined #ruby
Mohan has joined #ruby
nfluxx has joined #ruby
emmanuelux has joined #ruby
avalarion has quit [#ruby]
nfluxx_ has joined #ruby
nfluxx__ has joined #ruby
<shevy> long live ruby!
<shevy> wave!
<shevy> \o/
helichopter has joined #ruby
natemcguire has joined #ruby
<senthil> is there something like slime for ruby?
<_ack> what is slime?
<ryanf> to the extent that I understand how slime works, no
<ryanf> the closest thing is probably pry, but it's not that close
<senthil> ryanf: been using and love pry
<ryanf> cool!
<ryanf> so, no, then. :)
<shevy> we must convince banister to hack on pry-slime
<ryanf> he is an emacs user
atmosx has joined #ruby
<shevy> I understand
<ryanf> so it's not inconceivable
<shevy> not every soul can be saved ...
BSaboia has joined #ruby
<senthil> just something like "select def ... , open in pry" would be very useful
<shevy> would that open the method in pry?
<shevy> he wants you to file an issue!
h4mz1d has joined #ruby
savage- has joined #ruby
atmosx has joined #ruby
<senthil> shevy: load whatever is in the visual block, yea
iocor has joined #ruby
Drewch has joined #ruby
<ryanf> pry does let you open an editor with a tempfile and then load that. but yeah, it can't really integrate with a persistent editor session
<ryanf> you're talking about emacs right? that must be achievable if you have pry open in a buffer
<shadoi> Pry can help ween you off the emacs teat. Don't fight it…
<ryanf> (I don't recommend using pry in an emacs buffer though, the dumb terminal means you miss out on the fancy syntax highlighting and indentation stuff)
nate_h has joined #ruby
helichopter has quit [#ruby]
<any-key> vim 4 lyfe
huismon has joined #ruby
* any-key makes vim gansta sign
<shadoi> O.o
<ryanf> yeah vim is even worse at running a terminal though :(
<any-key> haha there's :shell :P
<any-key> it works great :D
<shadoi> Pry hosting vim via edit and edit-method is awesome.
<any-key> oh whaaat
<any-key> that sounds awesome >.>
<ryanf> yeah it is, it's just slightly less nice than having a persistent session with undo history and stuff
<shadoi> ryanf: hmm, it would be cool if it stored each change in it's own embedded git repo or something
<shadoi> maybe I'll hack on that
<shadoi> maybe in pry-git
<shadoi> :)
<shadoi> He did some super cool stuff with that
<ryanf> I've never really messed with pry-git, it's an interesting idea though
joukokar has joined #ruby
<senthil> pry-git does interesting...is anyone using it?
<senthil> *look interesting
zemanel_ has joined #ruby
<shadoi> He just made it
<shadoi> I plan to give it a spin this week
<senthil> ah ok
<Veejay> any-key: Is there a good vim plugin to % to the end of blocks?
<Veejay> Going from def to end, from || to end
<senthil> Veejay: ruby-matchit
<any-key> Veejay: yeah I believe the built-in ways for navigating methods work
<any-key> [ and ] iirc
<any-key> nvmd
<any-key> one sec.....
<any-key> Veejay:
workmad3 has joined #ruby
<any-key> never mind, doesn't appear to work in rubaaay
<Veejay> Yeah, it's geared towards C
<any-key> you could always ask in #vim, they're very helpful
<Veejay> Yeah, they are
<toddmorrill> do you guys think if i want to learn rails, that learning sinatra first would be a good stepping stone?
<any-key> how familiar are you with the internet and how it works?
<any-key> have you written CGI scripts before?
<any-key> can you tell me how HTTP works?
<any-key> if not, start small :P
<any-key> rails hides a lot of magic
<burgestrand> toddmorrill: yes
<workmad3> any-key: http works with the help of magic pixies that pass letters around really, really quickly
<any-key> rails is its own little universe, and it'll make more sense once you've done a bunch of things by hand
<any-key> workmad3: nonono that's TCP
<any-key> :P
<workmad3> any-key: oh sorry, my mistake :)
<toddmorrill> i wrote a http protocol like 10 years ago and my programming brain has atrophied
<toddmorrill> i don't really recall how http works at the moment
<toddmorrill> but there is a blurry mem
<any-key> it's all good, it's quite simple
<any-key> screw around with sinatra, it's very fun and you'll get your memory back
<any-key> or just play around with ruby's CGI library
<toddmorrill> any-key: so given that i am a little rusty ruby or sinatra to start
<any-key> definitely
<toddmorrill> i am just playing around now with ruby api scpripts
<toddmorrill> have a little fun thing i am making to scrape data from reedit.
<toddmorrill> but i haven't don't any frame working...
<toddmorrill> i started the rails for zombies thing, but i thought let me just start ruby first
<any-key> definitely get the hang of ruby first
<toddmorrill> so i am making my way through programatic ruby
<any-key> then you'll see how rails is doing things
keymone_ has joined #ruby
<toddmorrill> yea so i am going to do just pure ruby scripts....
<toddmorrill> get a hang of it
<toddmorrill> then move to either sinatra or rails
williamcotton has joined #ruby
<toddmorrill> seems everyone says sinatra
<any-key> it's neat
<any-key> you'll be able to make some cool functional stuff
jhllnd1 has joined #ruby
<workmad3> rails does a lot more for you and provides more structure out the box... you can get it all with sinatra, but rails gift wraps them... but it does come at a higher cognitive cost :)
<any-key> without a good idea of what's going on behind the scenes, rails can be confusing as all getout :\
<shevy> it does wicked voodoo magic
<any-key> render :update is a good example of that >.>
<shevy> what is this doing
mmokrysz has joined #ruby
<any-key> it javascripts your ajax
<toddmorrill> thanks, yea i just want to learn slow and dee
<toddmorrill> *deep
<toddmorrill> i am coming out of a 10year programming hiatus
<any-key> hehe
<toddmorrill> so i don't want to shock my brain too much
<any-key> you'll like ruby
kevinbond has joined #ruby
<toddmorrill> i like it already
<toddmorrill> its nifty
<workmad3> toddmorrill: aww, shocking your brain is the fun part :)
<toddmorrill> i have been coding all weekend
<any-key> it'll be nice and fun, then you throw functional programming in and you level up and boom
<shevy> I want to rename javascripts to ajaxscript
<toddmorrill> i love all the gems / and fun spirited docs
<bawer> ruby is pretty, it will ease you in to thinking code :)
<workmad3> shevy: we could all just start using its proper name of ECMAScript
<shevy> docs
<shevy> docs can be the suck
<shevy> my solution is to catch programmers
<shevy> if bad doc, throw programmer into arena
kaneda has joined #ruby
<shevy> then they all fight until only one guy survives
<shevy> and he is told to write better docs in the future
<workmad3> shevy: the problem with that is that a coder with bad doc skills survives... what you should do is throw them all into the arena until only one is left, and then shoot the survivor
<workmad3> shevy: however, because I came up with the idea, I'm exempt... :P
gen0cide_ has joined #ruby
<any-key> heh, so the HTTP spec misspelled "referrer" as "referer" so now everyone has to spell it wrong
schovi has joined #ruby
<shevy> well the last survivor has learned the lesson
tommyvyo has joined #ruby
<shevy> really any-key???
<any-key> yes
jhllnd has joined #ruby
Muz has joined #ruby
<shevy> argh
<any-key> isn't that awesome?
<shevy> who was the idiot to do it
<any-key> read the second paragraph
<shevy> "computer scientist Phillip Hallam-Baker"
<any-key> that jerk
<shevy> did he fail in english class or what
<shevy> "Dr Hallam-Baker is an internationally recognized computer security specialist and is credited with 'significant contributions' to the design of HTTP 1.0"
<workmad3> made sure his name got mentioned and remembered...
Know1edge has joined #ruby
Know1edge has joined #ruby
<shevy> yeah
<shevy> the guy who failed in english classes
mwyrobek has joined #ruby
<shevy> ah well
<shevy> I just hope my life won't be up to a spec one day
jgrevich_ has joined #ruby
c0rn has joined #ruby
mmokrysz has quit [#ruby]
gh has joined #ruby
sam113101 has joined #ruby
Drewch has joined #ruby
ckrailo has joined #ruby
jrhorn424 has joined #ruby
kenperkins has joined #ruby
Guest35859 has joined #ruby
zetradr has joined #ruby
andrewhl has joined #ruby
dross_ has joined #ruby
wallerdev has joined #ruby
moshee has joined #ruby
eka has joined #ruby
kvirani has joined #ruby
niku4i has joined #ruby
__main__ has joined #ruby
beilabs has joined #ruby
_main_ has joined #ruby
kevinbond has joined #ruby
Evixion has joined #ruby
skelterjohn_ has joined #ruby
Teddy2steper has joined #ruby
alek_b has joined #ruby
skelterjohn_ has quit [#ruby]
Beoran__ has joined #ruby
ablemike has joined #ruby
jhllnd has quit [#ruby]
csprite has joined #ruby
kvirani has joined #ruby
ryanf has joined #ruby
alek_b_ has joined #ruby
wilmoore has joined #ruby
nlc has joined #ruby
nari has joined #ruby
Drewch has joined #ruby
decaf has joined #ruby
alek_b has joined #ruby
burgestrand has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
alek_b_ has joined #ruby
otters has joined #ruby
adac has joined #ruby
<adac> with nokogiri how do i get the value of 'name' in this example xml excerpt: <resource type="assembly" name="reader.dll" version="1.0.0.1"/>
otters has joined #ruby
robdodson has joined #ruby
<RegEchse> adac: Nokogiri::XML.parse(s).root[:name] # for example. (given s is a string with that tag above)
danielvdotcom has joined #ruby
<adac> RegEchse, thanx
Drewch has joined #ruby
Kireji has joined #ruby
eam has joined #ruby
<jrhorn424> in irb, I can do hsh.sort and hsh.sort_by, but I can't do those same operations in-place in an each block… any suggestions? I'm trying to sort the hashes in an array of hashes by the key. I supposed hashes in 1.9 would be sortable, since they're ordered.