<andrewhl>
if I have an array of numbers, let's say [1,1,1,1,2,1,1,1], and I want to check that all the numbers in the array are equal, and if not output "false", is there a simple enumerable method I can use?
<samuelkadolph>
andrewhl: No built in method. You could do something like array.all? { |e| e == array.first }
<andrewhl>
ok I'll try that, thanks
<jarib>
or array.uniq.size == 1
<samuelkadolph>
all? better describes the intention imo
nofxx has joined #ruby-lang
<rue>
Allallalala
<seanstickle>
jarib: nice!
shevy has joined #ruby-lang
nofxx has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
gnufied has joined #ruby-lang
nofxx has joined #ruby-lang
havenn has joined #ruby-lang
nofxx has joined #ruby-lang
qpingu has joined #ruby-lang
nofxx has joined #ruby-lang
nif has joined #ruby-lang
savage- has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
diegoviola has joined #ruby-lang
nofxx has joined #ruby-lang
jxie has joined #ruby-lang
nofxx has joined #ruby-lang
jxie has joined #ruby-lang
nofxx has joined #ruby-lang
shtirlic has joined #ruby-lang
rking has joined #ruby-lang
ryanf has joined #ruby-lang
brushbox has joined #ruby-lang
nofxx has joined #ruby-lang
rdavila has joined #ruby-lang
drumond19 has joined #ruby-lang
nofxx has joined #ruby-lang
mbriggs has joined #ruby-lang
<ReinH>
jarib: that's clever but not very intention revealing
<ReinH>
I would prefer samuelkadolph's
<ReinH>
"are they all the same as the first one" describes the intent
<erikh>
jarib's solution is probably a shitton faster in a language where the length of the result is stored
<bnagy>
the .all? approach will return true for an empty array
<bnagy>
also, I do it with uniq in my code, so I must support it :>
<erikh>
heh
<bnagy>
anyway 'is there only one kind of value' is as transparent to me as 'are all the elements the same as the first one'
<bnagy>
who even thinks like that
<erikh>
apparently someone
* erikh
makes the wisest comments
<bnagy>
well not all solutions can be expressed in code the way you would think them
<erikh>
oh, sure. and arguably the ones that perform the best take the above statement to the extreme
neoesque has joined #ruby-lang
nofxx has joined #ruby-lang
srbaker has joined #ruby-lang
nofxx has joined #ruby-lang
heftig has joined #ruby-lang
savage- has joined #ruby-lang
nofxx has joined #ruby-lang
savage-_ has joined #ruby-lang
nofxx has joined #ruby-lang
oddmunds has joined #ruby-lang
gix has joined #ruby-lang
zcdny has joined #ruby-lang
<zcdny>
Hi, guys, how to aliases a object name ?
gnufied has joined #ruby-lang
nofxx has joined #ruby-lang
deobald has joined #ruby-lang
nofxx has joined #ruby-lang
ramonmaruko has joined #ruby-lang
andrewhl has joined #ruby-lang
dfr|mac has joined #ruby-lang
dfr|mac_ has joined #ruby-lang
rking has joined #ruby-lang
woollyams has joined #ruby-lang
boxmo has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
boxmo has joined #ruby-lang
boxmo has joined #ruby-lang
mbriggs has joined #ruby-lang
pabloh has joined #ruby-lang
ryanf has joined #ruby-lang
nofxx has joined #ruby-lang
<ReinH>
"object name"?
boxmo has joined #ruby-lang
<drbrain>
a = Object.new; b = a # +
<drbrain>
?
michael_mbp has joined #ruby-lang
<michael_mbp>
hi, if I do class Foo; import Bar; end // is OK to call foo the 'receiver' when describing in context of the module Bar?
<erikh>
include I presume?
<michael_mbp>
i.e. module Bar; def self.included(klass); klass.insance_eval { } // the instance_eval operates on the receivers singleton class.
<erikh>
and if that's what you mean, yes, it's ok.
<michael_mbp>
so that klass.extend ClassMethods // all definitions there are operate on the receiver the same as those inside instance_eval
<michael_mbp>
-are
<erikh>
that's.... do you really need to do that?
pabloh has joined #ruby-lang
<michael_mbp>
it's a bit of duplication of the something right?
<erikh>
yeah, like class Foo; stuff; end
<ReinH>
so Ruby has this thing called extend
boxmo has joined #ruby-lang
<michael_mbp>
they both essentially do class << self; … ; end on the receiving class
<erikh>
right
<michael_mbp>
the only thing about this pattern I think it's a bit cleaner for mixing in with Rails is that one can organise all the before_filters etx in the .instance_eval simple for the convenience of reading
<erikh>
well, where self is klass in this case
slyphon has joined #ruby-lang
<michael_mbp>
exactly.
<erikh>
(which is usually how class << self is used, but i'm digressing)
<erikh>
eh
<erikh>
I dunno. it's up to you, but that seems like a completely backwards way of doing what you want to do
<michael_mbp>
and all proceeding methods are instance methods, then whatever that goes within the ClassMethods module are created as singleton methods ...
<erikh>
and i'm one guy so take my opinion with a heavy dose of salt
<michael_mbp>
ok here's an alternative
<erikh>
you know, scratch that. I'm not trying to be rude, but I still have no idea what your end goal is here.
<erikh>
yeah, it's a direct approach instead of a callback-based one
<erikh>
if you don't need a callback, don't use it.
rippa has joined #ruby-lang
<michael_mbp>
well I think you're method doesn't allow once you do simply do include Bar at the top level of the class and let it setup both instance and class methods.
<erikh>
all this said; I would strongly encourage you to manage your classes in a way that don't require singleton objects
<michael_mbp>
right
boxmo has joined #ruby-lang
<erikh>
IIRC they take their toll on the interpreter because additional management needs to come along with those objects.
<michael_mbp>
ah
<erikh>
which might be an issue in largish applications
<drbrain>
michael_mbp: I don't expect include to add more than instance methods
<drbrain>
michael_mbp: so I prefer having two lines
<drbrain>
include, extend
<michael_mbp>
include and the extend separately then :)
<drbrain>
if it's not working you're not using enough of it
nofxx has joined #ruby-lang
<ReinH>
drbrain: confirm
boxmo has joined #ruby-lang
z3r00ld has joined #ruby-lang
srbaker has joined #ruby-lang
fragmachine has joined #ruby-lang
<fragmachine>
Hello I'm trying to install libxml-ruby-2.3.2 but I get this error with 'gem install libxml-ruby-2.3.2': "The compiler failed to generate an executable file. You have to install development tools first". I do have development tools installed though, Xcode 4.3.1. Anyone know how to fix this?
<drbrain>
fragmachine: why libxml-ruby?
nofxx has joined #ruby-lang
<fragmachine>
its for rubyosa, a gem that lets you control mac applications using applescript
<fragmachine>
it tries do install libxml first and always fails
<fragmachine>
I'm using Ruby 1.9.3
<drbrain>
fragmachine: I spoke to Laurent about it and he says you should either use MacRuby or rb-appscript
Banistergalaxy has joined #ruby-lang
<fragmachine>
oh cool I've never heard of rb-appscript. I'll check it out. Thanks!
boxmo has joined #ruby-lang
<drbrain>
fragmachine: the latest release doesn't run on OS X 10.6 (or, probably, 10.7)
<michael_mbp>
they ain't wrapped the scope in that first example within base.instance_eval as that's redundant
<michael_mbp>
anyways, the Concern module looks like a better means as it resolves module dependencies...
<erikh>
oh man, that's a bit out of my element
<michael_mbp>
ah no worries, thanks for helping me though :)
woollyams has joined #ruby-lang
tjadc has joined #ruby-lang
<Xzyx987X>
hmm... is there no simple direct method to change the time zone of a ruby Time object? I can't seem to find on anywhere I look
francisfish has joined #ruby-lang
francisfish has joined #ruby-lang
nofxx has joined #ruby-lang
dous has joined #ruby-lang
tjridge has joined #ruby-lang
<bnagy>
dunno, I guess I'd do time.getutc + newoffset
<bnagy>
I mean a time object is basically an int in fancy clothes, so I don't think 'changing' anything about it is a useful way of thinking about it
dous has quit [#ruby-lang]
<Xzyx987X>
well, in this case I need the actual time object to get changed so that when I can time.utc_offset later, I get the correct value
<bnagy>
s/int/numeric/whatever
<Xzyx987X>
I could keep track of it seporately, but it would be cumbersome and unnecessary since the time object already has the functionality
<bnagy>
not sure why you need to 'change' an object to do that
<Xzyx987X>
well, strictly speaking I don't, but it just seemed strange that I couldn't
<bnagy>
like I said, think of it as a number
<Xzyx987X>
time objects seem to keep track of the utc offset independantly of anything else, so it seems weird there wouldn't be a way to change it
<bnagy>
you can't change 3 into 4
<bnagy>
a=3; a+=1
<bnagy>
I am at utc+7, right, so Time.now.getutc + (7 * 3600) => 2012-04-16 15:12:13 UTC
<Xzyx987X>
actually, the utc offset is an independant part of of a time object. has nothing to to with what the actual integer value of a time object is
gnufied1 has joined #ruby-lang
<bnagy>
I didn't say it did, I just said that you should think of it that way :)
<Xzyx987X>
You can do Time.now += 3600, and the utc offset remains the same
gokul has joined #ruby-lang
<Xzyx987X>
one option that would create a new time object I saw was: Time.parse(Time.now.strftime('%Y-%m-%d %I:%M:%S UTC'))
<Xzyx987X>
it seemed simple enough, but it doesn't work correctly if you change the time zone
<bnagy>
why on earth would you do that?
<Xzyx987X>
well, it was the first thing that came up on google that seemed like it would actually do what I wanted
<bnagy>
if you want current UTC do Time.now.getutc
<bnagy>
or probably Time.utc
nofxx has joined #ruby-lang
<Xzyx987X>
I would do that because: Time.parse(Time.now.strftime('%Y-%m-%d %I:%M:%S +01:00'))
<Xzyx987X>
but, that doesn't work, it just ends up creating an object with the local time zone
<bnagy>
wait what do you want to so?
<bnagy>
see the time in UTC+1 ?
<Xzyx987X>
no, I want to keep track of what time zone the time was originally in
<Xzyx987X>
I don't actually want to change the value of the time
<bnagy>
well you can always get the timezone by subtracting utc from local, no?
<bnagy>
you're confusing me, you keep changing what you want :)
<Xzyx987X>
right, but then you need to keep track of two things instead of one
<Xzyx987X>
you need to always know the time zone offset of the time object, plus the time zone offset the time object actually contains is wrong
<bnagy>
you don't need to know the offset to convert it to a new timezone
<Xzyx987X>
you don't?
<bnagy>
time_in_outer_frickin_mongolia.getutc + 3600 # Now I'm in Paris, biatch!
<Xzyx987X>
you used a time zone offset in that example...
<bnagy>
yeah the new one
boxmo has joined #ruby-lang
<bnagy>
I don't need the old one
<bnagy>
but to convert to something you need to know what you're converting to :>
tjridge_ has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
heftig has joined #ruby-lang
<Xzyx987X>
...ok, lets make this simple. I don't care how it is accomplished, but I need a way to make a Time object give me the correct value when I call utc_offset
<Xzyx987X>
and the correct value is: 3600
<bnagy>
and what is the 'correct value'? Cause the way I look at things it always will
<Xzyx987X>
for example
<Xzyx987X>
the correct value is always 3600 in this example
<Xzyx987X>
how do I do it?
<bnagy>
like if it's an outer mongolia time it will give you mongolia_offset * 3600
<bnagy>
your question makes no sense at the moment
<bnagy>
you want #utc_offset to always return 3600? :P
<Xzyx987X>
well, I want a function to return a specific value, how do I make that happen?
apeiros_ has joined #ruby-lang
<Xzyx987X>
how is that complex?
<bnagy>
it's not, it's just insane
<bnagy>
if you always want X just use X as an immediate
<Xzyx987X>
ok, let me add a requirement: you are not allowed to change or replace the existing utc_offset method in any way
<bnagy>
that's fine, but your original requirement is ... unclear
<bnagy>
is it like times.map {|time| 3600 #sucka!} or what?
<Xzyx987X>
you create a time object, that time object returns 3600 when you call the method utc_offset
<Xzyx987X>
you can't change or replace the utc_offset method
<bnagy>
I didn't, actually, I swapped out the whole class for a new one :)
<Xzyx987X>
I tried to explain what I was actually doing before, but it wasn't getting me anywhere...
nofxx has joined #ruby-lang
<bnagy>
don't take this the wrong way, but you seem to be suffering from two common issues
<bnagy>
asking the question you think you want instead of the real question
<bnagy>
and not listening
<Xzyx987X>
ok, let's put it this way, every time object has a utc offset, correct?
<bnagy>
let's play a different game
<Xzyx987X>
...
<bnagy>
you provide a use case and a requirement and we provide code
<bnagy>
cause 'make an object's method return a random value, but you can't replace the method' is not useful
futurechimp has joined #ruby-lang
<Xzyx987X>
I think you are completely misunderstanding why I am even asking this question...
<bnagy>
how could I? You haven't explained it.
<Zolrath>
From what I can tell
<Xzyx987X>
could I do what I'm doing without using a time object? of course I could
<Zolrath>
hes trying to change the timezone of an object
<Xzyx987X>
I don't need you to tell me how to do that
<Xzyx987X>
I need to know how to change the timezone of a time object
<Xzyx987X>
or if you even can
<Xzyx987X>
that's all I care about
<Xzyx987X>
if I can't, I'll do what I want a different way
<Zolrath>
I'd say just store the time as utc and apply timezone offsets as necessary when outputting for specific regions
boxmo has joined #ruby-lang
<Xzyx987X>
well, the basic implementation I have is that I am running a server that keeps track of users, and knows there default time zone
<Xzyx987X>
I want user.time to return an object with the users local time
<Xzyx987X>
that much is easy, I have already done it
<Xzyx987X>
but said time object still has an incorrect time zone value
<Xzyx987X>
if I try to check it later, it will be wrong
<bnagy>
just store the timezone, and then use Time.now + user.timezone
<Xzyx987X>
it's technically not something that can't be worked around, but say you wanted to have the time zone in the time object be accurate, could I do it?
boxmo has joined #ruby-lang
<Xzyx987X>
I'm already storing the time zone, I just said I was
<Xzyx987X>
I'm trying to simplify some code by having the time object keep track of the time zone on it's own
<bnagy>
:S all time objects keep track of their timezones, dude
<Xzyx987X>
bnagy: you are really not being very helpful. I don't know why you are not understanding me, but I really don't think what I'm saying is that unclear
<bnagy>
:)
<bnagy>
write a minimal code exampe, put it on gist / pastie
nofxx has joined #ruby-lang
<bnagy>
with the values you expect and the values you're getting
<Xzyx987X>
you want to know what is really confusing me? code: Time.parse(Time.now.strftime('%Y-%m-%d %I:%M:%S -0000'))
<Xzyx987X>
I couldn't even find documentation for Time.parse, so I have no idea why it doesn't work
<Xzyx987X>
if those examples could be made to work, I would be happy
workmad3_ has joined #ruby-lang
<bnagy>
well I don't even have Time#parse :)
boxmo has joined #ruby-lang
<bnagy>
but luckily I would never try to do whatever you're trying to do with a useless call to parse Time.now
<Xzyx987X>
well, that's weird. I'm not even sure where I got it from
workmad3_ has joined #ruby-lang
<bnagy>
could be old
<Zolrath>
You need to require 'time' to get Time.parse
<Xzyx987X>
Time.now is just so you can get a time object for testing purposes. it doesn't matter if it does anything useful
<bnagy>
or it could be...yeah what he just saud
<Zolrath>
If you're dead set on creating a time object with the timezone in it instead of storing it as UTC
gouthamvel has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
<Xzyx987X>
technically, I am storing them in utc
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
d3vic3 has joined #ruby-lang
<Zolrath>
You really should just store it as UTC and then provide the offset based on the users timezone setting when displaying it.
<Zolrath>
If you want to display the time to another user, or if the original user moves and changes their timezone
<bnagy>
16:30 < bnagy> just store the timezone, and then use Time.now + user.timezone
<Zolrath>
The result will still be correct. If you store set it in the time object itself and do no correction based on the user then you're just storing incorrect data
<bnagy>
%|
<Xzyx987X>
yes, I am aware that is an option. that was never the point. the point is I wanted to try doing it with the time object, and I wanted to know if it was actually possible
<Xzyx987X>
and I can't seem to get a straight anwser
<Zolrath>
You can create a time object with a specific timezone with Time.new(2012,6,21, 13,30,0, "+09:00")
boxmo has joined #ruby-lang
<Xzyx987X>
wrong number of arguments (7 for 0)
<bnagy>
ok, afaict the offset is not an instance variable
<Zolrath>
What version of ruby are you using?
<Xzyx987X>
yea... I am on 1.8.7
<Zolrath>
stop that
<Zolrath>
haha
<bnagy>
so it's not like you can just instance_variable_set
<bnagy>
in other words, no, I do not think the bizarre thing you are trying to do is easily possible except for monkey patching a method, which you said you didn't want to do
nofxx has joined #ruby-lang
brushbox has joined #ruby-lang
<bnagy>
basically this conversation has been like
<Xzyx987X>
actually, Time.utc seems to do exactly what I want... now that I look at it
<bnagy>
you: my car won't start, it's the spark plugs, how do I change them
<bnagy>
us: it's the battery
<bnagy>
you: whatever, how do I change the spark plugs
<Xzyx987X>
I must've missed it the first time I sifted through the documentation
<bnagy>
us: it's the battery
<Xzyx987X>
it wasn't clear
<bnagy>
you: ok fine, it's the battery. How do I start it without touching the battery or attaching jumper cables?
<Xzyx987X>
and then I figured out how to do what I was asking if I could do the whole time, and it was really simple and straightforward and not circuitous at all, rendering your point moot.
<bnagy>
:) seriously, we're (I am) trying to help, nobody is paying us to be here
boxmo has joined #ruby-lang
<Xzyx987X>
I know you are not being paid, but you still led me around in circles for an hour regarding something that actually wasn't that difficult or complex
<bnagy>
sigh
<Xzyx987X>
you could have just said: I don't know
<Xzyx987X>
or not said anything at all
<Xzyx987X>
those were options
<bnagy>
. o O ( think of the karma... )
toretore has joined #ruby-lang
Kuukunen has joined #ruby-lang
nofxx has joined #ruby-lang
boxmo has joined #ruby-lang
tridge_ has joined #ruby-lang
tekin has joined #ruby-lang
nofxx has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
boxmo has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
jxie has joined #ruby-lang
<Xzyx987X>
ok, this is somewhat interesting. it would seem like on my copy of ruby 1.8.7 the isdst and tz parameters of the Time.utc method don't actually do anything
<Xzyx987X>
same for Time.local and Time.gmt
mikkelb has joined #ruby-lang
<mikkelb>
Hey!
<Xzyx987X>
I give up on this, but could someone confirm that they also don't work on their copy of ruby?
<andrewvos>
Xzyx987X: I could execute some code here
<Xzyx987X>
should be true if it worked correctly, false if it didn't
<bnagy>
utc doesn't have dst
<manveru>
is utc permanently dst? :P
<Xzyx987X>
usually it would never be true for a UTC time, but my code sets the dst value of the time object it creates to true regardless
<Xzyx987X>
or at least it should
<Xzyx987X>
otherwise why is the parameter even there?
<matti>
manveru: ;]
<manveru>
don't think i've ever gotten Time to respect the timezone without parsing
<rue>
HI
<Xzyx987X>
yea, I tred that earlier. that also didn't work
publicvoid_ has joined #ruby-lang
<Xzyx987X>
either way, ruby just seems to ignore the last two parameters of the Time.utc method. it doesn't matter what you set them to, it does nothing
<ARTIsshoque>
Hello! Can you help me with some song? I don't speak English as well as you, so I can't understand what word is in one of songs. "The music's down, th lights are ..." Something sounds like "deam" or "dean" and I can't guess what it is. Please help me, it's very important for me. Sorry for offtopic.
<manveru>
ARTIsshoque: dim?
mistym has joined #ruby-lang
<ARTIsshoque>
Oh thank you very very very much!
ARTIsshoque has quit [#ruby-lang]
<manveru>
!next
jtoy has joined #ruby-lang
melter has joined #ruby-lang
<ddfreyne>
well, that was odd
<ddfreyne>
manveru: dim is so visual basic
paul0 has joined #ruby-lang
krohrbaugh has joined #ruby-lang
<workmad3>
ruby-lang, the new place for english lessons
<bnagy>
can't hurt, given the recent level of reading comprehension
gouthamvel has joined #ruby-lang
akahn has joined #ruby-lang
DMKE has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
savage- has joined #ruby-lang
kiddorails has joined #ruby-lang
enebo has joined #ruby-lang
MDmalLION has joined #ruby-lang
mbriggs has joined #ruby-lang
gokul has joined #ruby-lang
thone has joined #ruby-lang
datanoise has joined #ruby-lang
krohrbaugh has joined #ruby-lang
vesan_ has joined #ruby-lang
jxie has joined #ruby-lang
kiddorails has joined #ruby-lang
<shevy>
readin enlih is hardr thn writng eglish
chendo_ has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
<rolfb>
shevy: desagre
<shevy>
hmm you are right
<shevy>
yoda also knows no english
<rolfb>
:)
<shevy>
difficult not english is
<rolfb>
yoda is easy to parse
fattastic has joined #ruby-lang
msisk has joined #ruby-lang
<shevy>
parse easy to is yoda
<bnagy>
pssh
<bnagy>
yoda english easily parse can
tekin has joined #ruby-lang
Natch has joined #ruby-lang
fattastic has joined #ruby-lang
Sailias has joined #ruby-lang
erics has joined #ruby-lang
beiter has joined #ruby-lang
tttttt has joined #ruby-lang
beiter has joined #ruby-lang
andrewhl has joined #ruby-lang
rippa has joined #ruby-lang
Natch| has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
Radium has joined #ruby-lang
Sailias_ has joined #ruby-lang
zmack has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
frem has joined #ruby-lang
io_syl has joined #ruby-lang
Defusal_ has joined #ruby-lang
moogs has joined #ruby-lang
vesan has joined #ruby-lang
michael_mbp has joined #ruby-lang
<michael_mbp>
how does Array[0..20] work?
<andrewvos>
michael_mbp: [] is a method on Array
<michael_mbp>
ah thought as much
<michael_mbp>
how can I send […] to an object?
<michael_mbp>
obj.send(:[], 0..20) ?
<michael_mbp>
obj.send(:[], 0, 20) ?
<michael_mbp>
let me try
<michael_mbp>
nice.
<canton7>
it's lovely when problems solve themselves...
cdnz has joined #ruby-lang
cdnz has quit [#ruby-lang]
cj3kim has joined #ruby-lang
MDmalLION has joined #ruby-lang
jeremytarling has joined #ruby-lang
jeremytarling has quit [#ruby-lang]
kitallis has joined #ruby-lang
<andrewvos>
Hmmm, has anyone made a custom matcher for capybara?
<padstow>
I'm trying to test a method that results in some text on stdout; my method returns this as an array; I want to assert that the arrau contains a value that matches a regex; other than write code that iterates over the array, testing each element, is there a tidier approach?
crackity_jones has joined #ruby-lang
<andrewvos>
Right fuck that I give up. Capybara code makes my brain hurt.
<bnagy>
padstow: and then again, in english!
<padstow>
hah
<padstow>
ok! I have a method that runs some commands on a unix machine; i care about the output taht appears on teh screen.
<padstow>
my method captures the output, and returns it as an array, on element for each line of output
<bnagy>
code (or gtfo)
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
vesan___ has joined #ruby-lang
nofxx has joined #ruby-lang
<bnagy>
but, frankly, sounds like it is premature optimisation
<padstow>
bnagy: not optimization - i want to test that the output is expected; i can do that by iterating over each element of the array and asserting that the element matches
<padstow>
but that feels clumsy
<padstow>
i am wondering if tehre's a better way
<bnagy>
uh.. I do this stuff with 'expect' :/
<padstow>
i'm using rspec
<bnagy>
also I am drunk as a monkey sorry
<padstow>
hah, ok :)
<bnagy>
but it looks like you're writing your shell scripts in ruby
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
padstow has quit ["Killed buffer"]
diegoviola has joined #ruby-lang
nofxx has joined #ruby-lang
jondot has joined #ruby-lang
achiu has joined #ruby-lang
nofxx has joined #ruby-lang
travisjeffery has joined #ruby-lang
lsegal has joined #ruby-lang
Mchl has joined #ruby-lang
<shevy>
that is good!
<shevy>
more ruby, less shell!
nofxx has joined #ruby-lang
travisjeffery has joined #ruby-lang
travisjeffery has joined #ruby-lang
travisjeffery has joined #ruby-lang
nofxx has joined #ruby-lang
niklasb has joined #ruby-lang
rippa has joined #ruby-lang
nahhh has joined #ruby-lang
nofxx has joined #ruby-lang
travisjeffery has joined #ruby-lang
S1kx has joined #ruby-lang
S1kx has joined #ruby-lang
savage-_ has joined #ruby-lang
brianpWins has joined #ruby-lang
nofxx has joined #ruby-lang
wmoxam has joined #ruby-lang
enebo has joined #ruby-lang
travisjeffery has joined #ruby-lang
nofxx has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
savage- has joined #ruby-lang
travisjeffery has joined #ruby-lang
kensei has joined #ruby-lang
achiu1 has joined #ruby-lang
nofxx has joined #ruby-lang
workmad3 has joined #ruby-lang
mrsolo has joined #ruby-lang
tjadc has joined #ruby-lang
jbwiv has joined #ruby-lang
solars has joined #ruby-lang
qpingu has joined #ruby-lang
hrnt has joined #ruby-lang
kiddorails has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
kensei has quit [#ruby-lang]
kensei has joined #ruby-lang
travisjeffery has joined #ruby-lang
Austin__ has joined #ruby-lang
nofxx has joined #ruby-lang
bglusman has joined #ruby-lang
apeiros_ has joined #ruby-lang
Doobie has joined #ruby-lang
Taranis has joined #ruby-lang
dabradley has joined #ruby-lang
JohnBat26 has joined #ruby-lang
mjsells1 has joined #ruby-lang
nofxx has joined #ruby-lang
mjsells1 has quit [#ruby-lang]
krz has joined #ruby-lang
rippa has joined #ruby-lang
datanoise has joined #ruby-lang
lsegal has joined #ruby-lang
nofxx has joined #ruby-lang
francisfish has joined #ruby-lang
nofxx has joined #ruby-lang
gregf has joined #ruby-lang
nofxx has joined #ruby-lang
phlipper has joined #ruby-lang
jbwiv has joined #ruby-lang
nofxx has joined #ruby-lang
gsav has joined #ruby-lang
m3nd3s has joined #ruby-lang
slimfit has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
boxmo has joined #ruby-lang
kiddorails has quit [#ruby-lang]
nofxx has joined #ruby-lang
_dabradley has joined #ruby-lang
boxmo has joined #ruby-lang
benanne has joined #ruby-lang
<erikh>
drbrain: ze patches boss, ze patches!
bglusman has joined #ruby-lang
nofxx has joined #ruby-lang
Boohbah has joined #ruby-lang
boxmo has joined #ruby-lang
nofxxx has joined #ruby-lang
travisjeffery has joined #ruby-lang
gouthamvel has joined #ruby-lang
rking has joined #ruby-lang
<shevy>
hmm anyone knows if it is possible to use a colourized prompt, via Readline, where the colours are constantly changing? like a disco prompt!
gsav has joined #ruby-lang
<erikh>
not without really making it hard to type
<erikh>
but yes, you could \r\e[asdfasdfm;
boxmo has joined #ruby-lang
<erikh>
where asdfasdf is a color code
<shevy>
cool, going to give that a try.... Disco fever! \o/
<erikh>
we used to make animated signatures on BBS systems
<erikh>
little spinners and so forth that would print out our name
<erikh>
you'd program them in and hit a fkey to add them
nofxx has joined #ruby-lang
rolfb has joined #ruby-lang
boxmo has joined #ruby-lang
nofxx has joined #ruby-lang
<shevy>
hehe
dankest has joined #ruby-lang
travisjeffery has joined #ruby-lang
workmad3 has joined #ruby-lang
mbriggs has joined #ruby-lang
boxmo has joined #ruby-lang
workmad3 has joined #ruby-lang
nofxx has joined #ruby-lang
boxmo has joined #ruby-lang
deobald has joined #ruby-lang
fgomez has joined #ruby-lang
fgomez has joined #ruby-lang
diegoviola has joined #ruby-lang
postmodern has joined #ruby-lang
nofxx has joined #ruby-lang
boxmo has joined #ruby-lang
boxmo has joined #ruby-lang
nofxx has joined #ruby-lang
boxmo has joined #ruby-lang
justinmcp has joined #ruby-lang
nofxx has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
boxmo has joined #ruby-lang
gsav has joined #ruby-lang
dankest has joined #ruby-lang
nofxxx has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
RORgasm has joined #ruby-lang
boxmo has joined #ruby-lang
nofxx has joined #ruby-lang
workmad3 has joined #ruby-lang
nofxx has joined #ruby-lang
<zenspider>
wtf
boxmo has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
<zenspider>
oh. dur.
krzkrzkrz has joined #ruby-lang
PhilCK has joined #ruby-lang
boxmo has joined #ruby-lang
Guedes has joined #ruby-lang
NOKAH has joined #ruby-lang
<zenspider>
yay! :arglist is dead! :scope is next!
<zenspider>
rawr
boxmo has joined #ruby-lang
nofxx has joined #ruby-lang
travisjeffery has joined #ruby-lang
dabradley has joined #ruby-lang
boxmo has joined #ruby-lang
nofxx has joined #ruby-lang
<TTilus>
?
francisfish has joined #ruby-lang
<zenspider>
I'm finally taking an axe to my least favorite nodes in ruby_parser... major changes coming
boxmo1 has joined #ruby-lang
<zenspider>
57% through removing scope and block nodes from class/sclass/def/defs nodes
<zenspider>
thank god for emacs' paredit mode... a bit wonky in ruby but still absolutely great for these types of edits
rking has joined #ruby-lang
vesan_ has joined #ruby-lang
<TTilus>
you rock!
<TTilus>
and so does paredit
nofxx has joined #ruby-lang
<robgleeson|mba>
57%, how precise :P
<zenspider>
done! now... "just" 134 failures to fix :/
workmad3 has joined #ruby-lang
<zenspider>
robgleeson|mba: emacs
<TTilus>
two significant figits, the emacs procision
<robgleeson|mba>
I think I found the most awesome OSX feature: if you make your system unbootable(no disk to boot from, no CDs, nothing) it can do a internet recovery.
<robgleeson|mba>
re-install Lion over the wire.
<robgleeson|mba>
that is truly awesome.
<TTilus>
s/fig/dig/
boxmo has joined #ruby-lang
<zenspider>
holy shit. 40 to go. I love good design
<fowl__>
robgleeson|mba, your mac cant handle your leetness
JEG2 has joined #ruby-lang
<robgleeson|mba>
fowl__: more like my stupidity, overwrote the boot loader by mistake :p
<zenspider>
robgleeson|mba: how did you do that??
<TTilus>
robgleeson|mba: if your mac cant boot, how do you boot it to do inet recov? and where does it boot from after the recov?
<zenspider>
TTilus: it'll do a netboot from apple
<robgleeson|mba>
zenspider: installing FreeBSD, I had refit on one partition but totally forgot about it when I was installing FreeBSD.
<TTilus>
robgleeson|mba: ah, you mean you _do_ have a disk but it is in unbootable state
boxmo has joined #ruby-lang
<robgleeson|mba>
yeah, I have a disk, just can't boot from it.
<robgleeson|mba>
but in 1 hour & 3 minutes I will be able to. ;)
<zenspider>
robgleeson|mba: next time you MAY be able to recover the whole thing data and all with pdisk
<zenspider>
do the netboot, but then drop to terminal
travisjeffery has joined #ruby-lang
<Asher>
anyone familiar with cookie security? I'm curious how one secures the session id - even if it is stored encrypted in a cookie, it seems like unless the whole site goes https that the encrypted cookie can be sniffed and then used as-is, since the server has to decrypt the cookie…
<robgleeson|mba>
I'm going to try again, but this time I'll be careful not to nuke the refit partition.
<Boohbah>
Asher: yes, that would be session hijacking
<Asher>
ie you can prevent the user from knowing what the session ID is by encrypting it, but the encrypted ID is all that is needed to verify
<Asher>
i'm clearly missing a step in the logic here to prevent that
<Boohbah>
Asher: this is rails-specific, but it might help :)
<fowl__>
Asher, you make them log in anyways and give them a second session cookie then you just invalidate it when the ip changes or when you feel like being a dick
bglusman has joined #ruby-lang
<Asher>
fowl__ - not sure that solves the problem i'm outlining tho
boxmo has joined #ruby-lang
nofxx has joined #ruby-lang
<Asher>
so it looks like the only answer is use https
<Asher>
is that right?
<manveru>
Asher: yes
<fowl__>
you can tell the difference between two machines with the same cookie cant you
<Asher>
fowl__ - not reliably
<Asher>
machine2 could spoof machine1's identity pretty easily
<manveru>
well, usually you check for some stuff like ip, but that's really not very useful
<Asher>
yea that can be spoofed as easily as the rest
<Asher>
so is it considered acceptable practice to always use https?
<manveru>
https is the only way to prevent firesheep exploits :)
travisjeffery has joined #ruby-lang
<slyphon>
yeah
<manveru>
if you only use cookies to store stuff like their favorite font... then you don't need https :)
<slyphon>
you only set the cookie over HTTPS, use secure=true
<slyphon>
make sure it's encrypted
<slyphon>
include an HMAC
<slyphon>
or use google and find some rails plugin that does all that shit for you :)
<manveru>
Rack::Session you mean :)
<slyphon>
(which is what I usually do)
<slyphon>
ah yes, that
<Asher>
manveru - i'm only using the session to store the ID of the session
<slyphon>
or, skip google and find manveru
<manveru>
Asher: likewise
<slyphon>
why are you not using cookie store?
<slyphon>
too much data in the session?
<manveru>
slyphon: makes requests big
<slyphon>
ehhh
<Asher>
i have my own session class i've written that stores a stack of session IDs only
<slyphon>
ok, but then you have more load on the backend
<Asher>
i'm just thinking about how to best integrate it with my framework to prevent hijacking
robglees_ has joined #ruby-lang
robglees_ has joined #ruby-lang
travisjeffery has joined #ruby-lang
<manveru>
slyphon: well, i prefer that way so i never have to think about it
<zenspider>
0!
<zenspider>
rawr damnit
<slyphon>
Asher: only use HTTPS to set the cookie, use RC4 with some ENORMOUS salt to encrypt the cookie, add an HMAC to make sure nobody tampered w/ said cookie
<manveru>
oO
<Asher>
manveru - so you're saying in the case of storing a session ID then use https all the time?
<slyphon>
manveru: no?
<Asher>
i don't think you can do only cookies over https
<zenspider>
or... go do some research instead of relying on IRC "experts"
<Asher>
can you?
<manveru>
not that i know of
nofxx has joined #ruby-lang
<Asher>
zenspider - i've done research i was looking for other input before doing more...
<slyphon>
zenspider: hey, buddy, i had to spend 20 minutes studying to get certified in "security" for Hewlett Packard!
<zenspider>
exactly
<slyphon>
zenspider: you betta recognize
<manveru>
hehe
<slyphon>
ok, it was probably more like 45 minutes
tekin has joined #ruby-lang
<slyphon>
or, you just make your security policy so onerous that nobody wants to use your site
<manveru>
well, HMAC is fun, but what do you do when someone tries to make their own cookie? ban them?
<slyphon>
um
<slyphon>
that's the point of an HMAC, no?
<slyphon>
"This is not what they say it is"
<manveru>
yeah
<manveru>
i only worry about stolen cookies
<zenspider>
thank god... this is sooo much cleaner.
woollyams has joined #ruby-lang
<zenspider>
so now, instead of s(:call, recv, meth, s(:arglist, ...) it's just s(:call, recv, meth, ...)
<slyphon>
zenspider: context?
<zenspider>
and s(:class, name, super, s(:scope, s(:block, ...))) is s(:class, name, super, ...)
<zenspider>
soooooo happy
nofxx has joined #ruby-lang
<slyphon>
zenspider: ParseTree ?
Weems has joined #ruby-lang
Weems has joined #ruby-lang
<zenspider>
ruby_parser, but yeah
<slyphon>
nice
<zenspider>
PT will diverge in compatibility at this point.
<zenspider>
RP 3+ will be cleaner and 1.9 compatible
<TTilus>
that sure looks cleaner
<zenspider>
I _think_ all my tools should still Just Work(tm) with the new parser format
<zenspider>
since they largely ignored scope/block
<zenspider>
I'll have to poke at arglist
<TTilus>
:)
virunga has joined #ruby-lang
krohrbaugh1 has joined #ruby-lang
<TTilus>
zenspider: i can comprehend the :arglist but why :scope and :block were there in the first place?
<zenspider>
TTilus: implementation details really
<zenspider>
inherited from PT, which reflected what was internal to ruby
<TTilus>
ok
<zenspider>
scope means a variable scope wall... block just grouped expressions
outoftime_ has joined #ruby-lang
<zenspider>
in ruby, a NODE has only 3 slots, so they couldn't cleanly do a splatted array... just linked lists
<TTilus>
ah, that explains more
<slyphon>
i would like to buy the guy that wrote the ctrl-p vim plugin a beer
<TTilus>
and scope is self explanatory, but the block was more shady
<zenspider>
slyphon: what does it do?
<slyphon>
it's like icicles for emacs, but minus the large quantities of acid
<zenspider>
hah
<zenspider>
I won't touch icicles (or anything that guy writes) with someone else's 10 foot pole
<slyphon>
fuzzy completion that works pretty well, plus like 3-4 other smart features
<slyphon>
oh yeah?
nofxx has joined #ruby-lang
<slyphon>
it's pretty fucking insane
<erikh>
supertab is nice for vim
<slyphon>
he's the kind of guy that has theories about completion
<erikh>
hehe
<erikh>
"theory of patches"
<erikh>
I still find that hilarious.
<slyphon>
oh man
<slyphon>
yes
<slyphon>
fuckin' darcs
<TTilus>
u mean the darcs thing
<slyphon>
the perfect introduction to Haskell
<slyphon>
"Really interesting in theory"
mattyoho has joined #ruby-lang
<slyphon>
"In practice has at least one O(n**n) bug"
* TTilus
used darcs long time
<zenspider>
slyphon: hah. exactly
<TTilus>
it was my first touch to dvcs
<slyphon>
yeah, it was an improvement over arc
<slyphon>
but, if two people changed whitespace, you spent all weekend merging then failing
<TTilus>
havent used since i learned about git
<slyphon>
yeah
<slyphon>
people who use hg confuse me
<TTilus>
how come?
<slyphon>
i mean, there's git...
nofxx has joined #ruby-lang
<slyphon>
why would you want git but implemented in python
<slyphon>
it just seems unnecessary
<zenspider>
I've not used hg... but everything I've heard says it is like git except it isn't retardedly insane
<zenspider>
real ux to the tools
<lianj>
if there was reliable git-hg i wouldnt care
<zenspider>
is that not the case?
<slyphon>
i have not had a problem with git being insane
<TTilus>
would you get wet over git in ruby?
<TTilus>
i would :)
<slyphon>
i mean, i'm trying to use it to manage source code, so maybe it's that
<TTilus>
at east a little bit
<zenspider>
what do you care what it is written in?
<erikh>
TTilus: grit
<zenspider>
slyphon: I find git to be highly unusable
<erikh>
gem install grit.
<slyphon>
i dunno why
<slyphon>
i mean, you used perforce, ffs
<slyphon>
which i wouldn't use if you paid me
<erikh>
ha
<zenspider>
use
<slyphon>
which is a true statement, because i work at a place that uses perforce, and refused
<canton7>
zenspider, if you need a hand with git, hop over into #git. We're a friendly bunch
<slyphon>
because it's totally fucking insane
<slyphon>
no
<slyphon>
no, i take that back
<zenspider>
canton7: the fuck you are
<slyphon>
it's ancient and crufty and *locks the fucking working copy*
<zenspider>
that channel is the largest community antipattern outside of python I've ever seen
<slyphon>
HA!
<TTilus>
erikh: ha!
<slyphon>
yes
<slyphon>
it's a shame what happened to #python
<slyphon>
back in like, 2005 it wasn't so bad
<erikh>
you guys haven't been to ##c, I see.
<canton7>
zenspider, heh, have it your way. Feel free to PM me in that case :P
<zenspider>
canton7: obviously not a stab at you at all... I don't think we've ever conversed before
<zenspider>
slyphon: honestly, I love that it locks the working copy (which is just an option ya know)... it forces people to TALK... *gasp*
<zenspider>
sorry... encourages
<slyphon>
ha
<zenspider>
there will always be some asshole who won't talk
<slyphon>
yeah, that's the pattern they picked at this place
<slyphon>
the "Absolute Asshole" pattern
<slyphon>
you have to go beg Gozar the Key Master to unlock your shit so you can checkin
<zenspider>
that's not the tool's fault
<slyphon>
anyway, fuck perforce
<slyphon>
;)
<slyphon>
i mean, it's like SVN, but you *pay for it*
_dabradley has joined #ruby-lang
<slyphon>
sign me up!
<zenspider>
slyphon: it's free for open source dev... I've been using it this way for 10 years
<zenspider>
and it is a shit ton better than svn. sorry. as much as they've improved they'll NEVER catch up to perforce
<zenspider>
git merges still look primitive in comparison
<zenspider>
irony... flog can't flog flog
<slyphon>
zenspider: there's a certain *additional* "fuck you" aspect to saying 'patches accepted' when you're rockin perforce
<slyphon>
i'll grant you that
<slyphon>
"Go ahead, try to set your view"
<TTilus>
does perforce do good job merging?
<slyphon>
job merging?
<zenspider>
funny... I work in perforce all day every day and I get patches all the time
<slyphon>
zenspider: yes, and we all secretly hate you for it
<zenspider>
TTilus: it's excellent
<zenspider>
:P
<slyphon>
zenspider: *hugs*
<TTilus>
zenspider: how does it do merge tracking, i mean, does it have the same insanity than svn?
<zenspider>
first off... they take an explicit stance on: hey... let's not corrupt a file
nofxx has joined #ruby-lang
<TTilus>
zenspider: that you rly dont have the tree history
<zenspider>
TTilus: yes, but it's all internal to the server
<zenspider>
you just say merge X to Y and it figures it out
<slyphon>
unless it doesn't
<TTilus>
=D
<slyphon>
i'm kidding
* slyphon
stops trolling zenspider
<slyphon>
perforce is used by large game companies, as it handles binary files excellently
<slyphon>
which git doesn't
mmlac has joined #ruby-lang
<slyphon>
google uses it
<mmlac>
why does fork return a PID that is 1 lower than the system pid?
<zenspider>
conflicts and possible conflicts don't touch your files. you then resolve each one ... it doesn't fuck up your files with >>> corruption
<slyphon>
i mean
<zenspider>
mmlac: does it? I've never noticed that
<slyphon>
system pid?
<mmlac>
kill -9 $id
<mmlac>
it is one higher than the ruby int fork returns
andrewhl has joined #ruby-lang
<TTilus>
mmlac: it is?!
* slyphon
boggles
<slyphon>
what?
<zenspider>
I've never seen that
<slyphon>
what's $id?
<mmlac>
id = fork do ....
travisjeffery has joined #ruby-lang
<linless>
maybe your OS has an off-by-1 bug lurking...
<slyphon>
ok, but what's "system pid"?
* linless
giggles
<mmlac>
pgrep
<mmlac>
the external kill still triggers the ruby code though...
<mmlac>
How do I implement this: I fork some stuff and the parent process should run and listen for SIGINT. Then it shuts down the fork processes and quits itself
nofxx has joined #ruby-lang
<zenspider>
pretty much exactly how you described it
samuelk|away has joined #ruby-lang
SiliconDon has joined #ruby-lang
nofxx has joined #ruby-lang
samuelkadolph has joined #ruby-lang
nofxx has joined #ruby-lang
brushbox has joined #ruby-lang
denysonique has joined #ruby-lang
<mmlac>
zenspider: can I puts when catching the SIGINT?
ttilley has joined #ruby-lang
<zenspider>
I dunno... did you try?
ttilley has joined #ruby-lang
<mmlac>
because it is apparently doing the routing and kills the threads but just throws that: