<countskm>
trying hard to write my test first ... tough sometimes :-)
<wallerdev>
at least you're trying :)
burns180_ has joined #ruby-lang
<countskm>
heh - yeah i heard a podcast w/ guys fighting over bdd vs tdd vs cucumber yadada and i thought the same thing - its good we are at the point where at the worst we are bitchin ;-)
<countskm>
was listening to kent beck tonight and it inspired me to re-write some tests
mikeric has joined #ruby-lang
x0F_ has joined #ruby-lang
kitallis has joined #ruby-lang
ryanf has joined #ruby-lang
<Asher>
if you are arguing over bdd vs. tdd vs. cucumber you are wasting time instead of getting worthwhile coding done
<erikh>
Asher: emacs sucsk
<erikh>
I use vim
butchanton has joined #ruby-lang
<erikh>
and textmate
<erikh>
and joe
<Asher>
hahaha
<bnagy>
erikh: yeah? Well linux sucks balls, Win7 is way better
<erikh>
heh, I actually like win7 a lot
<erikh>
it's basically what everythings since windows NT should have been
<bnagy>
yeah, I hate linux a lot :(
<erikh>
I think they're going to go back to sucking hard with win8 though.
<erikh>
anyone here know the multithreaded version of the gdb rb_raise() trick?
<erikh>
I need to break into a ruby session and send a rb_raise to a specific thread.
<TTilus>
all editors suck
<erikh>
man, it's like the test suite gets tired of being run and just starts getting pissy
<TTilus>
and operating systems for that matter
QoQOoO has joined #ruby-lang
QoQOoO has quit [#ruby-lang]
<TTilus>
they just get in your way
* TTilus
uses magnetic needle and steady hand
savage- has joined #ruby-lang
burns180 has joined #ruby-lang
Keva161 has joined #ruby-lang
burns180 has joined #ruby-lang
QoQOoO has joined #ruby-lang
<andkerosine>
TTilus: So... it has come to this.
Fullmoon has joined #ruby-lang
|Vargas| has joined #ruby-lang
burns180_ has joined #ruby-lang
savage- has joined #ruby-lang
Quazi_Farhan has joined #ruby-lang
heppy has joined #ruby-lang
yxhuvud has joined #ruby-lang
mikeric has joined #ruby-lang
Heimidal has joined #ruby-lang
butchanton has joined #ruby-lang
burns180 has joined #ruby-lang
voker57 has joined #ruby-lang
heppy has joined #ruby-lang
brianpWins has joined #ruby-lang
burns180_ has joined #ruby-lang
QaDeS has joined #ruby-lang
burns180_ has joined #ruby-lang
Fractality has joined #ruby-lang
twittard has joined #ruby-lang
benvds has joined #ruby-lang
burns180 has joined #ruby-lang
zmack has joined #ruby-lang
zmack has joined #ruby-lang
gasbakid has joined #ruby-lang
gokul has joined #ruby-lang
dc5ala has joined #ruby-lang
QaDeS has joined #ruby-lang
solars has joined #ruby-lang
gnufied has joined #ruby-lang
burns180_ has joined #ruby-lang
frangiz has joined #ruby-lang
denysonique__ has joined #ruby-lang
Quazi_Farhan_ has joined #ruby-lang
tyman has joined #ruby-lang
mikeric has joined #ruby-lang
cyri_ has joined #ruby-lang
burns180 has joined #ruby-lang
benvds has joined #ruby-lang
benvds has joined #ruby-lang
burns180_ has joined #ruby-lang
Fullmoon has joined #ruby-lang
davidw has joined #ruby-lang
lbrent has joined #ruby-lang
d3vic3 has joined #ruby-lang
lbrent has joined #ruby-lang
QoQOoO has joined #ruby-lang
QoQOoO has joined #ruby-lang
jordan` has joined #ruby-lang
srbartlett has joined #ruby-lang
adambeynon has joined #ruby-lang
francisfish has joined #ruby-lang
woollyams has joined #ruby-lang
<shevy>
yeah TTilus the wise men just tries to overcome those obstacles - by writing a new OS. The ruby OS!!!
kp666 has joined #ruby-lang
burns180_ has joined #ruby-lang
btfriar has joined #ruby-lang
futurechimp has joined #ruby-lang
gianlucadv has joined #ruby-lang
<yorickpeterse>
Sounds performant
<shevy>
yorickpeterse yeah, we all use C because it is the fastest, and other languages have no chance!!!
pbjorklund has joined #ruby-lang
<yorickpeterse>
:)
<shevy>
well I'd be even happy enough to see shell scripts being replaced by ruby scripts... or python scripts... but they seem to stay around for so long :(
<ruskie>
nothing wrong with shell scripts
<shevy>
I know. sysadmins don't wanna lose their job after all
workmad3 has joined #ruby-lang
<ruskie>
shevy, heh
<shevy>
I am only half serious btw
<ruskie>
frankly I'm terrified when I get asked why I use shell scripts instead of perl
<ruskie>
because apparently everyone should know perl and use that
<ruskie>
atleast shell scripts can be used by anyone that can use a shell
<bnagy>
wat?
<bnagy>
that statement is insane
<ruskie>
which one?
<bnagy>
reading and writing shell scripts has more or less nothing to do with using a shell day to day
<shevy>
yeah, there is a big inertia against change in general. just look how long it takes for cmake to get adopted. and even when it does, it does not offer feature parity towards GNU autoconfigure
<ruskie>
bnagy, most shell scripts are simple affairs that just call different normal commands
<A124>
True.
<bnagy>
that's a bit subjective :)
srbartlett has joined #ruby-lang
postmodern has joined #ruby-lang
<ruskie>
but yeah some of the shell scripting that I've seen done and have done myself would be a problem for mostly anyone not a coder
<shevy>
perl was cool once
<bnagy>
shevy: that's when the alternatives were Ada and fortran90
<shevy>
hehe
<ruskie>
but I believe 90% of the scripts I use day to day for work stuff is basically a bunch of commands so I don't need to rerun them all the time by hand
<rippa>
ankurgel: well, there's no local variable "calories" nor method with that name
<rippa>
ofc it errors
<ankurgel>
but local variable for class was initialized in def initialize, no?
<ankurgel>
def healthy? is part of that class itself.
<uniqanomaly>
@ at 8 line :<\
<rippa>
ankurgel: that's instance variable
<roadkith>
sequel doesnt seem to understand iso-8859-1 in a mysql db
<rippa>
and it has @ as part of name
gasbakid__ has joined #ruby-lang
<rippa>
@calories no calories
<rippa>
*not
<ankurgel>
yes, agreed.
<ankurgel>
hm. okay, making sense now. :)
<ankurgel>
yes. clear. :) thanks rippa andrewvos
<ankurgel>
one more thing, are these called as getters/setters?
<ankurgel>
or are they different?
<rippa>
who?
<ankurgel>
are attr_reader , attr_accessor called as getter and setters in ruby?
<rippa>
I'm not sure I get what you mean
<ankurgel>
rippa, okay, read this: " Create a class Dessert with getters and setters for name and calories. Define
<ankurgel>
instance methods healthy?, which returns true if a dessert has less than 200
<ankurgel>
calories, and delicious?
<ankurgel>
"
<ankurgel>
This is what I'm asked to do.
<rippa>
yeah
<ankurgel>
create this basic class with those functions and everything.
<rippa>
attr_accessor difenes getter and setter methods
<rippa>
*defines
<ankurgel>
okay
<tobiasvl>
attr_accessors are getters and setters
<tobiasvl>
yeah
<tobiasvl>
attr_reader is just a getter
<ankurgel>
and attr_accessor can set as well..
<tobiasvl>
yep
<ankurgel>
so it's setter as well as getter, right.
<rippa>
attr_writer is setter
<rippa>
attr_accessor is both
<ankurgel>
all right. So, attr_reader as getter, attr_writer as setter and attr_accessor as both.
<ankurgel>
If I include attr_accessor in my class, I don't have to use attr_reader there.
<tobiasvl>
correct
vmoravec has joined #ruby-lang
QaDeS has joined #ruby-lang
burns180_ has joined #ruby-lang
<ankurgel>
tobiasvl, rippa http://ideone.com/XxbfA Have a look at JellyBean class inherited from Dessert. name, calories are inherited.
<ankurgel>
Do I have to initialize them again in def initialize ?
seanstickle has joined #ruby-lang
<ankurgel>
oh. hm. Yes, I should I think. They are not actually being initialized directly when I am using object of JellyBean
<tobiasvl>
ankurgel: yes
<rippa>
ankurgel: call super
<tobiasvl>
what rippa said
<ankurgel>
how?
<tobiasvl>
super(name, calories)
<rippa>
yes
<ankurgel>
^It worked!
<ankurgel>
so, it will send these variables to it's parent class?
<tobiasvl>
yes
<ankurgel>
and they will get initaized there?
<ankurgel>
initialized*
<tobiasvl>
super calls the super (parent) class's initialize method
<tobiasvl>
correct
<ankurgel>
bravo! thanks guys! :)
<rippa>
super calls parent version of any method
<rippa>
inside which it's used
<tobiasvl>
truwe
<tobiasvl>
true
<ankurgel>
in case of multiple inheritence, calling super(with_vars_belonging_to_diff_class), it will automatically call their respective init ?
publicvoid_ has joined #ruby-lang
<ankurgel>
if multiple inheritence happens in rb. I am not sure
<rippa>
ruby doesn't have multiple inheritance
<ankurgel>
like java has interfaces to implement it, do we have something like that in rb?
<rippa>
no, because dynamic language
<dominikh>
nobody needs multiple inheritance when he has mixins :P
<ankurgel>
:D okay.
Fullmoon has joined #ruby-lang
isale-eko has joined #ruby-lang
<kke>
!down rubygems
<kke>
thought there was a command like that
thone_ has joined #ruby-lang
<ddfreyne>
there is one, but it takes the given site down, so usage is not recommended!
<ddfreyne>
thanks for ruining rubygems, kke
burns180 has joined #ruby-lang
<kke>
np
<kke>
i got too much work done when it was up and didn't have enough time to browse the net
_bat has joined #ruby-lang
<kke>
fixed it now
<kke>
no i didn't
<roadkith>
rubygems.org is down
kaiwren has joined #ruby-lang
<yorickpeterse>
They're working on it
kain has quit ["Sto andando via"]
burns180_ has joined #ruby-lang
malev has joined #ruby-lang
malev has joined #ruby-lang
burns180 has joined #ruby-lang
burns180 has joined #ruby-lang
fayimora_ has joined #ruby-lang
mssola has joined #ruby-lang
<nofxx>
What do you guys use for load balancing? hproxy?
gasbakid has joined #ruby-lang
tomzx has joined #ruby-lang
burns180_ has joined #ruby-lang
canton7 has joined #ruby-lang
mistym has joined #ruby-lang
alessio_rocco has joined #ruby-lang
dfr|mac has joined #ruby-lang
francisfish has joined #ruby-lang
tommyvyo has joined #ruby-lang
burns180_ has joined #ruby-lang
jxie has joined #ruby-lang
<darix>
nofxx: haproxy
davidw has joined #ruby-lang
mistym has joined #ruby-lang
PhilCK has joined #ruby-lang
Fullmoon has joined #ruby-lang
justinxreese has joined #ruby-lang
Spooner has joined #ruby-lang
dhruvasagar has joined #ruby-lang
uniqanomaly_ has joined #ruby-lang
S1kx has joined #ruby-lang
s_dana has joined #ruby-lang
bglusman has joined #ruby-lang
frem has joined #ruby-lang
beiter has joined #ruby-lang
<beiter>
Here there. I parse an HTML file with haricot (Ruby 1.8.7) there are letter like ä. When i try to save the text into a db, the ä becomes '\303\204'
<beiter>
how can i fix this problem ?
JEG2 has joined #ruby-lang
<judofyr>
beiter: 1.8 or 1.9?
<judofyr>
oh
<judofyr>
you said 1.8.7
<beiter>
yes
<judofyr>
ah, encodings
<beiter>
and i meant hpricot
<beiter>
jear /:
<judofyr>
beiter: is the database set up for UTF-8?
<beiter>
yes
<beiter>
should i change this encoding
leonL has joined #ruby-lang
<shevy>
UTF-pony
<judofyr>
nah, \303\204 is UTF-8 already
<judofyr>
(right?)
bryancp has joined #ruby-lang
<beiter>
hmm should
<beiter>
the encoding of the database is utf-8
<beiter>
but the value in there isn't right
krzyhoo has joined #ruby-lang
<krzyhoo>
hello gurus. a quick question. need to execute an external progam with the following command: `
<ankurgel>
# => returns the list ["Dave", "S"] wins since S>P
<ankurgel>
S --> Stone, P->Paper,
gianlucadv has joined #ruby-lang
<ankurgel>
and ofcourse R -> Rock
macmartine has joined #ruby-lang
<shevy>
yay, a game
<ankurgel>
:D
t0h has joined #ruby-lang
<ankurgel>
I tried to think about it..
<ankurgel>
but nothing just could come in mind except traditional c++ approach.
<ankurgel>
which will just involve working on multiple cases.
<Spooner>
ankurgel: It would be more usual, in Ruby, to use :stone, :paper rather than the "P" "S"
<ankurgel>
Spooner, why symbol will do where?
<shevy>
what is wrong with multiple cases?
<ankurgel>
Since I would provide my function with strings; if symbols are more efficient here, guess I can convert "R","P" etc to symbol in function itself.
fayimora has joined #ruby-lang
<Spooner>
However, I suppose that "p", "s" is the input (press p for paper, s for stone, etc).
<shevy>
I mean I dont see a question so far
<ankurgel>
shevy, multiple cases will be like gruesome!
<slyphon>
i havent even run it yet, but i'm seeing this is gonna go way easier than the last 5 times i had to write this same thing
<slyphon>
:)
<dominikh>
yey. what did you use the last 5 times? ;)
<slyphon>
rbot, pircbot, some other ruby thing, pircbot, then an attempt with node.js that ended in a rather poor opinion of the code generated by that community
<slyphon>
:)
<dominikh>
haha, alright
<slyphon>
(this is over 6 years or so)
<slyphon>
this is great though
m3nd3s has joined #ruby-lang
<darix>
slyphon: didnt the github guys release some node.js based bot?
<Spooner>
If they are both the same, then no-one wins.
Heimidal has joined #ruby-lang
gasbakid__ has joined #ruby-lang
<ankurgel>
I want first one to win in that case.
<Spooner>
OK.
<ankurgel>
by default :0
<ankurgel>
:)
<ankurgel>
Spooner, thanks a lot! That was awesome addon.
<Spooner>
I was suggesting you do winner = case (and the result being 0, 1, or nil) so you could do: puts "#{winner ? game[winner][0] : "noone"} wins"
<ankurgel>
I can sit on #ruby-lang all day long now.
<ankurgel>
oh
<Spooner>
It isn't perfect, but at least it now looks like Ruby :)
<ankurgel>
yes
francisfish has joined #ruby-lang
achiu has joined #ruby-lang
wallerdev has joined #ruby-lang
<Spooner>
And don't feel you have to use "then" as I did. Just easier to fit it on one line for IRC. Anyway. I'll try not to answer with the end, rather than the next step next time.
Asher has joined #ruby-lang
<ankurgel>
Hm. Yeah, I could have used next line or ; there instead of then there.
<Spooner>
Nah, you shouldn't ever really be using ;. 'then' is better than ; in the case of short when lines that look fine on one line.
<slyphon>
dominikh: ok, so, $50,000 question. I want to make a REST API I can use to do announcements with cinch, is there a threadsafe way i can do that?
Muz has joined #ruby-lang
<Asher>
is it really worth $50k? ;P
<dominikh>
slyphon: well, what about it has to be threadsafe in particular?
<dominikh>
Asher: I sure hope so, I am waiting for the money
<slyphon>
dominikh: there's a network socket
gnufied has joined #ruby-lang
<slyphon>
i.e. one global resource
<slyphon>
i guess the better question would be
<slyphon>
"How can i do that?"
<slyphon>
just grab the bot instance and..
<dominikh>
slyphon: run Bot#start in a thread, run whatever you use for REST in another thread, use the bot instance and have fun
<dominikh>
slyphon: Cinch itself is heavily using threads, so all processing of events, managing the socket etc are already threadsafe.
<ankurgel>
1.9.2p290 :002 > puts 'hello' if game==('R'||'S')
<ankurgel>
hello
<ankurgel>
=> nil
<ankurgel>
1.9.2p290 :003 > puts 'hello' if game==('R'&&'S')
<ankurgel>
=> nil
<ankurgel>
sorry for not using gist etc
<injekt>
right
heppy has joined #ruby-lang
<ankurgel>
then, why not there?
<injekt>
it's using 'R' and doesnt care about 'S'
<injekt>
'a' == ('a' || 'c') #=> true
<injekt>
'c' == ('a' || 'c') #=> false
<ankurgel>
it is?
<ankurgel>
checking
<ankurgel>
:O why
<injekt>
because that's not valid
burns180 has joined #ruby-lang
<injekt>
('a' || 'c') returns 'a' every time
<injekt>
because 'a' is truthy
<ankurgel>
mm-hmm
<injekt>
so you're never comparing against 'c'
<injekt>
or w/e in your example
knightMBP has joined #ruby-lang
<ankurgel>
still a bit confused in this one. :(
<erikh>
if 'a'; p "a is true"; end
<ankurgel>
yes
<erikh>
puts "a" || "b"
<ankurgel>
because 'a' is true
<injekt>
you're trying to do; if foo == 'a' || foo == 'c' but writing it as if foo == ('a' || 'c')
<erikh>
run it 400 times
<erikh>
it'll always be a
<ankurgel>
when it does 'c'==('a'||'c') if 'c' doesn't matches with 'a' first,
<erikh>
zedas has a really nice truth table for python.
<ankurgel>
shouldn't it check itself with 'c'?
<injekt>
no
<injekt>
('a' || 'c') returns a
<injekt>
every. time.
<erikh>
'c' == 'a' || 'a' == 'a'
<erikh>
actually ignore that
Cool_Fire has joined #ruby-lang
<erikh>
because ruby's precedence rules are whack.
<erikh>
use 'or'
<Cool_Fire>
morning
<injekt>
heh
<dominikh>
you have to simplify your expression from the inside out. 'c' == ('a' || 'c') -> 'c' == ('a') -> 'c' == 'a' -> false
<ankurgel>
Cool_Fire, In few hours, I would be saying 'Good night, good sir'
mrsolo has joined #ruby-lang
<ankurgel>
dominikh, okk
<Cool_Fire>
ankurgel: same really, but it's the internet :p
<erikh>
%w[a c].include?("a") is really the idiomatic way to do this.
<ankurgel>
Cool_Fire, :D
<erikh>
with the exception of very simple cases.
<ankurgel>
erikh, yes, injekt suggestion of replacing to : raise NoSuchStrategyError unless ['R','P','S'].include?(game[0][1])&&['R','P','S'].include?(game[1][1]) worked.
chris2 has joined #ruby-lang
<injekt>
now DRY
konr has joined #ruby-lang
<Cool_Fire>
Does anyone know why in Ruby 1.8.7 doing a blocking pop() on a Queue in it's own thread, doesn't unblock it (either that, or the thread doesn't get scheduled for some reason)
curtism has joined #ruby-lang
<erikh>
[game[0][1], game[1][1]].all? { |x| %w[R P S].include?(x) }
<Cool_Fire>
I mean, it's not unblocked when something is added to the queue
<erikh>
enumerable is here to make your code less ugly
<erikh>
use it.
<ankurgel>
erics, injekt thanks again :)
heppy has joined #ruby-lang
<injekt>
weird how my name was right there
<injekt>
usually other way around
<erikh>
inkjet
<ankurgel>
I should make a rb bot to say 'thanks' everytime someone helps me. :D
<injekt>
you shouldn't, but if you did, there's cinch!
<injekt>
dominikh: and you say I dont help
<ankurgel>
I am tired of writing ink[tab] and waiting for irc to complete.. then erase back and do this again.
<injekt>
just use i[tab]?
<shevy>
why not i[Phone] !
<injekt>
har
<shevy>
hmm why do you write ink ankurgel
<shevy>
inkjet
<shevy>
aaaaaah :)
<ankurgel>
shevy, exactly
<shevy>
never knew that was your real nick
<ankurgel>
inkjet
<ankurgel>
and injekt sounds more like #inject
<ankurgel>
so, confuses me over.
<injekt>
it's really not hard
<injekt>
(that's what she said)
<ankurgel>
TWSS
<ankurgel>
haha
<ankurgel>
exaclty
<ankurgel>
exactly*
Tearan has joined #ruby-lang
solars has joined #ruby-lang
burns180_ has joined #ruby-lang
achiu has joined #ruby-lang
Fullmoon has joined #ruby-lang
SuperTaz_work has joined #ruby-lang
tenderlove has joined #ruby-lang
gianlucadv has joined #ruby-lang
<ankurgel>
injekt, Spooner Let's make this a Rock_Paper_scissor tournament!
<Spooner>
ankurgel: ro-sham-bo is the same game, but in Japanese.
<ankurgel>
Spooner, I have read that.. I meant, we can do modification for rashamboo in that after creating tournament.
<ankurgel>
:)
riginding has joined #ruby-lang
burns180 has joined #ruby-lang
Nowaker has joined #ruby-lang
Sailias_ has joined #ruby-lang
morozovm has joined #ruby-lang
jsaak has joined #ruby-lang
knightMBP has joined #ruby-lang
mytrile has joined #ruby-lang
urbanmonk has joined #ruby-lang
publicvoid has joined #ruby-lang
achiu has joined #ruby-lang
SuperTa__ has joined #ruby-lang
mytrile has joined #ruby-lang
burns180_ has joined #ruby-lang
<konr>
How can I iterate over an array and return nil if a block returns nil? Like [3,30].all_must_hold {|x| x<10}
<rippa>
konr: #any?
<rippa>
and
<rippa>
#none?
<rippa>
and
<rippa>
#all?
<konr>
rippa: great! thanks
Keva161 has joined #ruby-lang
<lianj>
dominikh is rich now \o/
<lianj>
oh, and my buffer was scrolled up :D
<dominikh>
…
headius has joined #ruby-lang
pemeon has joined #ruby-lang
mark_locklear has joined #ruby-lang
justinmcp has joined #ruby-lang
Giddeon has joined #ruby-lang
imperator has joined #ruby-lang
<imperator>
'ello 'ello
<ankurgel>
.gsub('['
<ankurgel>
.gsub('[']','h')
sdeobald_ has joined #ruby-lang
darkf_ has joined #ruby-lang
kaiwren has joined #ruby-lang
Heimidal has joined #ruby-lang
qpingu has joined #ruby-lang
brianpWins has joined #ruby-lang
gregf has joined #ruby-lang
futurechimp has joined #ruby-lang
gix has joined #ruby-lang
kp666 has joined #ruby-lang
Skif has joined #ruby-lang
Heimidal has joined #ruby-lang
dustacio has joined #ruby-lang
burns180 has joined #ruby-lang
sdeobald_ has joined #ruby-lang
twittard has joined #ruby-lang
Giddeon has joined #ruby-lang
neoesque has joined #ruby-lang
SITZ has joined #ruby-lang
<dominikh>
yeah, that will not work.
<dominikh>
like, at all :P
Giddeon has joined #ruby-lang
lsegal has joined #ruby-lang
Heimidal_ has joined #ruby-lang
<mistym>
Might get imperator by accident ;)
<mistym>
Apparently I was scrolled way way up. Embarassing.
<mistym>
/ignore self
cwd1 has joined #ruby-lang
<imperator>
hm?
<shevy>
hmm question...
<shevy>
let's say I have 100 .rb classes running
<shevy>
now I want to modify a special variable, let's call it "foo", in one of those classes - and I want to propagate the new value of this variable to all the other running instances of that class too
<shevy>
(they are all the same class)
<shevy>
hmmmm
<shevy>
I am going to ponder more about this first
<futurechimp>
@@foo?
<futurechimp>
(without the "?") :)
<shevy>
hmm that could work
<shevy>
or would it?
* manveru
pretends he didn't see that
<futurechimp>
sounds like you want a class variable maybe?
<imperator>
shevy, Observable?
<shevy>
thanks imperator, will have a look
burns180_ has joined #ruby-lang
gasbakid has joined #ruby-lang
gregf has joined #ruby-lang
tyman has joined #ruby-lang
seanstickle has joined #ruby-lang
bryancp has joined #ruby-lang
mikeric has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
erics has joined #ruby-lang
cyri_ has joined #ruby-lang
woollyams has joined #ruby-lang
burgestrand has joined #ruby-lang
y3llow has joined #ruby-lang
s0ber has joined #ruby-lang
y3llow has joined #ruby-lang
y3llow has joined #ruby-lang
y3llow has joined #ruby-lang
apeiros_ has joined #ruby-lang
A124 has joined #ruby-lang
y3llow has joined #ruby-lang
burns180 has joined #ruby-lang
y3llow has joined #ruby-lang
karshenas has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
dborin has quit [#ruby-lang]
<karshenas>
It's been several years since I've used IRC, but if I remember right it was usually best to read a FAQ before posting anything. Is this still common practice?
y3llow has joined #ruby-lang
<saneshark>
is everyone idle?
<shevy>
saneshark wat
<A124>
karshenas: Depends on interpretation of 'best'.
<shevy>
the strongest idler becomes king
<shevy>
I am a solid runnerup
<saneshark>
Hi shevy, i have a question about custom Liquid tags in ruby
<shevy>
that is nice but you should ask in general
<shevy>
this is the first time I heard about "custom liquid tags" so I could not be of any help
<saneshark>
i see, channel ruby-general?
<saneshark>
thanks
cored has joined #ruby-lang
cored has joined #ruby-lang
y3llow has joined #ruby-lang
<shevy>
wat
<shevy>
here
<shevy>
and then wait
<shevy>
you can idle while waiting :P
<saneshark>
heh ok, well perhaps I should ask phrase the question more specifically
<saneshark>
I have a class ImageTag < Liquid::Tag
y3llow has joined #ruby-lang
<saneshark>
I would like to create a class FigureImageTag < Liquid::Tag
<saneshark>
both of these will have a number of required parameters and optional parameters
mattonrails has joined #ruby-lang
<saneshark>
Since FigureImageTag uses the functionality of ImageTag by making a call to it, i need a way of parsing the regular expressions for the ImageTag provided by the user after initializing FigureImageTag… to do this, I most likely need to parse using a separator of some sort
y3llow has joined #ruby-lang
<saneshark>
Basically, what i'm trying to do, is create a custom tag to display something like this:
malev_ has joined #ruby-lang
<saneshark>
<figure class=center>
<saneshark>
<img src="/contra.jpg" alt="One of the greatest nintendo games of all time">
<saneshark>
<figcaption>Up Up Down Down Left Right Left Right B A B A <a href="http://www.youtube.com/contramoves/">Watch on Youtube</a></figcaption>
<saneshark>
</figure>
kp666 has joined #ruby-lang
<saneshark>
i already have a custom class created for the line that produces img, but I need that to appear nested within a figure
y3llow has joined #ruby-lang
<saneshark>
the figure will also need to have additional attributes for a possible link (to go around the img), and a caption for figcaption
<saneshark>
since some of the attributes of img can be optional from ImageTag , and likewise some will be optional in the link attributes… I imagine I will need to do parsing via a separator such as ';'
burgestrand has joined #ruby-lang
y3llow has joined #ruby-lang
<saneshark>
Is there some better way that I could implement these "nested" liquid tags using filters or drops as opposed to a using a bunch of regex? There has to be an efficient and yet DRY approach to solving this problem.
<saneshark>
i recall irc having a lot more stupid rules in channels than I'm finding here on freenode.net, but I suppose it was a bit more active too.
<saneshark>
maybe that was just EFNET?
<drbrain>
saneshark: maybe
<drbrain>
the rule here is mostly just "don't be a jerk"
<drbrain>
oh, and "no talking bots"
<drbrain>
… besides corundum
<saneshark>
oh, thank god for that - bots had to have been one of the most annoying things. except when they leeched files.
fayimora_ has joined #ruby-lang
fayimora has joined #ruby-lang
dajmon has joined #ruby-lang
<dajmon>
I am a master’s student performing research at the University of Texas at Austin School of Information. I am observing the channel as part of a study on Ruby culture (IRB Study Number 2011-12-0078).
<dajmon>
I am not collecting any identifying information. Please feel free to message me if you are interested in participating in a short interview.
<dajmon>
You may contact James Howison, the Principal Investigator, via e-mail at jhowison@ischool.utexas.edu or phone at (512) 232-9219 with questions, comments, or suggestions.
srbaker has joined #ruby-lang
<dominikh>
dajmon: your professor didn't teach you good manners, did he? Like, don't repeat that annoying message over and over :/
<saneshark>
lol
<drbrain>
dominikh: how many times is that?
<drbrain>
… in how many hours/days …
<dominikh>
four times over the course of 6 days
<TTilus>
you might get waycooler study if you built it on top of pry instead of irb..
<drbrain>
dajmon: are you a bot?
<dajmon>
no i'm not a bot
<dajmon>
it's a condition of my IRB approval that i have to say that every time i come in
<dajmon>
i originally didn't write it in but they requested that i do so
<dominikh>
okay, they actually teach you bad manners, that's great :D
<saneshark>
For good time email -- jhowison@ischool.utexas.edu -- he likes porn
<workmad3>
dajmon: I do not give permission for any of my conversation to be put into a research study for any purpose, even if it is stripped of non-identifying information
<drbrain>
dajmon: ☹
* workmad3
wonders how that will be handled :)
<drbrain>
dajmon: you should use dircproxy to stay in the channel longer
<drbrain>
then you won't have to repeat yourself so much, and we'll be less annoyed
<ged>
workmad3: Stripped of *non*-identifying information?
<TTilus>
irssi+tmux
<workmad3>
ged: :P
<ged>
:P
<dajmon>
i'm sorry if i've annoyed you, no one expressed any annoyance up until now. the spirit of the approval is that i have to say that every time i engage in any kind of participation/observation in here so i don't think i can get away with only saying it every time i physically join :(
<dajmon>
also, i'm not citing any specific quotes from people unless they consent to an interview, so you don't have to worry about me quoting your conversation
<dominikh>
how will they know you didn't do it? Also, are you going to mention this incident in your research? ;)
<drbrain>
I've read too many statistical reconstruction papers to believe in "non-identifying information"
<dominikh>
because I want to be mentioned by name :>
<drbrain>
dajmon: it's fine
<dajmon>
i will probably mention it in my research :P
<workmad3>
dajmon: I was more stating that I don't want anything I say in chan to be used in any research, not just that I don't want to be quoted
<felideon>
dajmon: how do you differentiate between #ruby-lang culture and IRC culture in general?
<TTilus>
dajmon: just out of curiosity, who are "they" who gave you that "approval"?
<dajmon>
the institutional review board
<drbrain>
dajmon: but, I think your research project is interesting
<lianj>
depends on the outcome :D
<drbrain>
TTilus: I would guess his research was reviewed for ethical practices
<TTilus>
workmad3: just sue them, then we'll see how it goes =D
<dajmon>
and felideon: that's an interesting question, i picked a specifically ruby-centered channel but there are definitely irc channels with no specific drive
<TTilus>
drbrain: most probably
<workmad3>
TTilus: :D that's an idea... a private british citizen suing an american university :)
<dajmon>
workmad3: i welcome you to e-mail the principal investigator at the e-mail address i sent above, but you'll find it's hard to argue that case because IRC channels are publicly logged and are public spaces
acyed has joined #ruby-lang
<dajmon>
at least in the definition of the IRB at the minute
<dajmon>
the equivalent is going into a town square and shouting "HEY EVERYONE I'M GOING TO WATCH WHAT YOU DO NOW"
achiu has joined #ruby-lang
woollyams has joined #ruby-lang
<drbrain>
workmad3: I think whitequark runs a public log
<dajmon>
i could technically have worked just from the public logs but i wanted to come in and talk to people :)
<workmad3>
drbrain: I don't mind being publically logged... I just disapprove of being used in research without being politely requested in advance :)
<drbrain>
and I have a private log
<workmad3>
hell, I don't even really disapprove of that... I was just curious as to how the research project would handle it :)
<drbrain>
workmad3: it's likely that most of the places you shop at use your actions for research…
<workmad3>
if the answer is 'screw you', that says a lot about it IMO ;)
<dajmon>
it's not something any of the researchers can answer beyond what i just said, really, you'd probably have to take it up with the institutional review board
looopy has joined #ruby-lang
<dajmon>
my answer isn't "screw you" :(
burns180 has joined #ruby-lang
<workmad3>
dajmon: it kinda is... a bit nicer, but essentially 'I'm not going to specifically exclude you because you requested it'... also, is this giving you insight into the culture of the Ruby community? :)
<dajmon>
a bit!
<TTilus>
workmad3: most probably! =D
<dajmon>
i mean i'm just not sure what you want me to do to "exclude you" if all i'm doing is reporting on the general topics of conversation
<TTilus>
dajmon: are you taking timezones into account?
<workmad3>
dajmon: I'm just messing with you now :D
RickHull has quit [#ruby-lang]
<dajmon>
TTilus: i can't, really, since I'm not collecting any kind of information, i can really only say "at these times (CST) people were talking about this thing
<dajmon>
"
<TTilus>
dajmon: i mean, the quality of the conversation skyrockets when the new continent is sleeping =D
urbino has joined #ruby-lang
tenderlove has joined #ruby-lang
<dajmon>
i wasn't aware of this, but i'll take it into account
<dajmon>
workmad3: i know you're teasing but this is my first irb-approved study so i am feeling a little nervous!!
<workmad3>
dajmon: also, how do you handle making sure people that join the channel after you've joined know that you're observing and researching them?
<urbino>
Anyone here willing to help a pythonista transition to ruby?
<felideon>
workmad3: someone should set the /topic for him
<dajmon>
well having a script at all is basically the research equivalent of throwing your hands up in the air and saying "well this is the best i can do"
gsav has joined #ruby-lang
<dajmon>
i mean, if I spammed it any more often I think people would get REALLY annoyed, as someone has already shown :P
<lianj>
urbino: always
* TTilus
doesnt really have a clue, but likes to think the old continent (and himself belonging there) as cognitively superior =D
<workmad3>
dajmon: also... is this conversation on IRB approved research going to end up as a conversation topic in your research? or are you going to attempt to remove the bias caused by your spam messages? :)
<urbino>
Thanks lianj
<urbino>
I am new to IRC and not a git gister but I am here to get over that too
<lianj>
whats irb again?
<dajmon>
workmad3: i don't think i'd QUITE qualify an informed consent script as spam…but yes, I think it would be silly not to talk about having this conversation
Pikkachu has joined #ruby-lang
* TTilus
is still puzzled how the research is irb based instead of, say, pry
<dajmon>
part of my sort of ideological slant has to do with treating an ethnographic researcher as a living breathing person and participant, rather than playing at objectivity
<lianj>
urbino: did you read some tutorials/books yet? any questions so far?
<drbrain>
TTilus: which continent is the old one?
<dominikh>
TTilus: that was a joke, right?
<dajmon>
TTilus: by that definition, the research is Adium-based :P
countskm has joined #ruby-lang
<workmad3>
dajmon: cool, throwing objectivity away as unobtainable :D
<urbino>
Yep, I get the built-ins but I am over looking something or coverage is rather implicit on...
<drbrain>
TTilus: I thought that Canada had some of the oldest exposed rocks…
<urbino>
in python I write a foo.py and have one bar function.
<TTilus>
dajmon: \o/ at least you are intellectually honest
<dominikh>
dajmon: what would the interview consist of?
<urbino>
from irb how do I start it interactivly to run the function from the foo.rb
<TTilus>
dominikh: me never jokin'
<dominikh>
TTilus: because, really, I hope the irb thing was one :P
<dajmon>
dominikh: interview is semi-structured and about half an hour of your time (less/more if you like) and i just cover a few basic topics and let you say whatever you want to say :)
<drbrain>
urbino: irb foo.rb
<workmad3>
dominikh: either he was joking, or he was proving his own statement about the old continent false :)
<dominikh>
workmad3: haha
<felideon>
30 min? geez
<dominikh>
dajmon: well, I could give it a try but cannot promise to be interesting.
<dajmon>
i'm just basing 30 minutes on what other people have done so far
<dajmon>
one person talked for almost an hour and a half but generally they lasted around half an hour
<dominikh>
oh, we're supposed to be creative? :>
<dajmon>
no need to be creative!
<urbino>
irb will not stay in interactive mode.?.
<workmad3>
urbino: irb is purely interactive mode
<dominikh>
dajmon: well then, feel free to give me a try.
<workmad3>
urbino: irb is interactive ruby
<TTilus>
drbrain: canada has some pretty old rocks, but so do finns
<lianj>
dominikh: please answer for me too ;)
<drbrain>
urbino: oops, lianj is right
<urbino>
it throws errors if I try to call the function from irb but it will run the script and produce the correct output
<dominikh>
lianj: sorry, my mind-reading skills suck. I will just insert EM and FFI randomly, okay?
<workmad3>
urbino: people were just telling you how to require the script when you load irb :)
<lianj>
dominikh: yep, that should work
<dominikh>
great
<saneshark>
what a bunch of exhibitionists… someone asks a question and everyone's silent, but someone shows up telling you they want to write about you and everyone gets excited! :)
<dominikh>
I only answer interesting questions :P
<dominikh>
and bark at people.
<dominikh>
I earned this
<workmad3>
I wasn't even looking at the channel, I just flicked through and saw an argument about politeness and read more :)
<TTilus>
urbino: "throws errors"?
<dajmon>
apologies again if spamming the channel is annoying, i'm having to walk a fine line between not being able to get everyone's consent, but still trying to let everyone know that i'm here
Pikkachu has quit [#ruby-lang]
<drbrain>
dajmon: if you could get it down to one line people wouldn't be annoyed so much
<saneshark>
./title dajmon would like to interview you, msg him if you would like to participate
<saneshark>
darn, i'm not an op
<dominikh>
I am sure you could state the "yo, I am researching" part and add a link to a pastie with all the contact info etc
<gate>
urbino: capybara webkit rocks, I've used it heavily in testing
<apeiros_>
+1
<TTilus>
i like capybara dsl alot
darkf_ has joined #ruby-lang
m3nd3s has joined #ruby-lang
<urbino>
does white space & tabs matter in ruby?
virunga has joined #ruby-lang
<urbino>
standard tab in python is 4 spaces for code
virunga_ has joined #ruby-lang
<drbrain>
urbino: no, but the convention is two-space indent
<urbino>
I have read two for ruby but it does not seem to mind yet
<TTilus>
urbino: not other than the difference between zero and some space ;)
<TTilus>
the convention is two-space (and no tabs)
<dominikh>
the only way ruby cares about indentation is that with -W (warnings enabled) it will bark when nesting is uneven. other than that, no indentation required at all, mixed is allowed, indenting every new line by 2 more spaces works as well. people will just hate you.
Giddeon has joined #ruby-lang
skipper has joined #ruby-lang
imperator has joined #ruby-lang
isale-eko has joined #ruby-lang
<urbino>
Is there a Counter function for item frequency "word frequency"
<TTilus>
like Array#count?
<urbino>
yep
<dominikh>
30
<dominikh>
arg.. never mind that
<dominikh>
for your information: it actually does take about 30 minutes :P
<urbino>
array.count will count items in array but what about frequency of items in the array?
<A124>
urbino: There is a way to do it through hash. Although there might be a funtion in that today.
<urbino>
how do you count frequency of words in a string?
<A124>
Give me a sec.
<urbino>
is the a collections class with a hash that can default to int values?
<TTilus>
urbino: what do you mean?
<A124>
Yes.
<TTilus>
urbino: you can set default for hash values
<A124>
Hash.new(0)
burns180 has joined #ruby-lang
<A124>
s = "one two two three three three"; s.split(' ').inject(Hash.new(0)) { |h,v| h[v] += 1; h }
<A124>
urbino: Is that what you want?
<A124>
In case you want inteligent word splitting, use Shellwords.split instead of split
<zenspider>
useless use of inject is useless
<zenspider>
anytime you see ; in an inject is a red flag
<dominikh>
+1
<A124>
Agreed. Sorry, and thanks for poiting that out.
<A124>
But the functionality is basically that, I wanted to show that, just rewrite it.
<wmoxam>
omg, sounds like someone is wrong on the internet
<urbino>
that works
<A124>
urbino: Welcome.
chimkan has joined #ruby-lang
<zenspider>
haha
<petercooper>
The only thing I learned that genuinely surprised me from the latest debacle is there's a repo on GitHub that abuses and slanders Zed Shaw, coupled with a weird rape fantasy cartoon with Zed's head pasted in.
<zenspider>
HAHA
<zenspider>
wtf?
<petercooper>
And we've had our differences, but I think it's crazy they let that stay.
<ged>
If I am writing data to a socket that is a binary header followed by utf-8 text, how do I avoid the "incompatible character encodings" when I try to append one to the other?
<zenspider>
petercooper: libels
<wmoxam>
petercooper: link?
<petercooper>
good point
<zenspider>
ged: with a gun to your mouth...
<petercooper>
although maybe it was also all uttered whilet yping it, heh
<zenspider>
seriously... the encoding shit drives me up the wall
<deryldoucette>
doesn't look like you closed the [] in 128
<A124>
["Armando", "S
<deryldoucette>
yep that'd be where i mean
<A124>
deryldoucette: <<
<cored>
no that was a bad pastie
<cored>
but the code is good
<zenspider>
cored... if you want help with something. you need to provide more information than a blob of code. A question and enough data to support that question is needed if we're to understand anything
<A124>
Exactly.
CodyD has joined #ruby-lang
<zenspider>
and see above for my rant on your reduce. it's wholly unnecessary
RomyRomy has joined #ruby-lang
<deryldoucette>
my usual alias..
<deryldoucette>
Please ask SICCO questions :) Specific, Informative, Concise, Complete, and On-Topic. This means we need a description of the problem, it's symptoms, what you have tried, and MAKE SURE you've searched for answers on your own FIRST! GOOGLE IS YOUR FRIEND! Without this information, we can not assist you since we can not troubleshoot a problem if we have no info regarding what it should be doing and is not.
<A124>
zenspider: Talking to me?
<deryldoucette>
follow that to get higher quality assistance back from your questions
<zenspider>
A124: still talking to cored
<A124>
Ah. ok. Thanks
<zenspider>
and now it seems like I'm talking to a wall
<A124>
That's normal.
<ged>
drbrain, dominikh: That worked great, thanks!
achiu has joined #ruby-lang
dous has joined #ruby-lang
<A124>
Why there are two channels anyway? #ruby and #ruby-lang?
<dominikh>
because some people thought it was a good idea to open their own, inofficial channel, ignoring freenode channel naming guidelines
<petercooper>
Whoa, I never ever realized
<drbrain>
A124: and so people have a place to go when they get kicked out for being jerks
<deryldoucette>
err? how is that a violation? ruby-lang is the official, ruby is about well ruby
<A124>
dominikh: Yes, that is the only thing that probably axplains it
<deryldoucette>
never saw that as being a violation
<petercooper>
it should be ##ruby, deryldoucette
<deryldoucette>
ahhh
<dominikh>
what he said
<petercooper>
on freenode, # channels are, I believe, meant to be 'official' for the named project
<dominikh>
correct
<deryldoucette>
got ya. thanks for the clarification
<petercooper>
Though does that mean this channel was founded in relation to ruby-lang.org?
<A124>
Yes, they ar.
<drbrain>
petercooper: I think so
<dominikh>
yup
<A124>
ruby-lang is in esential current ruby development
<drbrain>
I can't remember that far back
<deryldoucette>
heh
<dominikh>
one way or another it's the official channel now
* petercooper
prays #ruby isn't the Ruby equivalent of #rubyonrails
burns180 has joined #ruby-lang
<deryldoucette>
i ahve trouble remembering what i did yesterday, nevermind what took place way back when :)
<deryldoucette>
s/ah/ha/
<dominikh>
ahahaha
<zenspider>
I thought ## was for stuff "off topic"... this being an open source irc... that's why I'm in ##mathematica
<zenspider>
and ##homebrew is about beer :)
<deryldoucette>
mmmm beer
<zenspider>
(and ALWAYS gets me when I need help with machomebrew)
<dominikh>
haha. well, it follows the same principles ;)
<dominikh>
the channel founders do not own the names mathematics or homebrew