fflush changed the topic of #ruby to: Ruby 1.9.3-p194: http://ruby-lang.org || Paste > 3 lines of text on pastebin.com
Criztian_ has quit [Remote host closed the connection]
Criztian has joined #ruby
<elico>
ruby is the first language a actually wrote code longer then 1000 lines
<elico>
with a lot of one liners..
matty5000 has quit [Ping timeout: 260 seconds]
fridim_ has quit [Ping timeout: 246 seconds]
apok_ has joined #ruby
maletor has joined #ruby
<elico>
shevy: so what about the trees?
pabloh has joined #ruby
<shevy>
every day some water then your trees will prosper
lukekhamilton has joined #ruby
<elico>
i have two small plant in pots here near the room.. very nice.. quiet
<shevy>
I think my largest project in ruby has about 12k lines of code
<shevy>
and I am trying to reduce that number
<elico>
what to?
<elico>
12 K lines? what did you wrote?
banisterfiend has quit [Remote host closed the connection]
<adeponte>
Axsuul: hey, just letting you know. After putting that gem to heavy use toady I have found some issues and have been rewritting it to resolve all of those issue
<lukekhamilton>
question, is it possible to add two ranges? something like this: x = (1..10) + ("a"..z")?
<shevy>
it's some kind of build system where you can compile or install software elico
apok has quit [Ping timeout: 260 seconds]
apok_ is now known as apok
banisterfiend has joined #ruby
Criztian has quit [Ping timeout: 264 seconds]
<shevy>
"ry perl" will compile perl from source for instance
<lukekhamilton>
I am trying to create an array of valid characters.
matty5000 has joined #ruby
arubin has joined #ruby
<shevy>
lukekhamilton so what should your end result be
tomsthumb_ has quit [Quit: Leaving.]
<elico>
shevy: and i must ask how are you with orginizing data?(i'm bad at it)
havenn has joined #ruby
<shevy>
elico, I only use yaml files so far. at a later time, I'll generate a sqlite3 database from the dataset I have (I have 2400 separate yaml files right now, one file for every program)
jorge has quit [Remote host closed the connection]
apok has joined #ruby
<lukekhamilton>
shevy: ok cool
<lukekhamilton>
I wasn't too sure if that was they easy/Ruby way or not
mahmoudimus has quit [Quit: Computer has gone to sleep.]
jorge has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
mrdodo has joined #ruby
<shevy>
well we just make them arrays, then concat them
<shevy>
the range objects
<shevy>
Range does not seem to like + method
butblack has joined #ruby
<shevy>
(1..200) + (300..500) NoMethodError: undefined method `+' for 1..200:Range
<shevy>
dunno why
<shevy>
perhaps because it could be ambigous
jorge_ has joined #ruby
lolzie has joined #ruby
<shevy>
hmm
<shevy>
or perhaps it would change the Range object into something else
jorge has quit [Read error: Connection reset by peer]
<lukekhamilton>
yeah ok. Thanks heaps
pelangi has joined #ruby
<butblack>
I was reading about OO programming and read this line "Most OO languages require a class to be defined before we can have a new kind of object, but ruby does not" … I don't understand how ruby does not?
<shevy>
I guess they dont like changing objects via methods
moted has quit [Remote host closed the connection]
<shevy>
except for replace() method in class String
<butblack>
anytime I instantiate a class I have already defined that class no?
<butblack>
instantiate an object*
mrdodo has quit [Remote host closed the connection]
<shevy>
butblack, you could create structs or anonymous classes too
<lolzie>
Hi guys. I have this:- print (1..1000).select { |x| x % 3 == 0 or x % 5 == 0 }.inject { |x, y| x + y }
cantonic has quit [Quit: cantonic]
<shevy>
or autogenerate them somehow via metaprogramming
<lolzie>
How can I remove the duplication of x % 3 == 0 or x % 5 == 0 ?
codeFiend has joined #ruby
<lolzie>
I'd like to do something like [3, 5].something { |y| }
<shevy>
butblack, for 99% of what I see though, people first write a class, then instantiate that
matty5000 has quit [Ping timeout: 246 seconds]
<butblack>
shevy: i don't understand the importance of writing out that line..
<lolzie>
The intention being to sum all numbers divisible by 3 or 5 between 1 and 1000
<shevy>
the line you typed here?
<butblack>
shevy: I can live with that, and yeah
insecurlex has quit [Remote host closed the connection]
<shevy>
no idea either, ask the authors. perhaps they want to sound important :)
t71526 has quit [Remote host closed the connection]
<shevy>
ruby is quite close to the prototypic OOP model
t54616 has joined #ruby
<shevy>
once I thought I could use only structs to write a MUD in ruby
<butblack>
shevy: it was written by matz
<lolzie>
shevy: how does it differ from the prototyping OO model?
ephemerian has left #ruby [#ruby]
<shevy>
butblack, aha. well I hope he explained it then
<lolzie>
prototypic*
cantonic has joined #ruby
Speed has quit [Remote host closed the connection]
<shevy>
lolzie, well you can instantiate from a prototype, and then remodel that prototype, then re-instantiate from that clone, or?
maletor has joined #ruby
<butblack>
shevy: haha, I'll post the paragraph it came from.. I apologize in advance for the excessive amount of text
<butblack>
We commonly take one step of abstraction above this, because it turns out to be as easy to build a factory that makes machines as it is to make an individual machine. We aren't likely to build a single tripmeter directly; rather, we arrange for any number of tripmeters to be built from a single pattern. The pattern (or if you like, the tripmeter factory) corresponds to what we call a class, and an individual tripmet
<butblack>
generated from the pattern (or made by the factory) corresponds to an object. Most OO languages require a class to be defined before we can have a new kind of object, but ruby does not.
<shevy>
he gives sound reasons for his answers there
<butblack>
shevy: cool, thanks
<shevy>
so I was surprised to read something like that you said he wrote
<butblack>
shevy: it didn't make much sense to me either
bradhe has quit [Remote host closed the connection]
<shevy>
because I am not entirely sure what he would mean with "Most OO languages require a class to be defined before we can have a new kind of object, but ruby does not."
<shevy>
because really... 99% of the ruby examples, do make use of a newly written class, before its instantiated
<butblack>
because that's all oo is lol, create a class instantiate an object
<butblack>
exactly
<shevy>
kinda. with structs you are more flexible in some ways
<shevy>
I am going to study that, perhaps I have an insight
havenn has quit [Remote host closed the connection]
orf__ has joined #ruby
iori has joined #ruby
adamkittelson has quit [Remote host closed the connection]
orf_ has quit [Ping timeout: 276 seconds]
_keith has quit [Quit: _keith]
GoGoGarrett has joined #ruby
liluo has quit [Remote host closed the connection]
sterex has quit [Quit: sterex]
maletor has quit [Quit: Computer has gone to sleep.]
mwmnj has joined #ruby
pelangi has quit []
mrdodo has quit [Remote host closed the connection]
<mwmnj>
any heroku vets around?
dpk has quit [Ping timeout: 240 seconds]
t54616 has quit [Remote host closed the connection]
t67590 has joined #ruby
erichmenge has quit [Quit: Be back later]
chimkan_ has joined #ruby
<jrajav>
I wish I was a heroku vet :/
<jrajav>
I'm thinking of getting an app onto it sometime soon
<jrajav>
And I also want to know how it works for blogging
<jrajav>
And static serving
<jrajav>
And serving static blogs :P
<shevy>
you sound very enthusiastic
<jrajav>
Haha
gtuckerkellogg has joined #ruby
dpk has joined #ruby
Tomasso has quit [Ping timeout: 256 seconds]
<jrajav>
My main problem with blogging is that I'm never satisfied with anything I write
<jrajav>
So I never end up writing anything
<banisterfiend>
good
<jrajav>
And that app is in the works; I spent 4 hours on it today alone
<banisterfiend>
:P
<banisterfiend>
there's a lot of crap blog posts in the ruby community :)
<banisterfiend>
i blog maybe once-twice a year for a similar reason
<shevy>
hehe
<shevy>
4 hours!
<jrajav>
That's aside from my fulltime job :P
ilyam has joined #ruby
macmartine has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
jrajav: what does your app do?
<jrajav>
Note taking
<jrajav>
+ Cloud syncing
<jrajav>
For Android
<jrajav>
Modeled very closely on Notational Velocity for the mac
banghouse has quit [Remote host closed the connection]
<banisterfiend>
like vernote
SeanLazer has quit [Quit: SeanLazer]
<banisterfiend>
?
<jrajav>
Yeah but just text only
<banisterfiend>
evernote
<jrajav>
Maybe Markdown support at some point
<jrajav>
I also want to explore dropbox and maybe git syncing options
<jrajav>
But just SImplenote to start with
locriani has quit [Remote host closed the connection]
codeFiend has quit [Ping timeout: 246 seconds]
<banisterfiend>
you have a lot of competition there
<banisterfiend>
there's a tonne of apps for that :P
<banisterfiend>
(if i understand u correctly)
<jrajav>
Well, I'm not trying to monetize it at all
<jrajav>
It's mainly for myself to be honest
kvirani has joined #ruby
<banisterfiend>
even free apps i mean
<jrajav>
I'm not satisfied with any of the options for Simplenote note taking on Android right now
<jrajav>
So I honestly don't care if that many people use it
<banisterfiend>
np
jgrevich has joined #ruby
jgrevich has quit [Client Quit]
haxrbyte has quit [Remote host closed the connection]
<jrajav>
I am thinking of an HTML5 app that does the same thing with a Heroku proxy though
<jrajav>
And I *would* try to monetize that
andrewpthorp has quit [Quit: Leaving...]
<jrajav>
Mainly for the reason that I couldn't scale it otherwise, if tons of people started using it
kenichi has quit [Remote host closed the connection]
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
savage- has quit [Read error: Operation timed out]
<banisterfiend>
would it be a webview thingy or just run in a website?
<banisterfiend>
in the brwoser i mean
<jrajav>
A website, but with localStorage
<jrajav>
So a true HTML5 "app" in the sense that it can work offline
<jrajav>
And sync once you go back online
erichmenge has joined #ruby
<jrajav>
I might try a prototype with a webview though, because that wouldn't require a proxy. The proxy is needed for a served website due to cross-domain
_keith has joined #ruby
<banisterfiend>
i would do webview
<banisterfiend>
browser apps on android (in my experience) feel kind of crappy
<banisterfiend>
and the browsers are all pretty buggy
sevenseacat has joined #ruby
<banisterfiend>
with weird UI
reactormonk has quit [Ping timeout: 246 seconds]
<jrajav>
Oh, I meant this mainly for desktop actually
<banisterfiend>
oh ok
<banisterfiend>
so android is just for reading them?
<jrajav>
HTML5 and phonegap are still pretty bad on both android and iphone
<jrajav>
No?
chimkan_ has quit [Quit: chimkan_]
randomautomator has quit [Remote host closed the connection]
<banisterfiend>
you mentioned android
<jrajav>
The app I'm writing right *now* is just a native Android app in Java
<banisterfiend>
:))
jgrevich has joined #ruby
cbley has joined #ruby
<banisterfiend>
confused..
lolzie has quit [Quit: Page closed]
<banisterfiend>
so the notetaking app on android is a native java app
<jrajav>
Yes
<jrajav>
Separate things
dpk has quit [Quit: Asleep at the keyboard.]
<elico>
ok.. i want to write a DB of domains in a tree form but wamt to work with storage files that will hold the data/
uris has joined #ruby
<banisterfiend>
jrajav: but the same project? just two ways of leaving notes?
<banisterfiend>
or two different projects?
<jrajav>
Two projects to provide the same solution
graft has quit [Ping timeout: 245 seconds]
<jrajav>
The Android one is a lot more relevant to me and I would use it every day
<jrajav>
So yeah
_keith has quit [Quit: _keith]
<banisterfiend>
cool
aantix_ has joined #ruby
<banisterfiend>
jrajav: my own way of doing that is just saving text files that i create to dropbox :P
<jrajav>
This would basically do that :P
michael52025 has joined #ruby
Takehiro has joined #ruby
chimkan_ has joined #ruby
michael52025 has left #ruby [#ruby]
<banisterfiend>
jrajav: what do u think of the android api? is it as horrible as people say?
<banisterfiend>
esp. cmpare to ios which people seem to like
aantix_ has quit [Client Quit]
aantix has quit [Ping timeout: 240 seconds]
tomsthumb_ has joined #ruby
havenn has joined #ruby
adeponte has quit [Remote host closed the connection]
codeFiend has joined #ruby
liluo has joined #ruby
locriani has quit [Remote host closed the connection]
grenierm has quit [Quit: grenierm]
alvaro_o_ has joined #ruby
reactormonk has joined #ruby
CoverSlide has quit [Ping timeout: 240 seconds]
<jrajav>
? I haven't experienced that
xyxxy has quit [Quit: Page closed]
yasushi has joined #ruby
jgrevich has quit [Quit: jgrevich]
yasushi has quit [Remote host closed the connection]
alvaro_o has quit [Ping timeout: 240 seconds]
mwmnj has quit [Quit: Page closed]
havenn has quit [Remote host closed the connection]
<jrajav>
That's pretty vague, anyway
<banisterfiend>
jrajav: hmm, i guess it's only people who first programmed ios apps and then did some android who feel so strongly :)
t67590 has quit [Remote host closed the connection]
khakimov has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
cocoa is a really nice framework
t13852 has joined #ruby
tommyvYo has quit [Quit: Computer has gone to sleep.]
t13852 has quit [Remote host closed the connection]
t80757 has joined #ruby
Takehiro has quit [Remote host closed the connection]
jorge_ has quit [Remote host closed the connection]
freeayu has quit [Read error: Connection reset by peer]
linoj has joined #ruby
freeayu has joined #ruby
zeknox has joined #ruby
headius has quit [Quit: headius]
machty has joined #ruby
Takehiro has joined #ruby
freeayu__ has joined #ruby
jrajav has quit [Quit: The best darkness is strange and surprising]
freeayu has quit [Ping timeout: 240 seconds]
ndngvr has quit [Ping timeout: 240 seconds]
<zeknox>
hey whats my best way to get the value out of a block variable, outside of the block code? I essentially am trying to say, if the string READ/WRITE is found, then display "you have admin" ---> http://pastie.org/4571919
rump has joined #ruby
rump has left #ruby [#ruby]
radic has quit [Read error: Connection reset by peer]
Banistergalaxy has joined #ruby
jorge has joined #ruby
radic has joined #ruby
codeFiend has quit [Quit: codeFiend]
arvidkahl has joined #ruby
jearvondharrie has joined #ruby
cableray has quit [Quit: See you 'round like a donut.]
banisterfiend has quit [Ping timeout: 240 seconds]
xclite has joined #ruby
sepp2k has joined #ruby
SubliminalKid has quit [Quit: Leaving]
mrdodo has quit [Remote host closed the connection]
jenrzzz has joined #ruby
bradhe has joined #ruby
luckyruby has quit [Remote host closed the connection]
coyo has joined #ruby
coyo has quit [Changing host]
coyo has joined #ruby
verto is now known as verto|off
sdwrage has joined #ruby
headius has joined #ruby
khakimov has joined #ruby
locriani has quit [Remote host closed the connection]
headius has quit [Client Quit]
Z_Mass has joined #ruby
beneggett has quit [Quit: Computer has gone to sleep.]
pabloh has quit [Read error: Connection reset by peer]
havenn has quit [Remote host closed the connection]
maletor has joined #ruby
davejacobs has joined #ruby
seth-- has joined #ruby
adeponte has joined #ruby
codeFiend has joined #ruby
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
Juul has quit [Quit: GOING!]
Takehiro has quit [Remote host closed the connection]
tomsthumb_ has quit [Quit: Leaving.]
shadoi has quit [Quit: Leaving.]
beneggett has joined #ruby
tiripamwe has quit [Quit: Leaving]
n_blownapart has joined #ruby
poop_ has joined #ruby
<elico>
anyone?
<poop_>
Anyone know if there is a chanel specifically for Sinatra here?
locriani has quit [Ping timeout: 245 seconds]
ndngvr has joined #ruby
<poop_>
Derp. #sinatra
Takehiro has joined #ruby
hadees has quit [Quit: hadees]
<elico>
i want to initialize a leaf node but from unknown reason on initialize the object became nil
linoj has quit [Quit: linoj]
<xclite>
elico, code sample?
<elico>
class Domain
<elico>
include Enumerable
<elico>
@domain
<elico>
<elico>
@subdomains = []
<elico>
def initialize(par)
<elico>
puts par.class
<elico>
puts @paren.class
<elico>
setparent(par)
<elico>
setdom(dom)
<elico>
end
banisterfiend has joined #ruby
Z_Mass has quit [Quit: Leaving]
<elico>
there are other methods but this is the idea
<xclite>
elico, generally you want to use pastebin.com for snippets like taht
<elico>
yee a sec
<bnagy>
not generally
<bnagy>
ALWAYS
<xclite>
bnagy, +1
TheLZA has quit [Quit: Bye]
tomsthumb_ has joined #ruby
<xclite>
elico, further we want to see you use the code where it's becoming nil
<elico>
yes yes a sec
<elico>
all coming
havenn has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
<xclite>
elico, there's a lot... generally wrong. First, your indentation is a mess, second, your to_s should return a string, not output it
Takehiro has quit [Remote host closed the connection]
<elico>
missing t at: est2 = Domain.new(test1)
<n_blownapart>
hi could someone give me a clear (quick?) explanation of enumerator in this case ... the books explanation is worthless aside from mentioning precedence. thanks: http://pastie.org/4572016
<bnagy>
@paren.class is always going to be NilCLass cause you don't initialize it anywhere
Banistergalaxy has quit [Ping timeout: 244 seconds]
<elico>
but ... @parent = parent in the "setparent(parent)"
<elico>
also if i use directky the setparent(parent) it works
<elico>
just not in the initialize
<elico>
i have tried to initialize that before with the same result
<bnagy>
elico: a) @paren != @parent and b) when you use it in initialize, you haven't initialized it yet
<bnagy>
and c) if you're going to fricking argue when you're wrong, you can go whistle
pingfloyd has joined #ruby
<elico>
i will give you the code same way...
<elico>
i just changed dont be picky on what's not relevent
<bnagy>
forget it, I only do homework for people who listen
tomsthumb_ has quit [Quit: Leaving.]
<bnagy>
n_blownapart: yeah (array.map) will be an Enumerator
<bnagy>
in your first example you enclose the block in parens as well, in the second you don't, that's why the behaviour is different, not do end vs {}
<elico>
well it seems like works now after cleanup of a line that wasnt suppose to be there
<n_blownapart>
thanks bnagy ...is enumerator always the same thing? does it always mean the same thing as output.?
_br_ has quit [Excess Flood]
ssspiff has joined #ruby
ssspiff has quit [Changing host]
ssspiff has joined #ruby
t80757 has quit [Remote host closed the connection]
<n_blownapart>
bnagy: I'm not too clear on what it is...
t96150 has joined #ruby
<elico>
thanks bnagy the problem was that i forgot to remve a line...
<bnagy>
no an Enumerator is a special kind of object when you have used something that would normally feed a block, but you didn't give it one yet
banisterfiend has quit [Remote host closed the connection]
<bnagy>
or you did, and asked for it to be turned into an enum :)
sspiff has quit [Ping timeout: 276 seconds]
banisterfiend has joined #ruby
_br_ has joined #ruby
<n_blownapart>
bnagy: so it bypasses the block here, given what the interpreted assumes is happening.
<n_blownapart>
bnagy: poorly phrased. ^
Takehiro has joined #ruby
beneggett has quit [Ping timeout: 248 seconds]
<bnagy>
elico: normally we wouldn't define getters and setters like that. there's a construct called attr_accessor :domain, :parent
jorge has quit [Remote host closed the connection]
<elico>
yes indees there are attr_accessor...
<bnagy>
and if we did then they would looke like def parent;@parent;end def parent=(other);@parent=other;end
<elico>
i am lowleveling for couple hours..
ananthakumaran has joined #ruby
<poop_>
Anyone happen to know how Sinatra calculates the hmac for rack.session cookies?
_br_ has quit [Excess Flood]
_br_ has joined #ruby
<n_blownapart>
bnagy: what purpose does the enum serve as output, or as a newly created "special" object?
<bnagy>
cause then the final code will be more expressive - this_domain.parent == that_domain etc
_br_ has quit [Excess Flood]
xyxxy_ has joined #ruby
Takehiro has quit [Remote host closed the connection]
<xyxxy_>
def csrf_tag Rack::Csrf.csrf_tag(env) end <-- what algorithm is used to generate this csrf token?
_br_ has joined #ruby
<bnagy>
n_blownapart: it's an Enumerator, it does Enumerator stuffs. Read the docs ?
banisterfiend has quit [Ping timeout: 260 seconds]
beneggett has joined #ruby
<poop_>
xyxxy_: Are you testing a Sinatra app too? :p
<bnagy>
it's for when you have contonuation style code and want to control iterations by hand
reactormonk has joined #ruby
t-mart has quit [Ping timeout: 246 seconds]
<xyxxy_>
poop_: lol.
xyxxy_ is now known as xyxxy
<n_blownapart>
bnagy: thanks I'll check it out. owe you plenty o' tea.
<xyxxy>
What level are you on?
<poop_>
4
<poop_>
You?
<xyxxy>
I'm on 6.
voodoofish430 has quit [Quit: Leaving.]
<poop_>
poo
binaryplease has quit [Quit: WeeChat 0.3.8]
<poop_>
I can't figure out how this app is calculating the hmac
<bnagy>
hmacs are standard, there are only a few
<bnagy>
hopefully it's hmac-sha1 or better, but I bet it's md5 :>
<bnagy>
can't you just read the src?
<xyxxy>
poop_ notice how that when you send someone some karma your password is reflected on their default page.
<poop_>
FUQ
<poop_>
I just realized
<poop_>
sorry for the language
36DABY0WQ has quit [Quit: Computer has gone to sleep.]
cakehero has quit [Quit: Computer has gone to sleep.]
matty5000 has joined #ruby
GoGoGarrett has quit [Remote host closed the connection]
Banistergalaxy has joined #ruby
ngoldman has joined #ruby
sspiff has joined #ruby
sspiff has quit [Changing host]
sspiff has joined #ruby
mmitchell has quit [Remote host closed the connection]
freeayu has joined #ruby
shadoi has joined #ruby
ssspiff has quit [Ping timeout: 246 seconds]
butblack has quit [Quit: butblack]
cbley has quit []
freeayu__ has quit [Ping timeout: 265 seconds]
<elico>
is there a method to dfine in order to indentify object in array?
Cascador has quit [Quit: Leaving]
xclite has quit [Remote host closed the connection]
jonathanwallace has quit [Remote host closed the connection]
chimkan___ has joined #ruby
chimkan___ has quit [Remote host closed the connection]
chimkan__ has joined #ruby
sailias has joined #ruby
chimkan__ has quit [Read error: Connection reset by peer]
chimkan_ has quit [Read error: Connection reset by peer]
chimkan__ has joined #ruby
elico has left #ruby [#ruby]
<machty>
if i have an array and I want to quickly generate a Hash of some property of the object in that array as the key pointing to the object as the value, what's the best way to do that?
richardcreme has quit [Ping timeout: 244 seconds]
<machty>
right now i do array.each{ |v| hash[v.prop] = v }
<machty>
that's fine, but i do this a lot and wanted to know if there's some idiom i'm overlooking
Cache_Money has joined #ruby
richardcreme has joined #ruby
banisterfiend has joined #ruby
<banisterfiend>
bnagy: hey nag
<bnagy>
mornin
arvidkahl has left #ruby [#ruby]
<bnagy>
machty: group_by would do it I guess
<bnagy>
but it's not much more elegant
Banistergalaxy has quit [Ping timeout: 272 seconds]
<bnagy>
id_hah=coll.group_by {|e| e.id}
<bnagy>
*hsh :P
<bnagy>
coffee still not kicked in yet
<machty>
or group_by(&:id), but still the values would be arrays
<bnagy>
with the bonus that wouldn't overwrite dups, which may or may not be handy
<machty>
which would be cool in some cases but ids are unique so that's kind of a waaste
a_a_g has joined #ruby
r0bby has joined #ruby
chimkan___ has joined #ruby
<bnagy>
if you need to do this a lot it could be an indicator of some datastructure issues though - this is like a cache for when you're about to do lots of id lookups, for example yeah?
hadees has joined #ruby
<machty>
yeah, sort of, i've got to serialize a user object and all the things he's voted for
<Cache_Money>
Spooner: What's the strategy against the Yellow pixel in Level 4 of Alpha Channel
<Cache_Money>
?
<machty>
and be able to quickly look up if a certain thing's been voted for on the client side
<bnagy>
normally I'd ask a db to handle that kind of stuff :)
robbyoconnor has quit [Ping timeout: 260 seconds]
chimkan__ has quit [Ping timeout: 246 seconds]
<machty>
the db gives me a nice big array of vote objects. i just at some point need to turn it into this more locally queriable structure
fyolnish has joined #ruby
fyolnish has quit [Read error: Connection reset by peer]
banisterfiend has quit [Remote host closed the connection]
<bnagy>
one of these new fangled hash dbs are built for this kind of thing, aren't they?
<bnagy>
it's not really my domain though
banisterfiend has joined #ruby
matty5000 has quit [Ping timeout: 246 seconds]
ngoldman has quit [Remote host closed the connection]
freeayu has quit [Read error: Connection reset by peer]
banisterfiend has quit [Read error: Connection reset by peer]
jarred has joined #ruby
freeayu has joined #ruby
banisterfiend has joined #ruby
<Spooner>
Cache_Money : Yellow is just stronger than red I think. The later ones are a bit more tricky... While since I've played it myself :)
dinkytoy has quit []
moshee has quit [Ping timeout: 240 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
chare has joined #ruby
ngoldman has joined #ruby
<Spooner>
Cache_Money : Just keep throwing red ones at it and you'll get it. Can't just kill it against the green ones, which you can do with reds in the first few levels.
davejacobs has quit [Quit: leaving]
sebicas has quit [Quit: sebicas]
<Spooner>
Cache_Money : Glad to see someone is playing it :)
<chare>
why does rails have db migrate, intsead of something like "just sync everything about the database schema to the right value"
<Spooner>
chare : I think because, for one, it is a reversable action.
insecurlex has joined #ruby
rtj has quit [Quit: rtj]
tomsthumb_ has joined #ruby
<chare>
whats the point of reversable?
<Spooner>
chare : And there you have learned about 50% of what I know about Rails, so it is time for me to shut up :)
<n_blownapart>
hi still some questions on enumerator if you have time. so apparently gsub is very flexible and outputs an enumerator in the case where there is no second (replacement) argument. So this special variable stores the results of a regex until it is needed later. noob question, but where is the enumerator stored? what is its scope? sorry no better way to ask the question. thanks : http://pastie.org/4572202
<Spooner>
It is always good to be able to roll-back changes.
ndngvr has quit [Read error: Connection reset by peer]
freeayu__ has joined #ruby
jarred has quit [Quit: jarred]
ndngvr has joined #ruby
freeayu has quit [Ping timeout: 244 seconds]
<bnagy>
n_blownapart: you need to start working this stuff out yourself
<TTilus>
n_blownapart: it is returned
<bnagy>
you know enough now to use irb - you can work out these things
<bnagy>
define a local var, then make the enum, then see if the local var is visible when you do you each_woth_index
<banisterfiend>
n_blownapart: bnagx0r is right, u can figure out a lot of your questions on #ruby yourself :P you have the skills now i think
sepp2k1 has joined #ruby
sepp2k has quit [Read error: Connection reset by peer]
<TTilus>
chare: thats very valid question, it is really a matter of choise to ask for conversions and maintain schema state automatically (the rails way)
macmartine has joined #ruby
Takehiro has joined #ruby
<TTilus>
chare: or to ask for schema def and determine migration automatically
randomau_ has joined #ruby
xyxxy has quit [Quit: Page closed]
w400z has quit []
<TTilus>
chare: the former allows you to combine schema and data conversions
ngoldman has quit [Remote host closed the connection]
burgestrand has quit [Quit: Leaving.]
uris has quit [Quit: leaving]
<TTilus>
chare: the later mandates the separation of them
azm has joined #ruby
azm has joined #ruby
azm has quit [Changing host]
c0rn_ has joined #ruby
<TTilus>
chare: and ive never seen any point in "down" migration, it is always snapshot/dump (rails provides schema dump and seed.rb) which you roll back with, not a down migration
<n_blownapart>
banisterfiend: bnagy I'm not lazy, I just get very little out of web searches. the answers get mired down in context I don't yet understand. I can follow some of it...crestfallen.
<banisterfiend>
you can answer questions by asking ruby itself ;)
<bnagy>
hypothesis, experiment, result!
fearoffish has quit [Quit: Computer has gone to sleep.]
t96150 has quit [Remote host closed the connection]
yasushi has joined #ruby
apeschel has quit []
t31143 has joined #ruby
xnm has joined #ruby
<bnagy>
I actually honestly wonder sometimes if the expectation that all answers are instantly available on google is changing the way we learn
Takehiro has quit [Remote host closed the connection]
<banisterfiend>
bnagy: how long do you wonder about it b4 u start thinking about sth more interesting
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
<bnagy>
a while - it's pretty relevant in my field
<n_blownapart>
banisterfiend: banisterfiend well I prefer people that's part of the reason I'm asking. However horrible they are, I need to pose questions until I can comprehend.
jorge has joined #ruby
<bnagy>
n_blownapart: that's how 3 year olds learn
<banisterfiend>
n_blownapart: the knowledge will be more firmly cemented if you acquire it yourself, the hard way :) srsly, once u get used to using irb/pry to answer questions u probably wont go back, its' really effective way 2 learn
<bnagy>
'why?'
<n_blownapart>
banisterfiend: but the output is just the output, it doesn't explain itself.
<banisterfiend>
n_blownapart: ruby (combined with irb/pry) can answer any question you ask it nearly any level of detail u want
machty_ has joined #ruby
<bnagy>
you just have to ask the right questions
fyolnish_ has joined #ruby
<banisterfiend>
it tells u why, u can view the source code, view the documentation, try things out, see the result, and so on
Takehiro has joined #ruby
machty has quit [Read error: Connection reset by peer]
machty_ is now known as machty
wallerdev has quit [Read error: Connection reset by peer]
wallerdev has joined #ruby
thecreators has joined #ruby
<bnagy>
try mentally rephrasing all your 'how does...' 'where is...' questions as 'does it work like this?' 'is it here?'
<bnagy>
then you can test that
jorge has quit [Ping timeout: 240 seconds]
<bnagy>
good questions can be verified, negated, quantified
r0bby_ has joined #ruby
yoklov has quit [Quit: computer sleeping]
yasushi has quit [Remote host closed the connection]
curious_develope has joined #ruby
don1 has joined #ruby
don1 has quit [Client Quit]
Spooner has quit [Ping timeout: 246 seconds]
sepp2k1 has quit [Ping timeout: 246 seconds]
insecurlex has quit [Remote host closed the connection]
techsurvivor has quit [Ping timeout: 246 seconds]
r0bby has quit [Ping timeout: 246 seconds]
tommyvYo has quit [Quit: Computer has gone to sleep.]
sepp2k has joined #ruby
khakimov has quit [Quit: Computer has gone to sleep.]
yoklov has joined #ruby
<curious_develope>
hi all, iam trying to figure out what exactly private and protected means. it seems that private methods cannot take a receiver (can never be called outside class hierarchy). Protected is you can use a receiver and as long as the receiver is the same type where the protected method lives
jasonLaster has joined #ruby
ozzloy has quit [Ping timeout: 246 seconds]
jasonLas_ has quit [Ping timeout: 246 seconds]
<banisterfiend>
curious_develope: sounds right
<curious_develope>
banisterfiend: anything you would add or change?
mmitchell has joined #ruby
<banisterfiend>
curious_develope: well there's an edge case in the case of foo= methods
<banisterfiend>
where self.foo= is valid, even if foo= is private
locriani has quit [Remote host closed the connection]
mike4_ has quit [Quit: bbl]
<banisterfiend>
but that's about it
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
zamn has joined #ruby
ozzloy has joined #ruby
ozzloy has quit [Changing host]
ozzloy has joined #ruby
yoklov has quit [Client Quit]
<zamn>
hey how would i go about editing images in ruby
maletor has joined #ruby
techsurvivor has joined #ruby
jgrevich has quit [Quit: jgrevich]
<banisterfiend>
zamn: believe in yourself, and u can do it
insecurlex has joined #ruby
<zamn>
is there a library
Takehiro has quit [Remote host closed the connection]
jords has joined #ruby
<curious_develope>
banisterfiend: what causes that edge case?
<jords>
Hey, I'm debugging a weird issue with nokogiri behaving differently on my laptop and on heroku (it's correct on my laptop). I've isolated it to this: Digest::MD5.hexdigest(open("https://s3.amazonaws.com/projectxuploads/a").to_s)
<chare>
oh fuck me how do i connect rails to multipl databases
<jords>
on my laptop, that gives b2ae94516e5a5b28a789dda743bcaa66, on heroku it gives 7a4a63171833cd2300aab3dbe91c0d96
<n_blownapart>
banisterfiend. bnagy this is all really appreciated but just as a nearby example: I switched line 5, the block arguments from { |e,i| puts "#{i}: #{e}"} to { |i,e| puts "#{i}: #{e}"} . The output switched with the value "one" first and the index second. how could I discern why. The sequence of #{} didn't change.
<jords>
what could cause that? the locales seem to match...
jonathanwallace has joined #ruby
<banisterfiend>
curious_develope: if "self.foo= x" could be invoked as simply "foo = x" then it would be impossible to create a foo local
mmitchell has quit [Ping timeout: 276 seconds]
<jords>
oh wait, that's totally dumb
maletor has quit [Client Quit]
<jords>
I'll come back :)
<zamn>
jords: what was wrong? llool
<banisterfiend>
curious_develope: basically, if you *ever* wanna use a foo= method on the current self when u have to use self.foo=
<banisterfiend>
curious_develope: cos without the explicit receiver, it'll always create a local
devdazed has quit [Ping timeout: 260 seconds]
yxhuvud has joined #ruby
randomau_ has quit [Read error: Connection reset by peer]
<jords>
zamn: open("https://s3.amazonaws.com/projectxuploads/a").to_s => "#<File:0x00000004c75868>". It turns out the memory map on the server is'nt identical to the one on my laptop. There is a real problem here but it's not that :)
<zamn>
teehee you silly goose
hemanth has joined #ruby
<curious_develope>
banisterfiend: thanks
<banisterfiend>
curious_develope: k00
grenierm_ has joined #ruby
azm has quit [Read error: Operation timed out]
sterex has quit [Quit: sterex]
jonathanwallace has quit [Ping timeout: 265 seconds]
Cache_Money has quit [Ping timeout: 252 seconds]
<jords>
Ok, let's try this again. Digest::MD5.hexdigest(open("https://s3.amazonaws.com/projectxuploads/a").read) produces the same result on my computer and heroku, but Digest::MD5.hexdigest(Nokogiri::HTML( open("https://s3.amazonaws.com/projectxuploads/a")).to_s) produces different results. Both of them produce the same result every time, so it's repeatable. Both are running nokogiri 1.5.5 on linux_x64.
t31143 has quit [Remote host closed the connection]
t49206 has joined #ruby
<zamn>
same ruby versions?
<jords>
The output produced on my computer is correct, where as the one from heroku has a </body> </html> and <html> inserted in a few places throughout the output
<jords>
both 1.9.3, not sure about the patch version
<jords>
should be the same, I'm running 194 on my computer and heroku runs 194 as well iirc
taichou has joined #ruby
AMcP has joined #ruby
<bnagy>
test with a different site, one that you know is only hosted in one physical location
<jords>
bnagy, but the result from the md5 of the open command matches?
<jords>
unless somebody is generating hash conflicts in order to f*** with my mind
<bnagy>
I got no idea what's providing that open command :)
<jords>
open-uri :)
<bnagy>
anyway, forget the MD5 part until you work out why the html is different
<bnagy>
it'll just hide things from you
yoklov has joined #ruby
<bnagy>
and I still say test with a more controlled site
ananthakumaran has quit [Quit: Leaving.]
<jords>
Well It seems that when I give the nokogiri on heroku and the nokogiri on my computer the same input, I get different results. I could give that a try I guess.
n_blownapart has quit [Remote host closed the connection]
zamn has left #ruby [#ruby]
curious_develope has quit [Quit: Page closed]
civilordergone has joined #ruby
<civilordergone>
hey, i have an array with multiple key + values, i was wondering how to output when doing a for loop, a particular key?
mascool has joined #ruby
vectorshelve has joined #ruby
burgestrand has joined #ruby
<jords>
Ok, I have it on my site now: Digest::MD5.hexdigest(Nokogiri::HTML( open("http://thoms.net.nz/a")).to_s)
<havenn>
civilordergone: { key: 'value', aim: true, pie: 'better than cake' }.each_key { |k| puts k }
c0rn_ has quit [Quit: Computer has gone to sleep.]
<havenn>
civilordergone: Neither Array, nor for loop, but...
<jords>
So the actual problem I have is that Nokogiri::HTML( open("http://thoms.net.nz/a")).css("body > div").count is 9 on heroku, and 22 on my computer
recycle has joined #ruby
<civilordergone>
havenn, is there a way to specify though on an each iteration a particular key?
sgmac has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
shadoi has quit [Quit: Leaving.]
<bnagy>
jords: why do you keep testing not-the-real-problem ? :)
<bnagy>
the real problem is 'what html does Nokogiri::HTML get from the page', no?
<jords>
Well the problem is in the node tree nokogiri is generating
banisterfiend has quit [Remote host closed the connection]
<jords>
but it's difficult to compare those since this is a 700kb html file
<bnagy>
only if it's getting the same raw html
<jords>
as it's input? they have the same md5 hash, so I think it's safe to assume it's the same
thecreators has quit [Quit: thecreators]
<jords>
I'm just using the open command as an easy way to ensure I'm using the same input on different servers
maletor has joined #ruby
<bnagy>
you need to look at nokogiri's idea of raw html, not open-uri's
arkiver has joined #ruby
<bnagy>
or, better, pass html strings you know are identical to nokogiri
<bnagy>
anyway, must hack, sry
banisterfiend` has joined #ruby
anoldhacker has joined #ruby
td123 has quit [Quit: WeeChat 0.3.8]
xnm has quit [Read error: No route to host]
tagrudev has joined #ruby
banisterfiend` has quit [Remote host closed the connection]
coyo has quit [Quit: Heaven is not a place, it's being with people who love you.]
poga has quit [Remote host closed the connection]
<jords>
bnagy, np, thanks for your help
shiki has quit [Remote host closed the connection]
yoklov has quit [Ping timeout: 240 seconds]
macmartine has quit [Quit: Computer has gone to sleep.]
<poop_>
I have a question. I'm printing out some (unknown) data and it usually looks somewhat like this: "\333\302\eJ\322&" (truncated) Do the slashes indicate binary data?
<poop_>
or unprintable characters
grenierm_ has quit [Quit: grenierm_]
ringotwo has joined #ruby
mascool has quit [Ping timeout: 244 seconds]
Stalkr_ has joined #ruby
Banistergalaxy has joined #ruby
AMcP has quit [Remote host closed the connection]
zyphlar has joined #ruby
<zyphlar>
heyo
<bnagy>
poop_: that's octal
<vectorshelve>
hemanth: good morning
devdazed has joined #ruby
<zyphlar>
i'm trying to help someone understand how before_save callbacks are implemented in rails, but we're having trouble with self. and instance variables
nilg has joined #ruby
Bauer1 has quit [Ping timeout: 276 seconds]
<zyphlar>
i.e. if Foo < Parent and Parent has def self.before_save(*args), we try to save @args = args but it doesn't persist anywhere we can find
Bauer1 has joined #ruby
banisterfiend has joined #ruby
civilordergone has quit [Quit: Leaving]
<poop_>
bnagy: I thought octal was for integers only... in any case, how can I convert it to its hex representation?
sailias has quit [Quit: Leaving.]
<zyphlar>
so: how do you call a parent method from within child class Foo, which saves an instance variable in a way we can later access?
<bnagy>
"\333".each_byte.map {|b| "%.2X" % b} for example
<havenn>
>> "\333".unpack 'H*'
<al2o3cr>
(Array) ["db"]
devdazed has quit [Ping timeout: 246 seconds]
<poop_>
Thanks
<poop_>
I still need to get used to ruby's syntax
<anoldhacker>
zyphlar: please take this to #rubyonrails
<zyphlar>
anoldhacker: i would except this is pure ruby
<zyphlar>
the naming of before_save is just coincidental to trying to understand how instance variables inherit
r0bby_ is now known as robbyoconnor
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
t49206 has quit [Remote host closed the connection]
t36340 has joined #ruby
slycog has quit [Ping timeout: 260 seconds]
<anoldhacker>
zyphlar: You are talking about persisting data. Either you are really conflating your problem, or this is much, much more about what Rails is up to than not.
jearvondharrie has quit [Ping timeout: 276 seconds]
<zyphlar>
basically if you change [:foo, :bar] on line 9 to @args, you get a nomethoderror because @args doesn't exist in that scope
ringotwo has quit [Read error: Connection reset by peer]
ringotwo has joined #ruby
<zyphlar>
again, this isn't rails, this is just imitating their callback style for educational purposes
mxweas has joined #ruby
sdwrage has quit [Ping timeout: 252 seconds]
<bnagy>
@args is a class ivar there, try p self.class.instance_variables in #save
tonini has joined #ruby
[|Ayax|] has joined #ruby
<anoldhacker>
BTW, before_save is part of AM, and you're not inheriting from there...
hukl has joined #ruby
hukl has quit [Remote host closed the connection]
<zyphlar>
thanks bnagy
<anoldhacker>
And... Since @args is an ivar on PaulAR, you won't be able to see it from and instance of Foo via self.class.instance_variable, since self.class will yield Foo.
<zyphlar>
anoldhacker: this isn't part of rails, it's just imitating it. before_save is in PaulAR
<zyphlar>
right, so how do we save @args into Foo?
<anoldhacker>
PaulAr.inherited.
<zyphlar>
afaik the problem is in self.before_save being able to save stuff into Foo
[|Ayax|] has left #ruby [#ruby]
<zyphlar>
ok
<anoldhacker>
Ugly, but it works.
<anoldhacker>
Or, you could define a method in Foo to read it out.
<anoldhacker>
Or, if you want to live REALLY dangerously, use a class var on PaulAr.
dimday has joined #ruby
lightspeare has joined #ruby
<anoldhacker>
I'm not a fan of those, though. At all.
lateau1 has joined #ruby
dimday has quit [Client Quit]
<zyphlar>
yeah trying to avoid class vars
lightspeare has quit [Client Quit]
dimday has joined #ruby
<bnagy>
you can pull your class ivars into normal ivars in init
<anoldhacker>
Good for you.
<bnagy>
same for your superclass ivars
slycog has joined #ruby
davorb has joined #ruby
ciopte7 has quit [Quit: ciopte7]
lurch_ has joined #ruby
<bnagy>
but ime all of this metajiggerypokery ends up looking a bit ugly underneath the covers - esp with inheritance
<anoldhacker>
Remember, though, that you can get an almost identical effect by defining attr accessors on your class, then defining parallel attr accessors in your instance to access the class accessors.
n_blownapart has joined #ruby
<anoldhacker>
Those inherit, which solves your problem as well.
<zyphlar>
hmm k
Araxia_ has joined #ruby
Araxia has quit [Read error: Connection reset by peer]
Araxia_ is now known as Araxia
senny has joined #ruby
<zyphlar>
PaulAR.inherited is private?
heftig has quit [Ping timeout: 245 seconds]
<zyphlar>
what i don't get is why before_save must be a static method when it's called from a child
circlicious has joined #ruby
<zyphlar>
though i guess it's outside a method so it kinda makes sense
<circlicious>
how can i replicate JS type of ifs? i mean i want if(0) to return false
<circlicious>
i think i mean falsy values
<bnagy>
you can't, thank bishnu
<bnagy>
test .zero?
<anoldhacker>
zyphlar: You're before save is NOTHING like AM's.
<circlicious>
in ruby only if(false) will not execute the block, all other values will execute the block
<circlicious>
bnagy: for me?
ttilley has joined #ruby
<banisterfiend>
zyphlar: what do u want before_save to do exactly
ttilley has quit [Changing host]
ttilley has joined #ruby
<bnagy>
circlicious: yes. actually nil is falsey as well
<circlicious>
ya nil and false
<banisterfiend>
nm
<circlicious>
well
<circlicious>
i want to execute a block if the variable is not '' nil and false, how do i do that?
<zyphlar>
banisterfiend: just as coded, if it worked. just to figure out callbacks across inheritance
<circlicious>
and 0
n_blownapart has quit [Remote host closed the connection]
<circlicious>
do i make sense bnagy
<anoldhacker>
zyphlar: You mentioned calling before_save from an instance. Yours does nothing for the instance.
<banisterfiend>
zyphlar: couldn't you get before_save to decorate teh save method?
<al2o3cr>
-e:1:in `eval': undefined method `empty?' for main:Object (NoMethodError), from -e:1:in `eval', from -e:1:in `<main>'
<zyphlar>
what's decorate?
<anoldhacker>
AM before_save pushes a method name on the callback stack. The callbacks are in turn wrapped around the AM#base methods. When the base methods get called, the methods in the callback stack are invoked appropriately.
<circlicious>
how did you know i am using rails ? :P
<zyphlar>
anoldhacker: that sounds conceptually like what i'm trying to do here, i guess i don't understand the difference well enough
<circlicious>
buit that wont work for 0
<circlicious>
ugh
<zyphlar>
circlicious: you could override integer with a .falsy? method
<anoldhacker>
zyphlar: You have to be a pretty good programmer to come up with something as messed up as rails.
elhu has joined #ruby
<zyphlar>
anoldhacker: apparently so ;)
<bnagy>
what's wrong with if @foo && not @foo.empty? && @foo.nonzero?
<circlicious>
too lomng :D
<bnagy>
you're testing threee things, why should someone reading your code not know that?
<rohit>
What are ou trying to do?
<hemanth>
vectorshelve, yo! long time
ananthakumaran has joined #ruby
<rohit>
you*
<vectorshelve>
hemanth: yes.. hope you are doing good..
<anoldhacker>
Seriously, if you want AM behavior, use it. If you want something similar but not quite, dig in. Be prepared to feel like you've entered a house of mirrors.
weethawk has joined #ruby
chare has quit [Quit: Leaving]
<hemanth>
vectorshelve, true
<weethawk>
I'm not sure if this is the right channel to ask, but I'm just asking any channels in general. Does anyone know a possible way to find out the creator/owner of a Facebook Fan Page?
Bauer1 has quit [Ping timeout: 244 seconds]
<zyphlar>
anoldhacker: so how would you implement something vaguely similar? i feel like i could do it in a language i'm more versed in like java/c# but ruby classes confuse me
Bauer1 has joined #ruby
<weethawk>
tl;dr: fan page is harassing friends constantly, FB wont take it down, trying to find out who owns it
<zyphlar>
weethawk: this is definitely not facebook support :)
<weethawk>
Well thank you for the obvious :)
<rohit>
weeb1e_, Can't your friend just block the fan page? :)
<banisterfiend>
zyphlar: one sec.
<zyphlar>
banisterfiend: thanks
<weethawk>
FB has been having a gltich where blocking fan-pages won't work. Trust me, we've tried. having a fan-page dedicated to making fun of your friend who was killed gets annoying after a while
t36340 has quit [Remote host closed the connection]
<weethawk>
hence my desperate attempt to find the owner
t59161 has joined #ruby
<zyphlar>
bitch about FB on twitter? ;D
<bnagy>
or somewhere other than here
<weethawk>
you're not really being funny zyphlar
jords has quit [Ping timeout: 268 seconds]
<weethawk>
i'm just asking if anyone had an answeer to my question
<banisterfiend>
im not 100% what he's trying to achieve
<weethawk>
page called "LOL jessicas finally dead. bitch."
rakunHo has joined #ruby
<bnagy>
weethawk: seriously, this is not the forum for complaining about your facebook woes. If you're not here to talk about ruby, please go somewhere else
<weethawk>
bnagy: i'm not complaining, I'm asking for help. Please don't be an asshole for no reason.
<bnagy>
it's ironic that you're displaying bad netiquette because you're upset about someone's bad netiqeutte
<weethawk>
...
<bnagy>
ask for help somewhere appropriate
<weethawk>
there is litereally no appropriate place for a questiont his specfic
<anoldhacker>
Well, your example looks more like "after_save" than "before_save" to me, and I'm not super-up on unbound methods, but yeah, that probably works. I'm still trying to understand the problem being addressed, though.
Eldariof-ru has joined #ruby
* anoldhacker
assumes that weethawk is a troll.
<banisterfiend>
anoldhacker: good point, he can just switch those 2 lines around though
kvirani has quit [Ping timeout: 244 seconds]
<weethawk>
Anoldhacker: I'm just asking the top populated channels because this isn't something i can solve on my own and it's causing serious issues for family and friends
<weethawk>
a simple "yes" or "no" to the basic question would have worked
adamkittelson has quit [Remote host closed the connection]
weethawk has left #ruby ["Leaving"]
<zyphlar>
weethawk: we have no idea, try something facebook related
<zyphlar>
aw
<bnagy>
talk about #firstworldproblems >:(
<rohit>
weethawk, Your best bet is getting in touch with Facebook directly. Sorry but folks are right that this is not the right channel to ask questions about Facebook. :)
<zyphlar>
banisterfiend: thanks, it works on my machine and passes most of the tests i throw at it. the old_save.bind(self).call seems to be the voodoo that does it
<banisterfiend>
zyphlar: yeah, it's called method decorationb
jenrzzz has joined #ruby
<zyphlar>
to pop in to the right scope
<zyphlar>
hmm i tried googling for decoration, i'll have to investigate more
<banisterfiend>
basically i keep redefining the 'save' method, but calling the previous version after
<banisterfiend>
i save state by using closures
sgmac has left #ruby [#ruby]
<banisterfiend>
so you dont need any ivars
<rohit>
It's a pattern, no? Try searching for method decoration pattern
<banisterfiend>
i just close over the parameters
kvirani has joined #ruby
<banisterfiend>
zyphlar: it's kind of like alias method chain, but less retarded
ryanf has joined #ruby
bradhe has quit [Remote host closed the connection]
jasonLaster has quit [Remote host closed the connection]
<anoldhacker>
@banisterfiend: I have to disagree with you on your solution being better than amc.
<davidcelis>
:%s/closure/clojure/
<zyphlar>
clojure uses closures, no?
<davidcelis>
closures use clojure
<zyphlar>
anoldhacker: not looking for better, just roughly equivalent
<banisterfiend>
araujo: why's that? alias_method_chain fills your object with a tonne of methods with ridiculous names
<anoldhacker>
@banisterfiend: with amc, you can see the stack trace cleanly, even if the method names change. Furthermore, you can instert additional stuff after the fact.
venkatk_ has joined #ruby
<banisterfiend>
anoldhacker:
jasonLaster has quit [Ping timeout: 246 seconds]
davorb has quit [Quit: Computer has gone to sleep.]
ilyam has quit [Quit: ilyam]
brianpWins has joined #ruby
<banisterfiend>
anoldhacker: i dont think amc helps with the stacktrace, u see a bunch of similarly named with weird suffixes, also, im not sure how my one shows up in the stacktrace
<banisterfiend>
ill check it now
<anoldhacker>
@banisterfiend: I agree that there is a price to pay for keeping the chain open, but it made my life REALLY easy when I changed the UserStamp gem to wrap save_without_timestamps instead of save.
<banisterfiend>
anoldhacker: what do u mean keeping the chain open? you can use the unbound method approach any time you would use teh amc approach instead, afaik
<banisterfiend>
can you give an example where you can use amc but cant use the unbound method approach?
devdazed has joined #ruby
<anoldhacker>
@banisterfiend: In the stack trace, you get the file name and line number of the calls. Very clean. With your solution, you can come back to the same line over & over, and it can become difficult to determine exactly which iteration you are on.
igotnole_ has joined #ruby
jwmann1 has joined #ruby
igotnolegs has quit [Ping timeout: 244 seconds]
jwmann1 has quit [Max SendQ exceeded]
<anoldhacker>
@banisterfiend: Sure. The UserStamp gem originally wrapped AR#save to add a userstamp in a fashion which was parallel to timestamp.
jwmann1 has joined #ruby
<anoldhacker>
@banisterfiend: When AR added the Dirty module, however, it had the effect of making lots of objects dirty that should not be.
djdb has joined #ruby
<anoldhacker>
With AMC, I changed the call from alias_method_chain :save, :userstamp to alias_method_chain :save_without_timestamp, :userstamp.
<anoldhacker>
Done.
devdazed has quit [Ping timeout: 246 seconds]
<circlicious>
seriosuly is there a better way to do this
<banisterfiend>
anoldhacker: well there's tradeoffs either way, in amc you get a cluttered method table which makes it harder to see what's going on when interacting with objects in the REPL
<banisterfiend>
anoldhacker: further, using unbound methods, u do get the filename/line number, its' just not labelled very nicely it's just called "block" as opposed to a named method
havenn has quit [Remote host closed the connection]
<zyphlar>
circlicious: there are rails methods like .blank? .nil? .nonzero? you can use
<bnagy>
circlicious: if a.has_key? td; unless a['td'].zero? || a['td'].empty?; ...
mahmoudimus has joined #ruby
<bnagy>
nil? and nonzero? are ruby
<banisterfiend>
anoldhacker: and i just interactively played with the backtrace in pry, using 'cat --ex' it was able to show me each of the different places the method was redefined (with unbound methods)
bradhe has joined #ruby
und3f has joined #ruby
<circlicious>
zyphlar: i use nonzero, i think its ruby method, but nonzero on a string would cause error
<zyphlar>
ah
<anoldhacker>
@banisterfiend: Your solution is to create methods that get called but don't show up in instance_methods? I don't see much of a win there...
<banisterfiend>
anoldhacker: i guess it depends on the tools you use, examining the stack trace using pry makes it easy, either way
<zyphlar>
i use .blank? for most of my stuff which is rails
<circlicious>
.blank? wont go werll with 0
<anoldhacker>
@banisterfiend: I've never used pry. Sounds like I might need to learn it.
<circlicious>
bnagy: almost similar, k
<banisterfiend>
anoldhacker: the win is 1. you dont have a cluttered method table so it's easy to play with things in the repl 2. i agree that the method names dont show up in teh stacktrace, but with a decent debugging tool like pry it doesnt matter anyway
lewis1711 has joined #ruby
<lewis1711>
http://pastebin.com/wV7yVwts is there a quick and dirty way to make sure each element of "address_to_binary" has length 8? ie, packed with leading 0s
<bnagy>
lewis1711: printf specifier?
davorb has joined #ruby
<anoldhacker>
lewis1711: Look up String#%
<lewis1711>
anoldhacker: aha, that's the ticket, thanks
ringotwo has quit [Remote host closed the connection]
havenn has joined #ruby
burgestrand has quit [Quit: Leaving.]
havenn has quit [Remote host closed the connection]
elhu has quit [Quit: Computer has gone to sleep.]
havenn has joined #ruby
rohit has quit [Quit: Leaving]
freeayu__ has quit [Read error: Connection reset by peer]
apeiros_ has joined #ruby
limeds has joined #ruby
freeayu has joined #ruby
machty has quit [Ping timeout: 240 seconds]
petrjanda has joined #ruby
elhu has joined #ruby
petrjanda has quit [Client Quit]
freeayu__ has joined #ruby
heftig has joined #ruby
Morkel has joined #ruby
cirwin has joined #ruby
anoldhacker has quit [Quit: KVIrc Insomnia 4.0.0, revision: 3900, sources date: 20100125, built on: 2011-03-15 15:32:03 UTC 3900 http://www.kvirc.net/]
<limeds>
good morning, just cant figure out how to use .run so i can publish data from the udp server to the websocket, hope someone could help / show me how to -> http://pastebin.com/ZUvUz0pz
freeayu has quit [Ping timeout: 246 seconds]
elhu has quit [Client Quit]
savage- has quit [Remote host closed the connection]
<RubyPanther>
when I shut down apache my my apache module (with an embedded Ruby 2.0) keeps spewing: mod_foo: warning: already initialized constant TMP_RUBY_PREFIX
pskosinski has joined #ruby
<lewis1711>
["11", "00"].inject(:&&) #err, I don't get this error
riley526 has quit [Remote host closed the connection]
<lewis1711>
surely && is a method on strings? since it responds to it
freeayu3 has joined #ruby
Urtokk_ has quit [Quit: leaving]
lukekhamilton has quit [Quit: lukekhamilton]
answer_42 has joined #ruby
freeayu3 has quit [Read error: Connection reset by peer]
freeayu3 has joined #ruby
<lewis1711>
meh I'll just do it the long way
<bnagy>
>> [0b00,0b11].inject(&:&)
<al2o3cr>
(Fixnum) 0
<bnagy>
&& is logical
<bnagy>
and, afaik, an operator not a method
freeayu__ has quit [Ping timeout: 264 seconds]
nazty has joined #ruby
naz has quit [Ping timeout: 240 seconds]
lewis1711 has left #ruby [#ruby]
iflista has quit [Ping timeout: 265 seconds]
ryanf_ has joined #ruby
ph^_ has joined #ruby
qwerxy has joined #ruby
zommi has joined #ruby
nilg has quit [Ping timeout: 240 seconds]
mc0e has joined #ruby
naz has joined #ruby
nazty has quit [Ping timeout: 252 seconds]
situ has joined #ruby
t59161 has quit [Remote host closed the connection]
t55681 has joined #ruby
igotnole_ has quit [Quit: Computer has gone to sleep.]
Zespre_ has quit [Ping timeout: 245 seconds]
chimkan___ has quit [Quit: chimkan___]
Zespre has joined #ruby
fantazo has quit [Remote host closed the connection]
aganov has joined #ruby
Urtokk has joined #ruby
petrjanda has joined #ruby
kedare has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
Tomasso has joined #ruby
daniel_hinojosa has quit [Quit: Leaving.]
daniel_hinojosa has joined #ruby
davorb has quit [Quit: Computer has gone to sleep.]
adeponte has quit [Remote host closed the connection]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
lolmaus has joined #ruby
elhu has joined #ruby
t55681 has quit [Remote host closed the connection]
t6012 has joined #ruby
freeayu__ has quit [Ping timeout: 245 seconds]
silentbob_ has joined #ruby
dekroning has quit [Quit: leaving]
jasonLaster has quit [Ping timeout: 276 seconds]
silentbob_ has left #ruby [#ruby]
hoelzro|away is now known as hoelzro
<Mon_Ouie>
>> ["11", "00"].all?
<al2o3cr>
(TrueClass) true
<Mon_Ouie>
^ this will properly short-circuit
<Mon_Ouie>
&& could not be implemented as a method, otherwise "foo && foo.bar" would always need to evaluate foo.bar
arkiver has quit [Remote host closed the connection]
qwerxy has quit [Quit: offski]
pingfloyd has quit [Quit: pingfloyd]
thone has joined #ruby
daniel_hinojosa has quit [Quit: Leaving.]
thone_ has quit [Ping timeout: 252 seconds]
freeayu3 has quit [Read error: Connection reset by peer]
freeayu3 has joined #ruby
daniel_hinojosa has joined #ruby
fastred has joined #ruby
wobr1 has joined #ruby
<banisterfiend>
Mon_Ouie: hello
clocKwize has joined #ruby
chussenot has quit [Quit: chussenot]
maletor has quit [Quit: Computer has gone to sleep.]
devdazed has quit [Ping timeout: 240 seconds]
LouisGB has joined #ruby
Whoop has quit [Ping timeout: 245 seconds]
<Mon_Ouie>
'alut
<banisterfiend>
Mon_Ouie: have you ever had someone go "wtf?" when you said "'alut" cos it's a bit of a stretch for some people to figure out what 'alut means ;)
<banisterfiend>
Mon_Ouie: you were just lucky in my case because i'm a french speaker :P but i wonder what others think..
Whoop has joined #ruby
<hoelzro>
I figured 'alut was Canadian French
<hoelzro>
but I've never been to France, so that shows how much I know =)
<limeds>
looks like missing a 's' pre and an 'e' post it
<Mon_Ouie>
I don't know where I got it from, I guess I was just looking for a distinctive greeting message :p
<Mon_Ouie>
(There's no "e" in French "salut")
insecurlex has quit [Remote host closed the connection]
haxrbyte has joined #ruby
<limeds>
my fault, always had a 'F' in french class
<limeds>
Mon_Ouie: may you can tell me how to get this script working? http://pastebin.com/jpwPJFSX atm its running the websocket, after ctrl+c the udp server but i need to push the data so the websocket....
TPFC-SYSTEM has joined #ruby
Criztian has joined #ruby
Drewch has joined #ruby
Drewch has quit [Excess Flood]
taichou has quit [Remote host closed the connection]
ryanf_ has quit [Ping timeout: 244 seconds]
Xeago has joined #ruby
Drewch has joined #ruby
randomautomator has joined #ruby
ryanf has quit [Quit: broken pipes |||]
mneorr has joined #ruby
d3vic3 has joined #ruby
randomau_ has joined #ruby
mxweas has quit [Quit: Leaving...]
situ has left #ruby [#ruby]
Mchl has joined #ruby
t6012 has quit [Remote host closed the connection]
t47236 has joined #ruby
DDAZZA has joined #ruby
randomautomator has quit [Ping timeout: 268 seconds]
DDAZZA has quit [Client Quit]
Markvilla has joined #ruby
Markvilla has quit [Client Quit]
devdazed has quit [Ping timeout: 240 seconds]
cantonic has joined #ruby
ibash has quit [Quit: ibash]
vlad_starkov has quit [Remote host closed the connection]
cezar has joined #ruby
Beoran__ has quit [Ping timeout: 245 seconds]
wmoxam has quit [Ping timeout: 244 seconds]
ksk_ has quit [Quit: leaving]
Banistergalaxy has quit [Ping timeout: 240 seconds]
ionte has joined #ruby
kedare has quit [Read error: Connection reset by peer]
cezar has quit [Quit: Leaving]
<vectorshelve>
any good reference on setting up jruby and torquebox on rvm
kedare has joined #ruby
kedare is now known as Guest10697
haxrbyte has quit [Remote host closed the connection]
haxrbyte has joined #ruby
mneorr has quit [Quit: Leaving.]
<ionte>
hi. i need a hint. this is what i want to do: i have a string with a number embedded (let's say "#2382#") and i would like to do arithmetics on that number (say add 500 to it for example). how to do this most efficiently?
<ionte>
i'm using a gsub and regex now, but the arithmetics part i don't know how to solve
<limeds>
"`add_observer': observer needs to respond to `update' (NoMethodError)" cant figure out how to fix
<shevy>
vectorshelve, I suppose it is unavailable. perhaps the link is down
<vectorshelve>
shevy: trying to setup jruby + torquebox :)
<vectorshelve>
shevy: :( this is a worry factor from rubygems and other gem hosters
<shevy>
there are some elementary truths
<shevy>
you can't rely on anything to work in the computer world
jjang has quit [Ping timeout: 240 seconds]
devdazed has quit [Ping timeout: 276 seconds]
devdazed has joined #ruby
<vectorshelve>
shevy: any work around to get this completed.. :(
justinmcp has quit [Remote host closed the connection]
_bart has joined #ruby
<limeds>
vectorshelve: tried downloading the gem via wget? dunno if you can install it from a local file ?
<shevy>
dunno. you can try to download the gem locally?
<_bart>
howdy
<shevy>
_bart where is lisa
<_bart>
it's been a while
<limeds>
Homer: Lisa do I have my pants on?!
<shevy>
_bart did you leave ruby for python :(
<shevy>
limeds hahaha
<vectorshelve>
shevy: the link is down :)
<shevy>
limeds shame they somehow killed the simpsons :(
<_bart>
I left Ruby for visiting Sziget Festival
<vectorshelve>
shevy: and the gem giving issue is a dependant gem
<Hanmac>
shevy an method name allows only one ! or one ? and only at the end ... "gem!!!!!" is not a valid method name ... okay it works with define_method but i dont trust this
<shevy>
sziget... sounds hungarian
<_bart>
that's correct
<shevy>
:)
<shevy>
köszenem sepem!
<shevy>
fekede madcka (haha I dont even know how to spell it...)
<_bart>
(I'm not hungarian though, got their by a 20-hour trip with a train)
<limeds>
hmm shevy new simpsons episodes starting next week monday.. here at .DE
<shevy>
was suppose to be "black cat"
<shevy>
limeds I stopped watching years ago, they ruined it IMO... so many changes... the whole theme changed... :(
<Muz>
Dental plan.
<Muz>
Lisa needs braces.
<shevy>
lol
<shevy>
I remember that one
<_bart>
but I'm back with an interesting question. Let's say I have selected a specific <td> element using Nokogiri, now how do I get the corresponding <th> or the first <td> (that most likely has the title/column-name)?
workmad3 has joined #ruby
<shevy>
limeds are the last episodes worth watching at all?
<Muz>
_bart: how deterministic is the table HTML or is this a generic solution?
danheberden has quit [Ping timeout: 252 seconds]
<shevy>
quite a huge gem vectorshelve
khakimov has joined #ruby
<limeds>
shevy: dont know, new ones coming next week so i have to judge on monday :D
ickmund has joined #ruby
devdazed has quit [Ping timeout: 260 seconds]
<_bart>
Muz: this is a generic solution, artificial intel you might say.
<_bart>
:)
dross_ is now known as dross
<Muz>
Using XPath, you can get the parent of the TD item, and then descend back to get the th
<matti>
shevy: !
<shevy>
limeds, and the last ~3 you watched? were they worth any minute spent seeing? :)
<shevy>
matti: !!!
atmosx has joined #ruby
<_bart>
and how about getting the first td when there is no TH?
<matti>
Whoo, Zed has a major rant on HN.
<Muz>
As for which position th you want, some maths on the number of preceeding and following td elements as siblings, and maths with the width attrbutes if any of your selected td
<_bart>
that's easy too, heh thanks
<limeds>
well yes.. always watch while havin dinner
<shevy>
matti what is HN
<Muz>
_bart: XPath has array offsetting for multiple matches, or the first() operator iirc.
<vectorshelve>
shevy: yes they now have torquebox gem to help us get out of the long lengthy conventional way of install it otherwise :)
<Muz>
Pull out the table, descend and either pull out the th if present, or fall back to the first td
danheberden has joined #ruby
<_bart>
Muz: yes, thanks, I think I'll get this.
<limeds>
ok lots o poeple here.. hopefully one can help me now > http://pastebin.com/Sh8FAT48 < when i connect to the websocket it gives me "observer.rb:126:in `add_observer': observer needs to respond to `update' (NoMethodError)"
<shevy>
I could try! but I dont know observer.rb
IPGlider has joined #ruby
<Muz>
_bart: if you're using Nokogiri, you could even pull the <tr> that your TD is in, and find the array offset of the <td> within that, and use the array key to select the correct item from the corresponding <th> or first <td> row.
<limeds>
every help is welcome :)
<Muz>
Taking into account width attributes or whatever they're called in the HTML for a <td> that may span several columns.
<_bart>
Muz: yes, colspan.
<Muz>
That'd be the badger.
chessguy has quit [Remote host closed the connection]
devdazed has joined #ruby
t46269 has quit [Remote host closed the connection]
t27878 has joined #ruby
<_bart>
Do you guys use soft tabs or real tabs and how many?
<vectorshelve>
Cork: You here too... jquery + ruby = Cork ? :)
<atmosx>
anyone the iPad 2 has arrived, I'm gonna go check it and probably take it
sspiff has quit [Remote host closed the connection]
<vectorshelve>
atmosx: for ?
Speed has joined #ruby
Speed has quit [Changing host]
Speed has joined #ruby
Takehiro has joined #ruby
<atmosx>
my mother
<shevy>
lol
<atmosx>
it's the best way for her to use FaceTime and call me when I'm abroad
<atmosx>
plus I think it's the last high-tech piece of hardware I'm gonna buy for the next couple of years
<shevy>
sure sure sure
t27878 has quit [Remote host closed the connection]
<shevy>
;)
<vectorshelve>
atmosx: :D I am looking to sought of get the results from a good site into array and give that out as the output of the gem method
limeds has quit [Read error: Connection reset by peer]
<atmosx>
hahaha
<shevy>
vectorshelve soon you will reach this point:
<shevy>
"omg all those gems suck... I will write my own gem that works"
limes has joined #ruby
seitensei has quit [Quit: Computer has gone to sleep.]
<vectorshelve>
atmosx: why you laughing ?
t45152 has joined #ruby
<atmosx>
that would be a slow method, the book I'm reading dectates that you should pick a good name for that method!
<atmosx>
vectorshelve: about shevy's 'sure sure sure' statement
cantonic has quit [Ping timeout: 246 seconds]
devdazed has quit [Ping timeout: 276 seconds]
<vectorshelve>
shevy: what does that statement mean... itt;'s more like a wierd extrapolation which you aint sure yourself that it will turn true some day :D
seitensei has joined #ruby
<shevy>
vectorshelve he said he wont buy any high tech afterwards for the next couple of years
<shevy>
I am going to ask him again in 2015
<shevy>
:P
locriani has quit [Remote host closed the connection]
<atmosx>
apart from the iPhone 5
<atmosx>
!!!
<atmosx>
I wont!
<vectorshelve>
shevy: I was talking about
<vectorshelve>
[15:05] <shevy> vectorshelve soon you will reach this point: [15:05] <shevy> "omg all those gems suck... I will write my own gem that works"
<shevy>
I swear the most active "users" on rubygems.org must be bots
<vectorshelve>
shevy: swear ;D
<shevy>
vectorshelve I mean you
<shevy>
you are going to write ALL gems on your own eventually
<vectorshelve>
shevy: which is a good thing for learners and ppl who wants to take all responsibility to themselves
devdazed has joined #ruby
<atmosx>
I'm gonna get a shower
freeayu3 has joined #ruby
<atmosx>
I need to study biophysics, fucking Fricks
<shevy>
\o/
<atmosx>
and his idiotic laws
<atmosx>
shevy: all those people inventing all this shit, it's fine with me… Why do I care about diffusion concentration ratios? :-/
limes has quit [Client Quit]
<atmosx>
it's a simple equation, I'll use my computer to memorize it!!!
<atmosx>
anyway
cantonic has joined #ruby
<shevy>
atmosx yeah I am often wondering about that too
<shevy>
we aren't allowed to use computers for calculation
<Hanmac>
atmosx i need to find some crazy bio/genetic/chemist ... i have crazy i ideas ... and an i dont acept an "this is not possible"
<shevy>
but for work, we use computers ALL the time ...
<shevy>
Hanmac what ideas :D
cantonic has quit [Client Quit]
<shevy>
ideas are good
<shevy>
the implementation is the problem
<atmosx>
Hanmac: like, you saw the movie "Spiderman" recently?
<atmosx>
shevy: when it comes to bio-whatever, some ideas are just idiotic imho.
<shevy>
which one!
<shevy>
I see only ideas that are hard to implement
<shevy>
universal blood types for instance
<Hanmac>
no ... better: animal & plant comined ... then you get an animal that feeds on sunlight, and an plant that can produce steak and milk
<atmosx>
that makes sense to begin with
<shevy>
Hanmac lol
bluefish_ has joined #ruby
<shevy>
and you eat only 5% of that thing every day Hanmac? :D
tk__ has joined #ruby
<shevy>
"mhhmmm my pseudo-cow also tastes like salad"
quazimodo has joined #ruby
<Hanmac>
shevy: why not a salad that tastes like cow?
<shevy>
Hanmac, I think moving physically takes a lot of energy
<shevy>
a plant does not have to spend energy moving around
<shevy>
Hanmac yeah
<shevy>
natural cow-salad hehe
<quazimodo>
shevy: pro tip bro
<Hanmac>
or if humans has chloroplast inside the skin? then i have finialy a reason to go outside :P
<shevy>
do you really wanna become a green human Hanmac
<shevy>
Hanmac yeah but aphids are small, and it's also not the first time to have seen it. dinoflagellates also pick up other microorganisms to photosynthesize - http://en.wikipedia.org/wiki/Dinoflagellate "Approximately half of living dinoflagellate species are autotrophs possessing chloroplasts and half are non-photosynthesising heterotrophs"
<shevy>
I have to leave here soon, will be back in ~2 hours
<Muz>
I can't think of any reason why your session ID couldn't contain a non-alphanumeric character.
<_bart>
Muz: PHP's SESSID does not contain non-alphanumeric characters
chussenot has quit [Read error: No route to host]
<_bart>
s.to_s.match(/[a-z0-9]+/i) == nil ? false : true , it also returns true for sdfsdf.ssfs_
<_bart>
:/
<Muz>
If you're the one creating and auditting the session IDs, you could probably tailor something more specific and secure to your usecase.
<Muz>
Jus' saying.
taichou has joined #ruby
<Muz>
/^[a-z0-9]+$/i
<_bart>
thanks
lukekhamilton has joined #ruby
graspee has joined #ruby
<_bart>
I know this seems weird to do but everything I do is an approach to check strings/structures with a certain uncertainty, and I know this is not secure. I also use a method that uses consonants to check for the "probability" that a string is gibberish. :)
<Hanmac>
_bart:
<Hanmac>
>>!!"AE34".match(/\A[[:alnum:]]+\z/)
<al2o3cr>
(TrueClass) true
<Muz>
Also I know it's bikeshedding, but there's also, s.to_s =~ /regex/ ? true : false; s.to_s.match(/regex/).nil? ? false : true;
<Muz>
Or there's the option of not using a ternary at all, as they're just nasty-looking in general. :)
_JamieD_ has joined #ruby
<Hanmac>
!!( s.to_s =~ /regex/) is maybe the best way
<Hanmac>
>> !!("9" =~ /[[:digit:]]/)
<al2o3cr>
(FalseClass) false
* Muz
isn't a fan of !! personally.
<Muz>
But yeah, golf anyone? What color do you want your bikeshed?
fyolnish_ has quit [Remote host closed the connection]
Morkel has quit [Quit: Morkel]
<JonnieCache>
what kind of 9 is that
SeySayux has quit [Ping timeout: 244 seconds]
eighty4_ is now known as eighty4
eighty4 has quit [Changing host]
eighty4 has joined #ruby
<Hanmac>
"Fullwidth forms, capitals"
<Hanmac>
but for some reason the other 9 is not currect encoded ...
<Mon_Ouie>
Also using regular expressions for that kind of stuff hurts eyes
Speed has quit [Quit: When two people dream the same dream, it ceases to be an illusion.]
fastred has joined #ruby
<_bart>
how do I match non-breakable spaces?
ph^ has joined #ruby
<Mon_Ouie>
You type it or you lookup its unicode code point
<banisterfiend>
Mon_Ouie: do you think you'll say k00
<Mon_Ouie>
No
<banisterfiend>
Mon_Ouie: is there anything i can say/do to encourage you to say it
redgetan has joined #ruby
tayy has quit [Remote host closed the connection]
<Mon_Ouie>
And that will work?
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
<banisterfiend>
Mon_Ouie: Yeah
<Mon_Ouie>
Then no
bluenemo has quit [Remote host closed the connection]
<banisterfiend>
Mon_Ouie: don't you think it's a bit unfair, i mean i emulate your "Yeah"
<_bart>
okay changed it to ((\d+(?:[.,]\d+)?)\W?([ptgmk]?b))\b
<vectorshelve>
I am not able to install gem paperclip in jruby rails app. whats the way around ?
<vectorshelve>
Installing paperclip (3.1.4) Gem::InstallError: paperclip requires Ruby version >= 1.9.2. An error occured while installing paperclip (3.1.4), and Bundler cannot continue. Make sure that `gem install paperclip -v '3.1.4'` succeeds before bundling.
jearvondharrie has joined #ruby
Morkel has joined #ruby
Morkel has quit [Read error: Connection reset by peer]
mmitchell has joined #ruby
arkiver has joined #ruby
Morkel has joined #ruby
zommi has joined #ruby
<Hanmac>
vectorshelve dont use jruby nor rails? :P
<virunga>
Hi Mon_Ouie
resure has quit [Remote host closed the connection]
wltsmrz has quit [Quit: Lost terminal]
<virunga>
Mon_Ouie: you're good with OpenGl, aren't you?
<vectorshelve>
Hanmac: I wish if I had the choice... :)
<Hanmac>
jruby is never a choice for me :D
<vectorshelve>
Hanmac: some say its better in terms of performance since JVM
<Hanmac>
i use c++-libs in ruby ... this does not work for jruby
<vectorshelve>
Hanmac: how can I update my ruby env ? the command
<vectorshelve>
Hanmac: gem update --system didnt do that part
Coolhand has joined #ruby
<Hanmac>
install the ruby1.9.1-full package and then "update-alternatives --config ruby" (on debianoid)
liluo has joined #ruby
limes has joined #ruby
<lectrick>
module A; class B; end; end; B #=> How do I get the 'full path' of class B without raising a NameError: uninitialized constant B ?
<vectorshelve>
Hanmac: I use rvm so I have all the other ruby versions as well.. including 1.9.3
<lectrick>
Hanmac: Say I only know the name of B, but I don't know the name of A, and I want a constantized version of B
<vectorshelve>
Hanmac: gave gem update instead of gem update --system since I am on rvm and not system ruby so now it seems working ;)
<Hanmac>
lectrick you cant you need the full path or B as Class object
<lectrick>
Hanmac: I can sort of look up the full path via ObjectSpace.each_object but I wanted something better :)
<lectrick>
Hanmac: ObjectSpace.each_object{|o| puts o if o.class==Class && o.name =~ /::B/}
<Hanmac>
vectorshelve question ... WHY dont you ask at #jruby?
<Hanmac>
lectrick there are maybe better ways ... moment i try to find them
nilg has joined #ruby
<Mon_Ouie>
Virunga: Haven't used it in a while, but I did use it. Why?
berserkr has joined #ruby
<vectorshelve>
Hanmac: asked no response... inactive room
<lectrick>
Hanmac: This is a little cleaner (but still as ugly as a polished turd) ObjectSpace.each_object.detect{|o| o.class==Class && o.name =~ /::B/}
<virunga>
Mon_Ouie: i wanted to ask help to you :D
lukekhamilton has quit [Quit: lukekhamilton]
joephelius has quit [Quit: WeeChat 0.3.8]
<nohonor>
how would i use a class method as associated code?
<nohonor>
ruby -e "print %w(H A L).collect &String#succ"
geekbri has joined #ruby
<Hanmac>
lectrick i dont think so that there are a better way ... imo you should know the full path or store the B class somewhere
t13505 has quit [Remote host closed the connection]
saispo has quit [Ping timeout: 260 seconds]
<nohonor>
doesn't work
<lectrick>
Hanmac: Yeah, I'm doing some fancy dynamic stuff and there might not be a way for me to do that
t50306 has joined #ruby
<Hanmac>
>> print %w(H A L).collect &:succ
<al2o3cr>
["I", "B", "M"](NilClass) nil
<justinmcp>
vectorshelve: WAG - are you running jruby in 1.9 mode; --1.9 or JRUBY_OPTS=--1.9 ?
<nohonor>
Hanmac, thank you!
<Mon_Ouie>
Having to specify the class of the receiver would break the point of OOP
<nohonor>
Hanmac, and how would i qualify the owning class
<Hanmac>
lectrick becaue there could be multible B classes ... as sample CEGUI and Ogre as both an Color class
<Hanmac>
nohonor you dont need to
<nohonor>
yes, but if i wanted to
<Mon_Ouie>
You shouldn't want to
<Hanmac>
>> print %w(H A L).collect &String.instance_method(:succ)
<al2o3cr>
-e:1:in `eval': wrong argument type UnboundMethod (expected Proc) (TypeError), from -e:1:in `eval', from -e:1:in `<main>'
<lectrick>
Hanmac: ah you're right. crap
<nohonor>
what if i want to use Math.something
ndngvr has quit [Ping timeout: 252 seconds]
<Mon_Ouie>
That's something completely different, the block argument isn't the receiver, but just a regular argument
<Mon_Ouie>
And there's nothing wrong with { |o| Math.something(o) }
<Mon_Ouie>
It makes sense to me that after a space it is interpreted as a grouped expression and not an argument list
<vectorshelve>
justinmcp: hey but your command JRUBY_OPTS=--1.9 gem env instead of mine export JRUBY_OPTS=--1.9 seems to work
<banisterfiend>
nohonor: it's a trade-off, but in general i think optional parentheses are a clear win.
<banisterfiend>
nohonor: DSLs would look a lot uglier with mandatory parens, for example.
<nohonor>
uglier but consistent
<justinmcp>
vectorshelve: should be functionally the same, export just adds it to your shell env
Axsuul has quit [Ping timeout: 260 seconds]
<vectorshelve>
justinmcp: yes but yours did the magic :)
<nohonor>
this opens you to all sorts of bogus invocation trees
<banisterfiend>
nohonor: well, they wouldn't look like a DSL
<nohonor>
banisterfiend, well, there could be an interpreter switch
<banisterfiend>
nohonor: similarly, what about the 'loop' method? that would have to be: loop() { puts "hi" }
bluefish_ has quit [Quit: Ex-Chat]
<banisterfiend>
rather than the current, loop { puts "hi" }
<banisterfiend>
and attr_accessor :x would become attr_accessor(:x)
<nohonor>
oh, the horror
<justinmcp>
vectorshelve: I dont know whats up with the bundle install error - looks like you are running a newer java than myself, thats about the only thing that immediately comes to mind
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
<banisterfiend>
nohonor: yes, syntax is important.
<shevy>
but people use all sorts of crazy combinations... debian system ruby combined with rvm and bundler
<banisterfiend>
nohonor: loop() { } completely blows the idea of loop { } acting like a language construct.
<vectorshelve>
justinmcp: could be but whats wierd is that ur alias command to mine worked fine :)
Taichouchou has joined #ruby
<limes>
shevy did you find a fix ?
<limes>
*solution
mneorr has joined #ruby
<justinmcp>
vectorshelve: that is weird
<banisterfiend>
nohonor: the advantage in optional parens + blocks is you can create methods that behave like built in syntax. As a result, ruby can implement many things are methods that in other languages are keywords
<shevy>
limes only for me, I compile from source and avoid bundler rvm etc...
<banisterfiend>
as methods*
<limes>
damn
<vectorshelve>
justinmcp: well I am trying to run my rails app into jruby... now done with bundle install.. need to configure the db now.. any idea ?
<limes>
went from node via rabbitmq + node back node js and finaly im so close to my udp websocket -.-
<nohonor>
banister, sounds obfuscatory to me
<Taichouchou>
test
<nohonor>
but i appreciate your input anyway
<shevy>
Taichouchou test passed
<banisterfiend>
nohonor: in fact, a tonne of things in ruby are in fact methods that you'd think are keywords, for example: loop, raise, attr_accessor, alias_method, and so on.
<Taichouchou>
thanx shevy
<nohonor>
yes, and that makes grokking that much harder
<banisterfiend>
nohonor: even 'public' and 'private' (accessor 'keywords') are methods
TommyBotten has joined #ruby
<nohonor>
^ what i said above
<nohonor>
implicit is evil
<nohonor>
optional is evil
<shevy>
explicit self in python really sucks
<nohonor>
but i guess it's up to the language designer to make the tradeoff
<banisterfiend>
nohonor: not really, it makes it easier IMO. Most thing are methods, and you know how methods behave already. It removes the barrier between applications and core language. Kind of like lisp, but not quite as intense
<justinmcp>
vectorshelve: I had to use activerecord-jdbc-adapter, then bundle exec the rake tasks - don't recall doing much else
<banisterfiend>
nohonor: i think it's an idea ruby got from smalltalk actually, where even 'if' is a method
<justinmcp>
vectorshelve: I moved over to torquebox - which added bits and pieces
sepp2k has quit [Ping timeout: 246 seconds]
<nohonor>
so i guess that's the 'ruby way'
<banisterfiend>
nohonor: yeah, inspired by the 'smalltalk way' and the 'lisp way'
darkfox83 has quit [Remote host closed the connection]
<JonnieCache>
if is a method?
anoldhacker has joined #ruby
<JonnieCache>
thought it was a keyword
<hoelzro>
in some smalltalks, yes
<banisterfiend>
nohonor: and definitely contrasted with the 'java way' and the 'python way'
<hoelzro>
nohonor: StopIteration is raised by Enumerator#next
<nohonor>
breaking out of a block raises and exception?
<hoelzro>
when the end of an Enumerator is reached
<nohonor>
i'm sorry, i don't follow
<Mon_Ouie>
The break keyword doesn't raise an exception but you can raise on to break from a loop
inerdier has joined #ruby
<nohonor>
ahhaa
<Mon_Ouie>
And that's what Enumerator#next does when there are no more items
<nohonor>
ok, and why would i want to do that in loop { }
<Mon_Ouie>
loop { a = e.next; … } — break is automatically propagated here
<nohonor>
break is propagated to a containing loop?
<Mon_Ouie>
hoelzro: while doesn't accept a block, it just expects a condition, a body, and an end keyword (
inerdier has left #ruby [#ruby]
<banisterfiend>
ruby stole this behaviour from python btw
<Mon_Ouie>
(with an optional do after the condition)
<banisterfiend>
StopIteration trick
<Mon_Ouie>
nohonor: No, it propagates from Enumerator#next to the loop
<Hanmac>
hm an while loop has one catchtype more then an loop-loop (while catch "break")
<hoelzro>
Mon_Ouie: right
<nohonor>
omg, while(true) { puts 'hi' } really doesn't work
<Mon_Ouie>
While the regular break keyword has to be lexically scoped
BiHi has quit [Read error: Connection reset by peer]
<Mon_Ouie>
while true; puts "hi"; end
t50306 has quit [Remote host closed the connection]
Taichouchou has quit [Remote host closed the connection]
<Mon_Ouie>
puts "hi" while true
t96460 has joined #ruby
<hoelzro>
while true do puts 'hi' end
<nohonor>
but why?
<Mon_Ouie>
Why not?
<nohonor>
what's wrong with while(true) { puts 'hi' }
<hoelzro>
it's not valid Ruby
<nohonor>
why, because of the braces
<banisterfiend>
nohonor: you will understand what blocks are soon and you'll know why that doenst work, i think
<Mon_Ouie>
And there's no reason for Ruby to use that syntax, it has one already.
<hoelzro>
which, considering that { ... } is a shortcut for do ... end in block syntax, seems kind of silly.
<nohonor>
well, blah
<nohonor>
{ } is the same as do... end, except when it isn't
Monie has quit [Ping timeout: 244 seconds]
<Hanmac>
Mon_Ouie & hoelzro: its interesting to see the difference between "while(true)\n end" and "loop do\n end" with puts RubyVM::InstructionSequence.compile(code).disasm
<Mon_Ouie>
It is the same only for block syntax
erichmenge has quit [Quit: Be back later]
jdripper has joined #ruby
<nohonor>
Mon_Ouie, ok, i get it. thanks
<Mon_Ouie>
Well, loop gets compiled as a method call with a block while a while loop gets compiled as gotos and labels
chrismcg is now known as zz_chrismcg
<Hanmac>
psst dont tell the noobs that they could activate goto inside ruby
BiHi has joined #ruby
* nohonor
pretends he didn't notice
machty has joined #ruby
<nohonor>
although i've actually had a good use for goto in production code
<nohonor>
once
<Mon_Ouie>
It doesn't have anything to do with the joke __goto__ keyword
<hoelzro>
I think one can be responsible and use goto.
<nohonor>
hoelzro, not at the same time
<Mon_Ouie>
gotos are commonly used in the bytecode-languages that structured languages get compiled into
<banisterfiend>
You can implement 'goto' using continuations, if you really want to :)
<nohonor>
banisterfiend, lol
<hoelzro>
hehe
<Mon_Ouie>
banisterfiend: Except you can't jump to a point that hasn't been reached before
<nohonor>
"you can implement if using zygomorphisms"
<banisterfiend>
Mon_Ouie: Yeah
Takehiro has quit [Remote host closed the connection]
jrist has joined #ruby
virunga has joined #ruby
virunga has quit [Remote host closed the connection]
Takehiro has joined #ruby
<hoelzro>
I think that using goto to clean up errors in C is about the only responsible use of it, though
Morkel has quit [Quit: Morkel]
andrewpthorp has joined #ruby
<nohonor>
Mon_Ouie: so Enumerator#next raises an exception when there are no more items
<nohonor>
why doesn't it just return
<Mon_Ouie>
Return what?
<nohonor>
and what does that have to do with loop { } if that's based on an infinite enumeration
<nohonor>
hmm, maybe i'm thinking in c sharp
<hoelzro>
you must unlearn
<hoelzro>
what you have learned
<Mon_Ouie>
loop is implemented like def loop; yield while true; rescue StopIteration; end
cantonic has joined #ruby
<nohonor>
well, instead of calling yield
<hoelzro>
=P
Spooner has joined #ruby
<nohonor>
call return
<Mon_Ouie>
Enumerator#next doesn't yield anything
<Mon_Ouie>
yield passes a value to a block
<nohonor>
i'm afraid the enumeration infrastructure in my ind is a bit fuzzy
<nohonor>
you have an enumeration
<nohonor>
an "iterator"
<nohonor>
and you have a consumer
<nohonor>
enumeration.iterator &consumer
<nohonor>
where does "enumerator" come in or should i just research it myself and stop asking silly questions
andrewpthorp has quit [Ping timeout: 246 seconds]
nanderoo has joined #ruby
jorge_ has joined #ruby
<Hanmac>
thanks of enumerator your "iterator" is chainable: enumeration.iterator.iterator.iterator (&consumer)
<Mon_Ouie>
in that example, nowhere
<nohonor>
Mon_Ouie, in loop { if (frob()) blah; if(quux) break } ?
erichmenge has joined #ruby
andrewpthorp has joined #ruby
<Xeago>
why is there an enumerator for a loop construct?
andrewpthorp has quit [Client Quit]
<Mon_Ouie>
Nowhere either (and that's not valid Ruby either)
<Xeago>
wha twould the collection for the enumerator be, e.g. what is the enumerable?
chussenot has joined #ruby
<Mon_Ouie>
fibo = Enumerator.new { |y| a, b = 0, 1; loop { y << a << b; a, b = b, a + b }
* nohonor
inserts "end" keywords
<Mon_Ouie>
Yeah
<banisterfiend>
Yeah
jearvondharrie has quit [Ping timeout: 240 seconds]
<nohonor>
unmatched braces are unmatched ...
<banisterfiend>
>> fibo = Enumerator.new { |y| a, b = 0, 1; loop { y << a << b; a, b = b, a + b } }; [fibo.next, fibo.next, fibo.next]
<al2o3cr>
(Array) [0, 1, 1]
<Mon_Ouie>
It's way too hard to remember how many of them I opened :p
<banisterfiend>
>> fibo = Enumerator.new { |y| a, b = 0, 1; loop { y << a << b; a, b = b, a + b } }; [fibo.next, fibo.next, fibo.next, fibo.next, fibo.next]
<al2o3cr>
(Array) [0, 1, 1, 1, 1]
<banisterfiend>
ghey
<Mon_Ouie>
fibo.take 10
<banisterfiend>
>> fibo = Enumerator.new { |y| a, b = 0, 1; loop { y << a << b; a, b = b, a + b } }; fibo.take(10)
<al2o3cr>
(Array) [0, 1, 1, 1, 1, 2, 2, 3, 3, 5]
<Mon_Ouie>
Oh, I probably meant yield << a only
<Xeago>
how to print stacktrace in ruby?
<nohonor>
what's the << operator do?
<Mon_Ouie>
It calls the #<< method
<hoelzro>
appends, or writes to stream
<Mon_Ouie>
Xeago: puts caller
* hoelzro
finds it hideous
<Mon_Ouie>
What it does still completely depends on the receiver
<hoelzro>
unless used for actual bit shifting
t96460 has quit [Remote host closed the connection]
<fowl>
hoelzro << :aids
t80427 has joined #ruby
<nohonor>
strange to see c++ in ruby
<fowl>
thats how you give hoelzro aids
<Mon_Ouie>
In this case it adds a value to the Enumerator
<Hanmac>
fowl: hoelro >> :aids
<Hanmac>
and so you can remove the aids later :D
<vectorshelve>
I am trying to convert my ror app to jruby on rails. my backend is postgresql and I installed jruby -J-Xmx1024m -S gem install jdbc-postgres . now when I try to do rake db:setup I get this error http://pastie.org/4574202
<Mon_Ouie>
IIRC Matz was a C++ programmer before writing Ruby
* Hanmac
thinks it is a little bad that ruby is not writen in C++ :(
tommyvYo has joined #ruby
tommyvYo has quit [Changing host]
tommyvYo has joined #ruby
<Mon_Ouie>
Why?
nwest has joined #ruby
<Hanmac>
i dont know ... i thought it would be more fun
jonathanwallace has joined #ruby
<Xeago>
what is ruby written in?
<Hanmac>
plain C
<Mon_Ouie>
C
<hoelzro>
C
<Xeago>
what's wrong with that?
<Xeago>
I still write c daily?
<hoelzro>
nothing
<Xeago>
what's bad with it hanmac?
<Mon_Ouie>
There are other implementations in Java or C++ and Ruby
<anoldhacker>
When debugging a C extension, is there an easy way to get printf output? Or do I need to invoke puts somehow?
<TommyBotten>
Mon_Ouie: That I get, but the struct for ifconf contains a union which in turn contains structs.
<TommyBotten>
Mon_Ouie: Which I haven't gotten my head around ... yet.
thecreators has joined #ruby
<hoelzro>
anoldhacker: printf should do you fine
verto|off is now known as verto
<anoldhacker>
hoelzro: Lovely. I wonder what my problem is.
yasushi has joined #ruby
<Hanmac>
anoldhacker: i often use rb_warn for debuging ...
<banisterfiend>
rb_p too
resure has joined #ruby
_keith has joined #ruby
freeayu3 has joined #ruby
jrajav has joined #ruby
<anoldhacker>
k thanks.
bluebie has joined #ruby
fforbeck has joined #ruby
thecreators has quit [Remote host closed the connection]
<bluebie>
ohai
d3vic3 has quit [Ping timeout: 265 seconds]
shiki has quit [Remote host closed the connection]
sspiff has quit [Ping timeout: 246 seconds]
jorge_ has quit [Remote host closed the connection]
d3vic3 has joined #ruby
Spooner has quit [Quit: Spooner]
bbttxu has quit [Quit: bbttxu]
Spooner has joined #ruby
sspiff has joined #ruby
sspiff has quit [Changing host]
sspiff has joined #ruby
zommi has joined #ruby
thatRD has quit [Ping timeout: 276 seconds]
CreativeEmbassy has joined #ruby
<zeknox>
i have a logic flaw in the way im parsing xml, line 17 loops through every element in the xml, when I only want it to view the current tag that ties to the ip address tag, would appreciate any assistance ---> http://pastie.org/4574305
<bluebie>
zeknox: presumably e1 is an element with a similar 'elements inside me' kind of method you could use instead of querying xmldoc.elements
virunga has joined #ruby
<bluebie>
it maybe fixed simply by replacing 'xmldoc' with e1 on line 17
<bluebie>
but then, I don't use rexml, and don't care to learn it :S
shiki has joined #ruby
<bluebie>
or... oh I think I get what you want
<CodeFriar>
How do I tell rspec that I expect method X to call method Y
bluenemo has quit [Quit: Verlassend]
<hoelzro>
CodeFriar: why does it matter what methods method X calls?
<CodeFriar>
just trying to be complete. new to testing.
<Spooner>
CodeFriar : You can't directly check if X itself is calling Y, but you do @subject.should_receive(:Y); @subject.X
<bluebie>
I'm sure you could do something horrible with the backtraces :)
<bluebie>
but dont
miho has joined #ruby
<bluebie>
please
<hoelzro>
CodeFriar: well, the problem then is that your tests depend on the fact that X calls Y
<CodeFriar>
Spooner: thats what I'm doing but it's not working
<CodeFriar>
hoelzro: thats the behaviour I want...
yoklov has joined #ruby
<Spooner>
hoelzro : It matters if you want to do true unit testing and not test Y at that point, for example if Y is accessing a database or something else slow.
<hoelzro>
so if you want to change that, you need to change your tests and your code
GoGoGarrett has joined #ruby
Eldariof-ru has joined #ruby
<zeknox>
bluebie: I changed line 17 like you mentioned, it runs, but doesn't display anything now
<bluebie>
mmm yeah sorry zeknox I misunderstood your problem :/
<bluebie>
looking for better solution now
<bluebie>
rexml :S
<zeknox>
bluebie: yeah, its hard to explain
<banisterfiend>
bluebie: sup bluebs
<bluebie>
I get it now
<bluebie>
hey banisterfiend - don't suppose you know rexml?
<banisterfiend>
bluebie: nope
<banisterfiend>
sry
<zeknox>
what do you guys prefer I use to parse xml in the future? xpath?
<bluebie>
zeknox: nokogiri is great
<Spooner>
zeknox : What bluebie is trying to say is, if you use nokogiri or another commonly used XML thing in this day and age, then you'd get more wisdom here :)
itcharlie has joined #ruby
<bluebie>
xpath is a query syntax, nokogiri is a parsing library (which can do xpath, as can rexml)
<bluebie>
I personally prefer css selectors
Takehiro has quit [Remote host closed the connection]
Takehiro has joined #ruby
<zeknox>
bluebie: Spooner: I understand guys, just started googling last night and working away at it
kpshek has joined #ruby
<itcharlie>
Where can I read more information about mod ruby?
<Hanmac>
itcharile you mean like in apache mods?
<fowl>
itcharlie: modruby hasnt been updated since 2008 iirc
workmad3 has joined #ruby
<itcharlie>
yes. Actually I found the url. http://modruby.net/en/ seems like modruby.net/ needs a landing page instead of "It works"
<bluebie>
itcharlie: You'll be wanting passenger these days
<Spooner>
zeknox : You can probably get away with something like xmldoc.elements["address"].each
<itcharlie>
bluebie, say what?
<zeknox>
Spooner: you thinking of doing that on line 17?
<bluebie>
itcharlie: Fusion's Passenger is an apache/nginx module for serving ruby webapps
theRoUS has joined #ruby
<bluebie>
it works a bit like mod_php, loading up apps, shutting them down when they're not in use anymore
<Spooner>
zeknox : both 16 and 17 - I don't know though, since I don't know the nmap.xml structure. I was being lazy (if you just want all the address tags from the doc, that will do fine).
<bluebie>
pretty good for hosting some little apps for your personal site or whatever. There's better app server style stuff for if you're going to be the next github or tumblr
<itcharlie>
I see thanks bluebie
<bluebie>
zeknox: does a <host> only ever contain at most one address and one <hostscript><script>?
<Spooner>
zeknox : Or use xpath, which people probably know better than rexml's API (disclaimer, I avoid XML like the plague, so I rarely have to worry and only learn the minimum I need in the circumstance when I can't).
<zeknox>
bluebie: Spooner I'll post some sample xml
resure_ has joined #ruby
<bluebie>
zeknox: If this is your first dealing with xml in ruby, and you're not terribly invested in rexml, I'd switch to nokogiri. Let me know if you're keen on doing that and I'll post some example code for you
nateberkopec has joined #ruby
workmad3 has quit [Ping timeout: 252 seconds]
fridim_ has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
<zeknox>
bluebie: yeah im considering changing to nokogirl because I know that it is big now that you mention it, I'm only about 4 hours vested into REXML
<bluebie>
alright post that example xml and I'll have a go at it for you :)
redgetan has quit [Quit: Leaving]
infinitiguy has joined #ruby
<zeknox>
bluebie: working on it :)
waxjar has joined #ruby
t80427 has quit [Remote host closed the connection]
t58605 has joined #ruby
rubious has joined #ruby
<zeknox>
bluebie: cool if I pm it over?
sepp2k has quit [Ping timeout: 246 seconds]
<bluebie>
if it's more than a few lines, paste it somewhere
<bluebie>
my irc client will start ignoring you if you dump a lot of lines at me
<zeknox>
im doing pastie, but want to keep it private
<bluebie>
sure thing :)
Taichouchou has joined #ruby
sepp2k has joined #ruby
tagrudev has quit [Remote host closed the connection]
enroxorz-work has joined #ruby
enroxorz-work has quit [Changing host]
enroxorz-work has joined #ruby
znake has joined #ruby
resure has quit [Remote host closed the connection]
<csmrfx>
Is there a ruby project template? github or...
cezar has joined #ruby
apok has quit [Quit: apok]
thatRD has joined #ruby
cezar has quit [Client Quit]
thatRD has quit [Quit: thatRD]
uris has joined #ruby
paolooo has joined #ruby
<bluebie>
csmrfx: blank text file works fine
<bluebie>
what sort of project are you hoping to make?
znake has quit [Client Quit]
znake has joined #ruby
denysonique has joined #ruby
<bluebie>
rails has some 'generators' which are kind of like smart (or dumb depending who you ask) dynamic templates for big complex businessy webapp things
locriani has quit [Remote host closed the connection]
axl_ has quit [Read error: Connection reset by peer]
axl_ has joined #ruby
Eldariof59-ru has joined #ruby
<zeknox>
bluebie: thanks for the help, you da man!
<csmrfx>
More like just have a nice simple directory structure and a .rb file with the correct encoding header, why not also have a var that points to where the filepath is
niklasb has quit [Ping timeout: 240 seconds]
* csmrfx
is not much of a gem person
<csmrfx>
ie. "ruby boilerplate"
<csmrfx>
maybe have stuff for bundler / gem packagers etc ready in the project template too
sspiff has quit [Ping timeout: 246 seconds]
mneorr has quit [Quit: Leaving.]
<bluebie>
:)
<Spooner>
csmrfx : bundle gem my_gem
<Spooner>
Does some manner of template generation, but I havent' used it myself.
<bluebie>
csmrfx: ruby doesn't need anything like that. Just make a file - you don't need any special stuff to get started
<bluebie>
csmrfx: it's not like C or Java or whatever where you need some standard boring stuff to wrap the interesting bits
<csmrfx>
Ruby doesn't need, *I* *want*
Eldariof-ru has quit [Ping timeout: 264 seconds]
<Spooner>
bluebie : There is a lot of boilerplate you need to create a gem though though, which does take time to copy-and-paste from other projects.
sspiff has joined #ruby
sspiff has quit [Changing host]
sspiff has joined #ruby
* csmrfx
is not a ruby noob
lolmaus has quit []
jlogsdon has joined #ruby
<csmrfx>
HTML5 doesn't *need* the broilerplate, either
<csmrfx>
but it is still *great*
<csmrfx>
saves time, etc
yoklov has quit [Quit: computer sleeping]
<Spooner>
Anyway, just use bundler if you want, and don't if you don't :)
<bluebie>
csmrfx: there's no boilerplate
<bluebie>
I guess gems have a little bit :S
<bluebie>
it's like a lib directory and a five line file
<bluebie>
but whatever floats your boat I suppose
<fowl>
csmrfx: say more things like *this*
<Spooner>
Bit more than that, bluebie, and certainly a lot less than other languages.
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
<bluebie>
ruby is pretty much *the* language where if there were boilerplate, they built it in to the language already and got rid of it, IMO. #canuseasteriskstoo #andhashtags
<csmrfx>
well I guess I will have to make a boilerplate
<fowl>
most people these days have a stove, but whatever
jearvondharrie has joined #ruby
<Spooner>
If you followed that link I pasted, it shows you. Gemfile, Rakefile, .gitignore, gemspec, main file in lib, version file.
<Spooner>
I'd also suggest that bin/mygem is a pretty standard 100% boilerplate file.
<Mon_Ouie>
Not all gems need a binary
<bluebie>
yeah most don't
<bluebie>
it'd be annoying for gems to polute my path with random crap messing up my autocomplete if they don't have a binary functionality
<Spooner>
No, but many do. Just saying that there is plenty of repetition in every gem.
<bluebie>
seems like a lot of opt-in repitition to me
t58605 has quit [Remote host closed the connection]
<Xeago>
anyone good with english? unread notifications count, or unread notification count
<csmrfx>
I used to banter HTML5 boilerplate project. But then had to start alot from the scratch. And suddenly realized there are dozens of small "10-minute" things that are "easy as hell" even to the smallest of project. Boilerplate saved me time. Doesn't matter if it's 10 minuter, or the more likely 60 minutes
<fowl>
>> $0
<al2o3cr>
(String) "-e"
fantazo has joined #ruby
<fowl>
>> DATA
<al2o3cr>
-e:1:in `eval': uninitialized constant DATA (NameError), from -e:1:in `eval', from -e:1:in `<main>'
<shevy>
I still have to port about 4000 lines of old ruby code
<fowl>
Hahaha
<shevy>
ack
<shevy>
SPAM!
graspee has quit [Quit: leaving]
<jrajav>
How did that manage to get around the flooding controls
<carloslopes>
lol
<shevy>
lol
<jrajav>
I truncate all string at 400 chars
<bluebie>
well I'm having fun
<Spooner>
bluebie : Lots of gems don't need Rakefile or Gemfile? Yeah, you don't strictly need it, but the point of boilerplate generators is to create a lot of standard stuff that will mostly be useful. Doesn't mean you can't either use it and then edit it or just not use it, but it sets a nice standard if you want to save 10 minutes of rote creation on a new project.
<rcassidy>
>> File.new("rcassidy.txt", "w").puts "I doubt this will work."
<al2o3cr>
-e:1:in `eval': Permission denied - rcassidy.txt (Errno::EACCES), from (eval):1:in `new', from (eval):1:in `<main>', from -e:1:in `eval', from -e:1:in `<main>'
<bluebie>
IDK you probably need the gemfile
<jrajav>
rcassidy: Odd.. that actually *should*
cakehero has joined #ruby
<rcassidy>
jrajav: i was able to do it before you patched it some
<jrajav>
rcassidy: I guess you can't create a new file if the directory's not executable?
<Spooner>
And whoever is spamming the bot on irrelevant stuff, rather than using PM, is close to getting a /ignore on the bot :/
<rcassidy>
jrajav: i think you blocked it more than you thought - can't do this either
<al2o3cr>
-e:1:in `eval': No such file or directory - /tmp/bluebie.txt (Errno::ENOENT), from (eval):1:in `new', from (eval):1:in `<main>', from -e:1:in `eval', from -e:1:in `<main>'
<Mon_Ouie>
That's pretty much all I *always* need
<bluebie>
aw
<rcassidy>
>> File.open("log").gets
<al2o3cr>
(NilClass) nil
<bluebie>
what kind of a crazy linux doesn't have /tmp
<Mon_Ouie>
And come on, stop spamming this channel with the bot
<Muz>
If you're going to dick about with the bot, do it in a PM.
<Muz>
If you've actually something interesting, or not done before, post it to the channel.
<Muz>
*actually done
<fowl>
lol @ the amount of times "the bot" was just said
<bluebie>
kk :)
twigmorewelsh has joined #ruby
<banisterfiend>
Mon_Ouie is about to use the banhammer
emmanuel__ has joined #ruby
<fowl>
there are 666 ppl in here
<jrajav>
I'll see if I can fix the fact that you can't write files
<jrajav>
But not today
<jrajav>
I've hacked around with the bot way too much lately >_>
<Spooner>
Mon_Ouie : so that is all the boilerplate you need. Fine. Not sure why that stops other people using a generator to create more files if they aren't forcing you to do it too.
<jrajav>
I'm a lot more likely to add aliasing first
<jrajav>
If I add anything to the bot
<shevy>
bluebie the bot is in a chrooted sandbox
znake has quit [Quit: znake]
<bluebie>
is the chroot the only sandboxing? <_<
<shevy>
it wants to break out of it
<Mon_Ouie>
Nothing, I was just stating a fact
<shevy>
dunno... there are only 6 files in /usr/bin or something like that
<jrajav>
bluebie: Other than what you see in the source, yup
adac has joined #ruby
<jrajav>
bluebie: The scripts are also run in a separate process with various resource limits
<Spooner>
bluebie : It is in a VM too, so it isn't going anywhere.
<shevy>
FAMOUS LAST WORDS!!!
<jrajav>
And yeah the whole linux box is just a vm
<bluebie>
lol
<jrajav>
And the bot is the only thing on it
<banisterfiend>
when building C extensions there can be more boilerplate
<bluebie>
oh right
<banisterfiend>
i like to use templates for that
<banisterfiend>
and also for specific kinds of gems, like pry plugins, i have gem templates for that too :)
<bluebie>
I kind of want to /part just so I don't have to read 'boilerplate' again tonight
<jrajav>
bluebie: More easily readable source: github.com/jrajav/al2o3cr
fbernier has joined #ruby
cantonic has quit [Quit: cantonic]
justinmcp has quit [Remote host closed the connection]
<banisterfiend>
bluebie: let's call them pot boilers
<bluebie>
jrajav: Neat! ^_^
joephelius has quit [Ping timeout: 268 seconds]
<jrajav>
Yo dawg I heard you like boilerplate
<adac>
Currently I'm dowonlaoding a file via mechanize like this: "agent.get(URL).save PATHTOFILE" Now thsi does not simply overwrite the file if it already exists, but saves the file again numbered. How can I tell "save" to overwrite it? Any ideas?
<bluebie>
you could rm the file before downloading it <_<
* csmrfx
infinite lazyness
<chiel>
hmm
<chiel>
has any of you ever written a restart script for unicorn?
<chiel>
I guess it's not too hard
<chiel>
Process.kill('USR2') or something
<csmrfx>
ie. a daemon that restarts if fail
<bluebie>
unicorn doesn't come with something like that in the form of an rc.d script?
<shevy>
adac one work around - FileUtils.rm PATHTOFILE if File.exist? PATHTOFILE
<chiel>
don't think so, you need to script it into the config, so it knows what to do on forking and stuff
<chiel>
and then you send it to USR2 to gracefully shut down the current master and bring up a new one
t77004 has quit [Remote host closed the connection]
<bluebie>
shevy: Or even ask forgiveness! FileUtils.rm PATHTOFILE rescue nil
<chiel>
the first worker on the new master will then send a QUIT to the old master
* bluebie
is a bad person
t33265 has joined #ruby
<shevy>
ewww
<adac>
bluebie, yes I could but that would be one "if" more ;)
<chiel>
just need to dig into it, I guess :D
<shevy>
I hate rescue nil expressions
<adac>
shevy, ^^
<shevy>
ada2358, but save is a method
<shevy>
what arguments does it accept?
freeayu__ has joined #ruby
<shevy>
because if it does accept only one argument, I dont see how you can tell it to overwrite or remove the file directly
<shevy>
sorry
<shevy>
I meant adac
jorge_ has joined #ruby
<Spooner>
Or just FileUtils.rm "blob.fish", force: true
<anoldhacker>
I'm wanting to check which of two valid symbols my method has been passed (in C). The README.EXT led me to believe that String ValueCStr would work, but it only wants real Strings.. Help?
<adac>
Spooner, yes that sounds good
jarek has joined #ruby
<Spooner>
andrenkov : You can do SYM2ID(symbol) == rb_intern("frog"), which saves messing with strings.
* anoldhacker
think that autocomplete hates EVERYONE...
gfontenot has joined #ruby
<Hanmac>
PS: first you could check with SYMBOL_P(sym) if an VALUE is realy an symbol
<Spooner>
We just need to make #ruby less popular, so there aren't multiples of people with the same first 2-3 characters. Right, where was that spam-bot again. I'm going to boilerplate it to death.
<shevy>
haha autocomplete
<shevy>
ada2358 vs adac
<anoldhacker>
Hanmac: Already did that. ;)
<shevy>
xchat prefers ada2358
<shevy>
:(
<bluebie>
autocomplete loves me
atmosx has joined #ruby
uris has quit [Ping timeout: 252 seconds]
<Mon_Ouie>
I configured my client to only autocomplete up to the last unambiguous character
<Hanmac>
why is the most evil spamer one of the Channel ops?
<Mon_Ouie>
Saves some mistakes :p
<adac>
shevy, yes xchat does weird things with the autocomplete. Its really annoying
axl_ has quit [Read error: Connection reset by peer]
<fowl>
Hanmac: his Programs are extra Meta; in other words he has been deemed Enlightened enough to lead us
<shevy>
Hanmac so he can ego-control #ruby like zenspider does on #ruby-lang
<Mon_Ouie>
Hm; maybe because he lives where people walk upside down, so he's there when everyone's asleep? :p
<banisterfiend>
Mon_Ouie: hmm, then u have no excuse for referring to me as 'baby:' in #pry
axl_ has joined #ruby
<bluebie>
now as I understand it, #ruby-lang is not a fun happy go lucky place
<bluebie>
Why once told me to never go in there
uris has joined #ruby
<bluebie>
is that still the case?
<shevy>
dunno, it depends
<Muz>
They're less tolerant of idiots.
<shevy>
some people on #ruby-lang are never here on #ruby
<Muz>
I guess the question is, are you an idiot?
<banisterfiend>
bluebie: it's pretty much dead these days
<fowl>
bluebie: go in there and ask obvious ruby questions
<bluebie>
Muz: yes
mahmoudimus has joined #ruby
<Spooner>
Muz I'll stay here then :)
<Muz>
:p
freeayu3 has joined #ruby
<shevy>
my biggest problem with it is that you must be registered now in order to speak on #ruby-lang
gift has joined #ruby
<bluebie>
elitist ruby
<bluebie>
okay
<shevy>
yeah but also some smart folks
gloomer_1 has quit [Ping timeout: 252 seconds]
<bluebie>
meh who needs 'em!
<Hanmac>
bluebie some of the users there are banned on #ruby-lang :P
<shevy>
hehe
<shevy>
RubyPanther is still banned? :D
<bluebie>
what we lack in quality we make up for in quantity!
<fowl>
bluebie: its lead by a group called seattlerb, and we all know what seattle is made of... hipsters.
jrajav has quit [Quit: The best darkness is strange and surprising]
freeayu__ has quit [Ping timeout: 268 seconds]
<Hanmac>
shevy do i need you to remember at Tintin? XD
<bluebie>
doubtless they were in to ruby before it was cool
<shevy>
hmm tintin... which tintin... not the MUD client or?
carrythezero has quit [Read error: Connection reset by peer]
<fowl>
ha
<shevy>
bluebie even matz used to be on #ruby-lang
<lectrick>
banisterfiend: wait, wait. I have a method that took an implicit block via &block. I want to call method_two(&block), but method_two isn't seeing it.
<banisterfiend>
lectrick: that's an EXPLICIT block :)
Spooner has quit [Ping timeout: 252 seconds]
simao has quit [Changing host]
simao has joined #ruby
<lectrick>
banisterfiend: but it's got the & magic. Isn't an explicit block taking it as an arg?
<bluebie>
I wonder if mruby would run on tiny 8-bit computers
<banisterfiend>
lectrick: no
<bluebie>
that could be cool
<banisterfiend>
lectrick: watch
<banisterfiend>
explicit:
<banisterfiend>
>> def hello(&block); block.call; end hello { "hi" }
<csmrfx>
hm, how do you know it is 'grapefruit' btw
Guest__ has joined #ruby
<Hanmac>
it was an sample
jearvondharrie has quit [Read error: Connection reset by peer]
jorge_ has quit [Remote host closed the connection]
freeayu has joined #ruby
Guest__ is now known as wo66le
josemota has joined #ruby
<csmrfx>
Heh, I am thick, I do not grok how to combine scan, match and result group [1]
tayy has joined #ruby
<josemota>
hi everyone, i'm running `time rspec` and the time shows up instantly before running the specs. what gives? has anyone had this happening?
<csmrfx>
hm, mebbe in block
tomsthumb_ has quit [Quit: Leaving.]
<josemota>
am i missing something?
freeayu3 has quit [Ping timeout: 246 seconds]
tayy has quit [Remote host closed the connection]
erichmenge has joined #ruby
Takehiro has quit [Remote host closed the connection]
fermion has joined #ruby
Takehiro has joined #ruby
t95974 has quit [Remote host closed the connection]
<csmrfx>
Ok, I grouped em with parenthesis dstr.scan(/(param=)(\w*)([;|"])/) { |rr| p rr }
<csmrfx>
now it works, thanks Hanmac rcassidy
t13990 has joined #ruby
Taichouchou has joined #ruby
ar_ has joined #ruby
sendoushi has quit [Read error: Connection reset by peer]
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
sendoushi has joined #ruby
Progster has joined #ruby
<csmrfx>
varified: dstr.scan(/(#{strt})(\w*)([#{enrt}|"])/) { |rr| p rr[1] }
<csmrfx>
pretty readable, huh
Hanmac has quit [Ping timeout: 276 seconds]
banghouse has joined #ruby
Taichouchou has quit [Client Quit]
Taichouchou has joined #ruby
joephelius has joined #ruby
fbernier has quit [Ping timeout: 272 seconds]
fastred has quit [Quit: fastred]
choffstein has quit [Remote host closed the connection]
Taichouchou has quit [Client Quit]
Taichouchou has joined #ruby
Morkel has joined #ruby
<csmrfx>
at least it can be commented after x-yfying it
Zespre has quit [Ping timeout: 260 seconds]
Zespre has joined #ruby
emmanuel__ has quit [Ping timeout: 252 seconds]
<csmrfx>
when using variables in a regexp, can vars be reset or does the regxp need to be re-created?
jlogsdon has quit [Ping timeout: 252 seconds]
<csmrfx>
+when creating a regexp instance into a var
Hanmac has joined #ruby
<fowl>
huh
davidcelis has quit [Quit: K-Lined.]
<fowl>
you mean x = /someregex/ or /someregex#{x}/
apeiros_ has quit [Remote host closed the connection]
savage- has joined #ruby
<csmrfx>
If one do: byrd = "fowl"; rexp = /A #{byrd}; and then byrd = "apeiros", which will it match?
<csmrfx>
it = rexp
<csmrfx>
ah
<fowl>
r would be /A fowl/
<csmrfx>
It will interpolate when instancing
<csmrfx>
not lazy
<csmrfx>
gosh
<csmrfx>
can it be made lazily?
jorge_ has joined #ruby
jorge_ has quit [Remote host closed the connection]
<fowl>
rexp = -> { /A #{byrd}/ }
<atmosx>
[*] CVE-2010-EASY Android local root exploit (C) 2010 by 743C
<atmosx>
ahaha that's fancy...
<csmrfx>
fowl you put the rexp in a lambda block?
Zespre has quit [Ping timeout: 246 seconds]
nopolitica has quit [Ping timeout: 252 seconds]
<fowl>
csmrfx: yes then change byrd and call it
<csmrfx>
bybybybyytfbyyrdbyyrd
<fowl>
compare against regx[]
<Muz>
Everybody's heard that the byrd is the wyrd.
<csmrfx>
I mean, it almost defeats the purpose of interpolating if can not re-use
sh1nji has joined #ruby
<fowl>
considering that string interpolation works the same way i think you should stop crying
uris_ has joined #ruby
<csmrfx>
bwah!
Araxia has joined #ruby
freeayu__ has joined #ruby
<csmrfx>
bwyah! it return an arr in an arr
waxjar has quit [Quit: Computer has gone to sleep.]
<csmrfx>
next: I put the lime in the coconut
limes has joined #ruby
tomsthumb_ has joined #ruby
josemota has quit [Quit: WeeChat 0.3.8]
Araxia has quit [Client Quit]
answer_42 has quit [Ping timeout: 276 seconds]
uris has quit [Ping timeout: 240 seconds]
freeayu has quit [Ping timeout: 246 seconds]
mneorr1 has quit [Quit: Leaving.]
codeFiend has joined #ruby
elhu has quit [Quit: Computer has gone to sleep.]
Zespre has joined #ruby
wvms has left #ruby [#ruby]
Eldariof59-ru has quit []
elhu has joined #ruby
t13990 has quit [Remote host closed the connection]
maesbn has quit [Remote host closed the connection]
<csmrfx>
hm, vim doesn't like my lambda-regexp-block-groups
t51205 has joined #ruby
maesbn has joined #ruby
answer_42 has joined #ruby
freeayu__ has quit [Ping timeout: 246 seconds]
xclite has joined #ruby
<csmrfx>
hm, or it's probably the #{} in the middle
cantonic has quit [Quit: cantonic]
aganov has quit [Quit: aganov]
bradhe has quit [Remote host closed the connection]
vectorshelve has quit [Quit: Page closed]
baroquebobcat has joined #ruby
Taichouchou has quit [Remote host closed the connection]
Taichouchou has joined #ruby
Morkel has quit [Quit: Morkel]
maesbn has quit [Ping timeout: 268 seconds]
flargh2 has joined #ruby
Taichouchou has quit [Client Quit]
Taichouchou has joined #ruby
Rochefortes has joined #ruby
Morkel has joined #ruby
markprovan has joined #ruby
shiki has quit [Remote host closed the connection]
<csmrfx>
thank you fowl! rather nice
jprovazn is now known as jprovazn_away
<flargh2>
Anyone know how I can generate symbols in an extension so valgrind can show line number?
chussenot has quit [Remote host closed the connection]
Rochefort has quit [Ping timeout: 246 seconds]
chussenot has joined #ruby
Rochefort has joined #ruby
<Mon_Ouie>
Compile with $CFlAGS << " -g"
<flargh2>
I've tried that and still no line numbers.
Rochefortes has quit [Read error: Connection reset by peer]
_keith has left #ruby [#ruby]
aantix has joined #ruby
apok has joined #ruby
aantix has quit [Read error: Connection reset by peer]
<flargh2>
I can get line numbers with a hand-made makefile using -g in both LDFLAGS and CFLAGS without using the extension. But I can't seem to get them for the extension.
Taichouchou has quit [Client Quit]
aantix has joined #ruby
Taichouchou has joined #ruby
Taichouchou has quit [Remote host closed the connection]
elhu has quit [Ping timeout: 252 seconds]
ckrailo has joined #ruby
<flargh2>
Is there something special about running ruby under valgrind that blocks line numbers?
Taichouchou2 has joined #ruby
<Hanmac>
shevy do you want to be my magican that converts my camels into snakes?
kpshek has quit []
djbender has joined #ruby
MetaCosm has quit []
gani has joined #ruby
ikaros has joined #ruby
iori has joined #ruby
iori has quit [Read error: Connection reset by peer]
iori has joined #ruby
axl__ has joined #ruby
elhu has joined #ruby
savage- has quit [Remote host closed the connection]
<shevy>
Hanmac nah, I need to finish this rewrite
<shevy>
4000 lines of old code still left
banghouse has quit [Quit: What if the hokey pokey really is what it's all about?]
<al2o3cr>
-e:1:in `eval': undefined method `downcase' for ["C", "an"]:Array (NoMethodError), from (eval):1:in `<main>', from -e:1:in `eval', from -e:1:in `<main>'
<al2o3cr>
-e:1:in `eval': undefined method `downcase' for ["Can"]:Array (NoMethodError), from (eval):1:in `<main>', from -e:1:in `eval', from -e:1:in `<main>'
<Spooner>
I should give up or use pry first :)
<csmrfx>
dont you need exactly one A-Z and zero or more a-z
<al2o3cr>
(eval):1: warning: regular expression has ']' without escape: /[[:upper:]][:lower:]]*/, (eval):1: warning: regular expression has ']' without escape: /[[:upper:]][:lower:]]*/
<Spooner>
enricostn : the former one doesn't work if a is undefined (only if a is nil).
Rochefort has quit [Ping timeout: 246 seconds]
<limes>
could someone tell me how to / where to fix > http://pastebin.com/7M2NxV3U < observer.rb:126:in `add_observer': observer needs to respond to `update' (NoMethodError) cant find a hint on google...
Norm has joined #ruby
<enricostn>
Spooner: in irb if I type a = a || {} I get {}
jorge_ has joined #ruby
luxurymode has joined #ruby
<Spooner>
enricostn : You do indeed. I was wrong. Well, there is no difference then. ||= is just shorthand (like +=)
<Norm>
can a gemspec file define groups, like a Gemfile? or do i have to configure groups in the gemfile?
eywu has joined #ruby
<Muz>
Norm: groups are a feature of Bundler and belong in the Gemfile, not hte gemspec.
<Muz>
The gemspec is used for building the gem that's shipped by RubyGems.
<Mon_Ouie>
There are differences, a ||= {} is more like a || (a = {}) (and does implicitly define local variables)
<Spooner>
Norm : bundler does assign :default and :development groups though.
sixtycakes has joined #ruby
<Spooner>
Based on the gemspec.
<Norm>
the distinction between Gemfile and gemspecs is still a little hazy
<Norm>
Spooner: got it
chimkan_ has joined #ruby
<Mon_Ouie>
If you call it with a method, the setter will never be called if the getter returns something that isn't false or nil
<Norm>
if i define dependencies in my Gemfile, will they get loaded by bundler/setup?
<Hanmac>
(or undefined :D)
pdelgallego has quit [Ping timeout: 246 seconds]
<Spooner>
Norm : Yeah, it is a great shame that the functionality of bundler is separated from rubygems.
<enricostn>
Mon_Ouie: how I could check this in irb?
Squarepy has quit [Quit: Leaving]
<Spooner>
norm dependencies how?
<Mon_Ouie>
The typical example uses hashes. h = Hash.new(0); h['foo'] ||= 1; p h
pdelgallego has joined #ruby
<Mon_Ouie>
^ the hash will still be empty
<Mon_Ouie>
Actually
<Norm>
Spooner: in my gemfile, if i do "gem 'eventmachine'", it seems that bundler knows to load it
<Mon_Ouie>
>> h = Hash.new(0); h['foo'] ||= 1; h
<al2o3cr>
(Hash) {}
<Sou|cutter>
Norm: depends on what groups they're in
x77686d has quit [Ping timeout: 246 seconds]
azm has joined #ruby
azm has quit [Changing host]
azm has joined #ruby
<Mon_Ouie>
>> h = Hash.new(0); h['foo'] = h['foo'] || 1; h
<al2o3cr>
(Hash) {"foo"=>0}
stopbit has quit [Read error: Connection reset by peer]
<Spooner>
It does. I think you want to use "gemspec" method in your Gemfile?
kn330 has joined #ruby
havenn has joined #ruby
<Mon_Ouie>
(Still getting used to having that bot here :)
Vert has quit [Read error: Connection reset by peer]
<Norm>
Spooner: yeah, i do have 'gemspec' in there. but if this just loads the gemspec file, i lose the ability to declare dependencies for a specific group
<Muz>
Mon_Ouie: you mean it has a use other than people trying to break it?!
stopbit has joined #ruby
<Norm>
Spooner: so, as i see it, i have to declare my "global" dependencies in my gemspec, and the per-group dependencies in the gemfile?
<Muz>
Norm: dependencies in the gemspec should be items that anyone who wants to use your gem in a production environment will need to run it. Deps in your Gemfile are items you'll need to develop on your gem before you package and ship it.
<Sou|cutter>
gemspec has the concept of development dependencies
<Sou|cutter>
but gemspec is certainly not as flexible as Gemfile groups
mohits has quit [Ping timeout: 260 seconds]
<Norm>
Muz: got it
the_jeebster has joined #ruby
<Muz>
Example: Gemfile contains 'cucumber' for testing your development, but you dont' want other people who install your gem to need to install cucumber just to use your lib.
<Norm>
Muz: right, i wanted to use the Gemfile to define groups other than just prod & test
<Norm>
seems that's not exactly how it's going to work :)
<Spooner>
norm Sadly, yes, I think that is what you need to do, but really your gemspec is all that is run by your gem when used by others, so adding more deps in your Gemfile doesn't really help.
<Muz>
That is a very rudimentary overview of the differentiation between where you list deps though.
<Sou|cutter>
Muz: in gemspec you can use add_development_dependency
<Muz>
Sou|cutter: yup, but then there are times when you may want to have gems installed for your local development that you don't want others downstream to /need/
lesce has joined #ruby
<Muz>
Like I said, a very rudimentary overview. But yeah, locally, you may be maintaining all manner of additional guff in your Gemfile for your project and local gemset that aren't pertinent to development deps in your gemspec.
<Sou|cutter>
Muz: add_development_dependency is effectively equivalent to putting a gem in a development group in bundler
mahmoudimus has joined #ruby
andrenkov has quit [Quit: leaving]
iori has quit [Remote host closed the connection]
<Sou|cutter>
users of your gem will not have development dependencies added to their dependency tree
jrajav has joined #ruby
markprovan has left #ruby [#ruby]
* Muz
is aware of the difference between spec.add_dependency, and spec.add_development_dependency. :)
<Muz>
Sou|cutter: we have all manner of internal gems we use here that I wouldn't want to have people expect to have access to in order to make further downstream changes
Morkel has quit [Quit: Morkel]
bluenemo has quit [Remote host closed the connection]
<Sou|cutter>
that sounds like a messy situation
<Cork>
i'm looking for a text parser that uses templates (sort of a revers template rendering format)
<Cork>
has anyone heard of something like that?
t59808 has quit [Remote host closed the connection]
randomautomator has joined #ruby
pdelgallego has quit [Read error: Connection reset by peer]
t25789 has joined #ruby
oc_ has left #ruby [#ruby]
davidcelis has joined #ruby
<Mon_Ouie>
enricostn: What exactly about them?
jorge_ has quit [Remote host closed the connection]
xorigin has quit [Quit: leaving]
senny has quit [Remote host closed the connection]
pskosinski has quit [Read error: Connection reset by peer]
ly_gs has quit [Remote host closed the connection]
hadees has quit [Quit: hadees]
spanner has quit [Ping timeout: 268 seconds]
withnale has joined #ruby
robotmay has quit [Remote host closed the connection]
liluo has quit [Remote host closed the connection]
havenn_ has joined #ruby
lesce has quit [Quit: Leaving]
flagg0204 has quit [Ping timeout: 240 seconds]
spanner has joined #ruby
flagg0204 has joined #ruby
cbuxton has joined #ruby
mmitchell has quit [Remote host closed the connection]
<Hanmac>
shevy is "create_billboard_chain" still a good name for snake_case? :(
apok has joined #ruby
xclite has joined #ruby
x77686d has joined #ruby
kenichi has joined #ruby
<eric-wood>
fuck contenteditable
<eric-wood>
every browser generates different markup
<eric-wood>
and it's all bullshit
xclite has quit [Remote host closed the connection]
<eric-wood>
anyone here ever do anything with it?
<eric-wood>
I could use some insights
<enricostn>
Mon_Ouie: in the add method they use ||= operator, but in the index method they use ||
savage- has joined #ruby
xclite has joined #ruby
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
<Mon_Ouie>
I guess for some reason they don't need to set session[:car] to {} in index
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
<Mon_Ouie>
They may not need it at all, in fact
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
shevy has quit [Ping timeout: 252 seconds]
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
mikepack has joined #ruby
kn330 has quit [Read error: Connection reset by peer]
<enricostn>
Mon_Ouie: do you mean that in cart = session[:cart] ||= {} if session[:cart] is nil or undefined then cart but also session[:cart] will be set to {}?
havenn has quit [Remote host closed the connection]
savage- has quit [Remote host closed the connection]
<Mon_Ouie>
session[:cart] can't be undefined
machuga has joined #ruby
otters has quit [Quit: WeeChat 0.3.8]
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
ibash has joined #ruby
<Mon_Ouie>
That undefined part only applies for variables
jrajav has quit [Quit: The best darkness is strange and surprising]
savage- has joined #ruby
apok has quit [Quit: apok]
<Mon_Ouie>
And, yes that's what will happen
<enricostn>
ah ok
<kapowaz>
is there any way of ensuring that the output from a shell command invoked as part of a ruby script doesn't ever get output to stdout?
<kapowaz>
I'm running `someutil --options` and it's outputting some things regardless
<enricostn>
Mon_Ouie: ok, I got it. thank you!
<kapowaz>
I'd like it to be entirely quiet so that I can provide my own output based on the processed results
hoelzro is now known as hoelzro|away
<Mon_Ouie>
You can use IO.popen and get the input as an IO stream
djbender has quit [Quit: djbender]
<Mon_Ouie>
Well, the output of that program
maletor has joined #ruby
graft has joined #ruby
graft has quit [Changing host]
graft has joined #ruby
CodeFriar is now known as c00kiemonster
hadees has joined #ruby
<kenichi>
if you're running `something` and seeing output, isn't it more likely that output is going to stderr?
<kenichi>
kapowaz: ^^
niklasb has joined #ruby
dhruvasagar has quit [Ping timeout: 248 seconds]
<kapowaz>
that's also possible
tommyvYo has quit [Quit: Computer has gone to sleep.]
azm has quit [Ping timeout: 268 seconds]
<kenichi>
try `something 2>&1` or something like that
<kapowaz>
but I have no control over how that program works :(
<kapowaz>
aha
<kapowaz>
perfect!
<kapowaz>
thanks!
mmitchell has joined #ruby
<kenichi>
np
<kapowaz>
that redirects stderr to stdout ?
<kenichi>
y
chimkan___ has joined #ruby
<kapowaz>
excellent, sidesteps ruby completely :)
mmitchell has quit [Remote host closed the connection]
t25789 has quit [Remote host closed the connection]
t59202 has joined #ruby
fyolnish has quit [Remote host closed the connection]
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
w400z has quit []
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
carloslopes has quit [Quit: Leaving.]
chimkan_ has quit [Ping timeout: 240 seconds]
Advocation has quit [Quit: Advocation]
mengu has joined #ruby
_bart has quit [Ping timeout: 246 seconds]
Vert has joined #ruby
djbender has joined #ruby
alien_move has joined #ruby
<alien_move>
hi
shevy has joined #ruby
<alien_move>
what's the difference between <%= and <% ?
Neo17 has joined #ruby
<sixtycakes>
<%= will execute and print the result
<sixtycakes>
<% just executes
brasten has quit [Quit: brasten]
Morkel has joined #ruby
bontaq has joined #ruby
djbender has quit [Client Quit]
<alien_move>
thanks sixtycakes
yoklov has joined #ruby
brasten has joined #ruby
otters has joined #ruby
tommyvYo has joined #ruby
tommyvYo has quit [Changing host]
tommyvYo has joined #ruby
psp250 has joined #ruby
psp250 has left #ruby ["Leaving"]
fabrice31 has quit [Remote host closed the connection]
poga has joined #ruby
A124 has joined #ruby
adamkittelson has joined #ruby
matled has quit [Quit: leaving]
A124 has quit [Client Quit]
matled has joined #ruby
jdripper has quit [Quit: Leaving.]
machty has quit [Ping timeout: 246 seconds]
zommi has quit [Quit: Leaving.]
jrajav has joined #ruby
t59202 has quit [Remote host closed the connection]
t36602 has joined #ruby
bowlowni_ has quit [Read error: Connection reset by peer]
bowlowni has joined #ruby
clocKwize has quit [Quit: clocKwize]
machty has joined #ruby
cirwin has joined #ruby
sendoushi has quit [Remote host closed the connection]
pricees has joined #ruby
ringotwo has joined #ruby
ibash has quit [Quit: ibash]
maletor has quit [Quit: Computer has gone to sleep.]
ananthakumaran has quit [Ping timeout: 240 seconds]
jasonLaster has quit [Remote host closed the connection]
codeFiend has quit [Quit: codeFiend]
jasonLaster has joined #ruby
stkowski has joined #ruby
ananthakumaran has joined #ruby
c00kiemonster is now known as codefriar
<eam>
naming convention for rubygems seems to be "clever and artsy" as opposed to "descriptive of function"
<davidcelis>
eam: You mean naming my BreweryDB wrapper "brewhouse" is a bad idea?
<rking>
eam: Hehe, well, it's better than CPAN where the good names get hogged by the first implementation, not the best implementation.
iamjarvo has joined #ruby
<codefriar>
using rspec, how can I test that a method throws an error when the results of a method it calls are X ?
<eam>
rking: always an issue, I agree
<Sou|cutter>
yeah, BreweryDBWrapper is the worst
<iamjarvo>
does a teardown method in a testhelper get called after each test
<davidcelis>
right? that's a shitty gem name
<rking>
Like "hpricot" then "nokogiri". I don't really need them to be more descriptive than that.
<iamjarvo>
or just after the suite
* davidcelis
sticks with Brewhouse
<eam>
not sure it's better though. I'd prefer "posix_spawn" over "spoon" for example
<rking>
codefriar: Mock then wrap in a lambda and assert that it throws.
<Hanmac>
"YetAnotherStupidLongName" ?
cirwin has quit [Ping timeout: 276 seconds]
codeFiend has joined #ruby
<Sou|cutter>
codefriar: lambda { someCode(X) }.should raise_error(ErrorType) or something
w400z has joined #ruby
adeponte has joined #ruby
jasonLaster has quit [Ping timeout: 246 seconds]
A124 has joined #ruby
<eam>
anyway I figure if I'm going to make gems I should embrace the community standards. I've been sitting around all morning with a thesaurus and thinking of puns
tewecske has joined #ruby
<Sou|cutter>
nobody's going to use your gem anyway, just pick whatever comes to your brain
<Sou|cutter>
and so the most popular gem ever with the stupidest name ever was born!
jasonLaster has joined #ruby
<codefriar>
I don't think I've ever used lambda
<davidcelis>
codefriar: how do you sleep at night
mahlon has joined #ruby
<rking>
eam: Aww, come on! posix_spawn vs spoon is a no-brainer. "Spoon" is like a "fork", and there's no need to spell out what is basically an incidental implementation detail in a gem that could be coded also in Win32.
<codefriar>
badly
artOfWar has joined #ruby
<limes>
`add_observer': observer needs to respond to `update' (NoMethodError) | who can help out telling me how to fix that ? http://pastebin.com/7M2NxV3U | line 27
jasonLaster has quit [Remote host closed the connection]
<rking>
codefriar: RSpec is using it in a particular kind of way, here. There are more general cases for it.
<eam>
rking: nah I think it's really harmful actually. I know what posix_spawn() is, but now I have to remember it's in this weirdass spoon module
jasonLaster has joined #ruby
<eam>
and I don't mean to pick on spoon, it's a prevalent issue
maletor has joined #ruby
<eam>
reinventing names for established things outside the ruby environment just makes for confusion imo
<rking>
eam: But it's not only a "posix_spawn" gem. It's more about prefork/postfork abstraction.
twigmorewelsh has quit [Ping timeout: 246 seconds]
<eam>
eh?
<rking>
No, I'm mixing it up. =D
<rking>
Kind of proving your point. =D
<eam>
see? !!
<iamjarvo>
the answer to my earlier question is it gets run after each tet if in ahelper file
<rking>
I was actually thinking of Spork.
<eam>
yeah
apok has joined #ruby
<eam>
name unrelated to function :
<eam>
:(
<canton7>
limes, given that line 27 is an 'end' statement, do you mean 26? :P
yoklov has quit [Quit: computer sleeping]
<rking>
eam: Naming is one of the two hard problems in computing.
* zeknox
is falling in love with nokogiri
<limes>
canton7: possible too :) but what does he want me to do ? just cant find nothing on the internet -.-
jrajav has quit []
<eam>
rking: it's just something I noticed as unique to the ruby community
<eam>
most other languages tend to use functionally descriptive identifiers
<canton7>
limes, your Dummy class needs to implement the function 'update', as the error says
<Sou|cutter>
nokogiri is alright, but for whatever reason (even after compiling a custom libxml) I can't seem to get encodings to work
<eam>
(for the most part, not as an absolute rule)
lolzie has joined #ruby
<canton7>
limes, sorry, wrong way around. In order for the websocket to be given as an observer to Dummer, which includes Observable, it needs to implement 'update'
<canton7>
s/Dummer/Sunny
koshii has joined #ruby
<limes>
canton7: and this is the point .. just dunno how what to put there... any ideas or code snippets to fixx ? :)
jarek has quit [Quit: jarek]
<canton7>
*Dummy. grr
<lolzie>
Hi guys: puts line.split(//).map { |x| x.downcase.tr('a-z', '1-26') }
<canton7>
limes, what are you trying to do?
jasonLaster has quit [Ping timeout: 260 seconds]
<lolzie>
Why does that not output the numerical position of each letter?
<koshii>
Hey guys, is the "@" character something that has to be escaped? When I add this to by ruby code: cmd = `ssh -o ConnectTimeout=120 root@` I get a wrong number of arguments error.
<koshii>
(it works fine without it)
<Sou|cutter>
it's really a libxml issue I suppose
<limes>
create upd server listening wich puts its received data to a websocket wich presents its data to an html page kind of an live ticker
<rking>
eam: The Ruby names are a unique balance of forces on that problem, yes, but I've not suffered for it, much. Very many of them are clever but clear if you know the origins.
<eam>
rking: that's my problem, I don't know the ruby origins -- only the generic platform features I want
<rking>
koshii: Shouldn't be, though technically that depends on the shell invoked.
<koshii>
rking: bash?
<eam>
koshii: appears you're missing a hostname
<koshii>
eam: That's on another line. I'm reading a list of hosts from a text file.
<rking>
How would it get sent to the shell invocation, then?
<lolzie>
haha
kenichi has quit [Remote host closed the connection]
<rking>
At least lolzie got some lulz out of the situation.
<koshii>
def ssh cmd = `etc` puts cmd end
<canton7>
limes, the problem being that you haven't written the code that tweels the WebSocket instance how to be an observer
<koshii>
then later, ssh line, with line being the current line from the list of hosts
<canton7>
s/tweels/tells
ananthakumaran has quit [Ping timeout: 272 seconds]
tiripamwe has quit [Ping timeout: 240 seconds]
<koshii>
Oh, does puts insert a carriage return?
w400z has quit [Quit: Computer has gone to sleep.]
<fowl>
yup
Takehiro has quit [Remote host closed the connection]
<rking>
koshii: I'm confused. Only the stuff in between ` and ` are going to go to the command invocation.
nilg has quit [Remote host closed the connection]
ephemerian has left #ruby [#ruby]
<lolzie>
rking: I'm not sure it's you that's confused
ananthakumaran has joined #ruby
<limes>
canton7: im quite new to all this an, got a working udp server und a working socket server but just cant figure out how to put them together :(
<koshii>
rking: Since I actually want to run that df -h on the servers (appending it to the SSH command-line string), do I really need a whole def for it, and does the way I have it structured make sense in that case?
macmartine has quit [Quit: Computer has gone to sleep.]
<rking>
koshii: Splitting out a method is good for basically two (?) things: composing into other methods, or communicating intent.
<rking>
For this one I think it communicates intent.
ly_gs has joined #ruby
<rking>
Replaces a comment with a method name.
Vert has quit [Read error: Connection reset by peer]
<rking>
No no, that du shouldn't happen in ``s, that'll execute it on localhost.
<koshii>
rking: Makes sense, but how can I pass my `df -h` to the other method command-line argument? Ruby is treating it like a separate local command.
<lolzie>
rking: that's an awesome lil wiki
<koshii>
Yeah that's what I thought.
<fowl>
use Net::SSH at least
<koshii>
fowl: I insist on learning more basic Ruby before I do this kind of stuff. :-)
<koshii>
fowl: These are kindergarden questions, I realize...
niklasb has quit [Ping timeout: 245 seconds]
miho has joined #ruby
t36602 has quit [Remote host closed the connection]
Criztian has joined #ruby
Bauer1 has quit [Ping timeout: 246 seconds]
azm has joined #ruby
azm has quit [Changing host]
azm has joined #ruby
t34155 has joined #ruby
<koshii>
rking: Do you see what I want to do? I want to setup separate definitions for several different kinds of server tests (let's say, disk free, uname -a and maybe mdadm status).
<koshii>
rking: I need pry for this script to work now?
<rking>
koshii: No, pry is a general Ruby-exploration thing for Neo-like people.
<koshii>
:-)
<koshii>
I see I see
<rking>
? ''.chomp # blue pill
<rking>
$ ''.chomp # blue pill
<fowl>
rking: 5k337lord
<koshii>
Installing :-)
<rking>
Urr, s/blue/red on that 2nd one.
<koshii>
Wow that's a lot of gems being installed.
mmitchell has joined #ruby
<rking>
That's pry-full doin its thang. Don't let it alarm you.
nirix has quit [Quit: Computer has gone to s…zZzZz]
fearoffish has joined #ruby
<koshii>
Handy though!
<koshii>
Is this a suitable replacement for RDoc and ri and these things that are annoying when I'm installing gems?
fyolnish has joined #ruby
Jay_Levitt has joined #ruby
<koshii>
rking: Why did you puts with `echo ...` ?
<rking>
koshii: Haha, because I was testing.
<rking>
No echo on the real version.
<koshii>
OK :)
<rking>
Though actually I advocate echo before any real command execution.
<koshii>
It's a good idea
<rking>
Same goes for shel for n in *; do echo ___; done
<fowl>
rking: do you know the diff between ``, %x[] and system()
a_a_g has joined #ruby
jso has quit []
<rking>
fowl: I thought `` == %x[], other than the delimiters.
<rking>
But I was also assuming there was some other motivation for the ``s, but probably that's silly of me to assume.
insecurlex has quit [Remote host closed the connection]
<koshii>
rking: Can you explain your crazy regex here? puts "server: \e[32m#{server}\e[0m"
<fowl>
\[Xm is color codes
<fowl>
\e
<rking>
koshii: I don't know if it's a replacement for RDoc/ri in every sense — it's certainly how I interface the documentation, though.
<rking>
koshii: Hehe, yeah, just splashin in some color.
<apeiros_>
koshii: not a regex
voodoofish430 has joined #ruby
<rking>
"Color is the 3rd dimension of your monitor, after X and Y."
<koshii>
:-)
<koshii>
Looks and works great
cirwin has joined #ruby
mmitchell has quit [Ping timeout: 276 seconds]
<limes>
also PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W $(if [[ $? = 0 ]];then echo "\[\033[01;34m\]";else echo "\[\033[01;31m\]";fi)\$\[\033[00m\] ' is quite handy for your console to show true or false in different colors :D
Eldariof-ru has joined #ruby
ilyam has joined #ruby
<Yiq>
is ruby on rails the "only" used framework in ruby?
fyolnish has quit [Ping timeout: 260 seconds]
<koshii>
Bloody hell you guys are wizards.
<fowl>
Yiq: yes, rails IS ruby and ruby IS rails, they are one in the same.
sepp2k has quit [Remote host closed the connection]
<canton7>
Yiq, sinatra and camping are also popular
mmitchell has joined #ruby
<Hanmac>
Yiq: depending what you understand with "framework"
<fowl>
come on #ruby you're suffering from delusions! there is none other than the Mighty Rails
shadoi has joined #ruby
<koshii>
rking: Are those color codes exclusive to Ruby or is that something that will work equally well in bash scripts?
<Mon_Ouie>
koshii: They're a convention followed by many terminals
<davidcelis>
canton7: camping has too many project sites, IMO
<canton7>
davidcelis, i've never been a particular fan of it personally
<Mon_Ouie>
Called ANSI codes if you want to look them up
<koshii>
Great.
<koshii>
Mon_Ouie: Thanks
<rking>
koshii: Works equally well when output to any decently-capable terminal (meaning Windows "cmd" doesn't make the cut). The only trick is somehow outputting the Esc char, which echo "\e[33mfoo\e[0m" will in fact do from bash, but not from other shells.
machuga|away is now known as machuga
<rking>
koshii: There are color gems that are better (in that they're cleaner to read and also work in more situations. Really what you want to do, in general, is test if the output stream is_tty? before you start spewing escape codes)
<koshii>
rking: Duly noted then, thanks.
<rking>
Mon_Ouie: What enables %F{___} ?
<Mon_Ouie>
I don't know exactly, I know I use them in my prompt
insecurlex has joined #ruby
<Mon_Ouie>
autoload colors; colors I assume
Takehiro has joined #ruby
insecurlex has quit [Remote host closed the connection]
Yiq has left #ruby [#ruby]
<koshii>
rking: And what if I want to suppress some lines, like I don't really care about udev and tmpfs results from df -h; do I do that with Ruby or with sed?
<rking>
Mon_Ouie: Hrm. That isn't it. But I'll find out.
a_a_g has quit [Ping timeout: 240 seconds]
<rking>
koshii: Definitely ruby! =D
<koshii>
Heh
<rking>
There are several options about how you can structure your code for that. You could simply just do a substitution to get rid of those lines even from commands that don't have them, but that's kind of an "expedient" thing to do.
<koshii>
rking: OK, but it isn't really helpful to check for and strip those out for uname and uptime and mdadm etc
<rking>
Right
<koshii>
:-) What you said, I guess.
<rking>
I gotta go for now, but you're on the right track.
<koshii>
OK
<koshii>
Thanks rking!
<rking>
The reason I'm anti-sed in this case is that it's involving another language, which requires readers of the code to understand more languages, and requires the writer of the code to better escape delimiters and stuff.
<rking>
Playing "How many backslashes do I need" Plinko isn't always fun.
<koshii>
Yeah, I'm not a fan of the idea either, I'm just not sure how I can separate this out since you have it setup in an array.
bradhe has joined #ruby
kpshek has joined #ruby
brianpWins has quit [Quit: brianpWins]
<koshii>
Ideally I want small output that I can (eventually) pipe to XMPP
insecurlex has joined #ruby
<koshii>
So probably I need to cut down a lot of this. Some of which I can do by adjusting the actual commands, some of which I guess I'm going to have to RegEx the hell out of.
<koshii>
For now, the color codes can stay. ;-)
headius has quit [Quit: headius]
br4ndon has joined #ruby
chussenot has quit [Ping timeout: 246 seconds]
t34155 has quit [Remote host closed the connection]
t17958 has joined #ruby
pdtpatrick has joined #ruby
opus__ has joined #ruby
w400z has quit [Quit: Computer has gone to sleep.]
CoverSlide has joined #ruby
insecurlex has quit [Remote host closed the connection]
berserkr has quit [Ping timeout: 252 seconds]
jgrevich has joined #ruby
Tomasso has quit [Ping timeout: 268 seconds]
mmitchel_ has joined #ruby
gloomer has joined #ruby
khakimov has joined #ruby
mmitchell has quit [Ping timeout: 246 seconds]
bradhe has quit [Remote host closed the connection]
ilyam has quit [Quit: ilyam]
phinfonet has joined #ruby
baphled has joined #ruby
mxbtty has joined #ruby
khakimov has quit [Client Quit]
jasonLaster has joined #ruby
virunga has quit [Remote host closed the connection]
xclite has quit [Remote host closed the connection]
ringotwo has quit [Read error: Connection reset by peer]
mikepack has quit [Remote host closed the connection]
ringotwo has joined #ruby
adac has quit [Ping timeout: 246 seconds]
jazz_ has joined #ruby
johnlcox_ has joined #ruby
gen0cide_ has joined #ruby
Synthead has quit [Read error: Operation timed out]
graft has quit [Quit: leaving]
jazz_ has left #ruby [#ruby]
xclite has joined #ruby
krz has joined #ruby
Synthead has joined #ruby
johnlcox has quit [Ping timeout: 260 seconds]
johnlcox_ is now known as johnlcox
t17958 has quit [Remote host closed the connection]
mikepack has joined #ruby
t82688 has joined #ruby
eric has joined #ruby
Guest24845 has joined #ruby
eric is now known as Guest3180
jasonLaster has quit [Ping timeout: 256 seconds]
Guest3180 has quit [Client Quit]
berserkr has joined #ruby
lurch_ has joined #ruby
Guest24845 is now known as ShadowBelmolve_
jjbohn|afk is now known as jjbohn
_bart has joined #ruby
brasten has quit [Quit: brasten]
mrdodo has joined #ruby
ShadowBelmolve_ has quit [Read error: Connection reset by peer]
theRoUS has quit [Ping timeout: 260 seconds]
ShadowBelmolve_ has joined #ruby
flargh2 has quit [Remote host closed the connection]
w400z has joined #ruby
chimkan___ has quit [Quit: chimkan___]
Bosma has joined #ruby
twigmorewelsh has quit [Ping timeout: 246 seconds]
jrajav has joined #ruby
ElderFain_ is now known as ElderFain
twigmorewelsh has joined #ruby
hoelzro|away is now known as hoelzro
Eiam has joined #ruby
elaptics is now known as elaptics`away
jonathanwallace has quit [Remote host closed the connection]
adac has joined #ruby
Danielpk has joined #ruby
adeponte has quit [Remote host closed the connection]
Criztian_ has joined #ruby
<Danielpk>
i trying to run mailcatcher with PHP but i getting one error when i try to send email: http://pastebin.com/u82YwLgm
<Danielpk>
any1 know how i can fix it?
sailias has quit [Quit: Leaving.]
<davidcelis>
with... PHP?
<cirwin>
Danielpk: gem install mailcatcher
<Danielpk>
cirwin: i did it
flak has joined #ruby
Criztian has quit [Ping timeout: 244 seconds]
<Danielpk>
when i run with my user work fine, but when apache try to run i get this error.
<Mon_Ouie>
That message says the gem isn't installed and shows installed gems
flak is now known as Guest28365
<cirwin>
Danielpk: are you using rvm or something like that?
<cirwin>
you need to install the gem so that apache can access it
<Mon_Ouie>
Yes, if you install a gem only for a single user and not in a system-wide directory, it can obviously only be accessed by that specific user
SCommette has quit [Quit: SCommette]
joephlius has joined #ruby
t82688 has quit [Remote host closed the connection]
jorge_ has joined #ruby
SCommette has joined #ruby
t72746 has joined #ruby
<Danielpk>
i using rvm.. but when i su www-data and try to run mail catcher all work fine… just when i try to run with php i get this error.
rippa has quit [Ping timeout: 248 seconds]
chimkan has joined #ruby
SCommette has quit [Client Quit]
theRoUS has joined #ruby
arooni-mobile has joined #ruby
Godslastering has joined #ruby
hadees has quit [Read error: Connection reset by peer]
joephelius has quit [Ping timeout: 240 seconds]
jso has joined #ruby
xclite has quit [Remote host closed the connection]
hadees has joined #ruby
wallerdev has joined #ruby
virunga has joined #ruby
Guest28365 is now known as rippa
CannedCorn has joined #ruby
havenn_ has quit [Remote host closed the connection]
kirun has joined #ruby
pskosinski has quit [Read error: Connection reset by peer]
jarred has joined #ruby
jarred has quit [Read error: Connection reset by peer]
axl_ has quit [Remote host closed the connection]
jarred has joined #ruby
axl_ has joined #ruby
ilyam has joined #ruby
ananthakumaran has quit [Ping timeout: 264 seconds]
ananthakumaran has joined #ruby
<arooni-mobile>
if i have a instance variables for a given class... should they all be declared within the class's constructor method, or can i declare them within the instance methods when i need them?
machty has quit [Ping timeout: 246 seconds]
<Mon_Ouie>
Don't cross post
elaptics`away is now known as elaptics
<Mon_Ouie>
Especially when you've already been given an answer which you've ignored
burgestrand has joined #ruby
<arooni-mobile>
Mon_Ouie, i waited 5-10 minutes between posts
<arooni-mobile>
no one addressed it to me
<arooni-mobile>
i..e @arooni-mobile; so i didnt know if someone responded
<Mon_Ouie>
I answered on #ruby-lang one minute after you asked your question…
<arooni-mobile>
ok i see thta now
jorge_ has quit [Remote host closed the connection]
<arooni-mobile>
my apologies... i usually am used to folks addressing the asker via username
twigmorewelsh has quit [Ping timeout: 246 seconds]
h4mz1d has joined #ruby
tiripamwe has quit [Ping timeout: 244 seconds]
Russell^^ has joined #ruby
tayy has joined #ruby
darren has joined #ruby
mmitchel_ has quit [Remote host closed the connection]
mmitchell has joined #ruby
fantazo has quit [Remote host closed the connection]
wo66le is now known as nickyhof
enricostn has left #ruby [#ruby]
reactormonk has quit [Ping timeout: 240 seconds]
kpshek has quit []
paolooo has quit [Ping timeout: 245 seconds]
chussenot has joined #ruby
SCommette has joined #ruby
bluethud9765 has joined #ruby
reactormonk has joined #ruby
matrixise has joined #ruby
niklasb has quit [Ping timeout: 260 seconds]
uris_ has quit [Ping timeout: 246 seconds]
imami|afk is now known as banseljaj
lurch_ has left #ruby [#ruby]
berserkr has quit [Quit: Leaving.]
yosinof has quit [Quit: Leaving]
Taichouchou2 has quit [Remote host closed the connection]
Eldariof27-ru has quit [Ping timeout: 260 seconds]
luckyruby has quit [Remote host closed the connection]
mwilson has quit [Excess Flood]
ben225 has joined #ruby
mwilson has joined #ruby
anoldhacker has left #ruby ["No matter how dark the night, somehow the Sun rises once again"]
jcromartie has joined #ruby
<scant>
when i call Class.methods(false) and Class.singleton_methods, i get different results. but isn't methods returning all of the singleton_methods defined for the Class class?
w400z has quit []
beneggett has quit [Ping timeout: 264 seconds]
ben225 is now known as beneggett
pdelgallego has joined #ruby
pdelgallego has quit [Read error: Connection reset by peer]
<apeiros_>
scant: methods(false) returns all methods defined on Class' own singleton class
x77686d has quit [Client Quit]
<apeiros_>
singleton_methods returns those in Class' singleton class' ancestry too
<Mon_Ouie>
I'd say jrajav should change the bot for that
<apeiros_>
agreed
<ged>
scant: From object.c? Where do you mean "where does [it] get its method from?"
<apeiros_>
max output of ~200 chars
<Mon_Ouie>
scant: those are the methods you can call on BasicObject itself
<Mon_Ouie>
Not on its instances
<scant>
>> BasicObject.methods false
<al2o3cr>
(Array) []
<Mon_Ouie>
And since BasicObject doesn't have any so-called class methods, methods(false) is empty
<scant>
what are these methods if they aren't class methods?
chrisja has quit [Quit: leaving]
<ged>
Instance methods of its singleton.
w400z has joined #ruby
<scant>
so they are singleton methods?
<ged>
Yes.
<Mon_Ouie>
No
<scant>
>> BasicObject.singleton_methods
<al2o3cr>
(Array) []
<Mon_Ouie>
BasicObject doesn't have any of these
<Mon_Ouie>
It gets some methods from Class, Module and Object though
<Mon_Ouie>
In virtue of being an instance of Class
<scant>
ohh i see
<scant>
smh
<scant>
thanks for the help
mrdodo has joined #ruby
<fowl>
scant: mon ouie is wise, he's been rewriting his brain in ruby 2.0
mascool has joined #ruby
CannedCorn has quit [Quit: Computer has gone to sleep.]
<scant>
XD
levieraf has joined #ruby
ringotwo has quit [Read error: Connection reset by peer]
<levieraf>
hi guys
<levieraf>
i have a question
Dreamer3 has joined #ruby
<levieraf>
about oop with ruby
ringotwo has joined #ruby
<cirwin>
levieraf: the suspense
<levieraf>
how i can implementation a interface in ruby
kpshek has joined #ruby
<ged>
Mon_Ouie: The "so-called class methods" that it *doesn't* have would be singleton methods, yes?
kristopolous has left #ruby ["Leaving"]
<cirwin>
levieraf: you just define the same methods on all the subclasses
<levieraf>
how i can implement a interface in ruby
MasterIdler_ has joined #ruby
<levieraf>
sorry
s0ber_ has joined #ruby
<levieraf>
cirwin, for example?
[MAN] has joined #ruby
<Mon_Ouie>
ged: Yeah
jbw has joined #ruby
<cirwin>
class A; def do_foo; end; end
<cirwin>
class B; def do_foo; end; end
ananthakumaran has quit [Quit: Leaving.]
imami|afk is now known as banseljaj
<cirwin>
if you really want to make the interface explicit you could define: class Base; def do_foo; raise NotImplementedError; end; end
<cirwin>
and then class A < Base; end
t30944 has quit [Remote host closed the connection]
<cirwin>
but you don't need to
<ged>
levieraf: You can put methods that raise NotImplementedError in a Module, then mix that in to classes whose interface you wish to enforce.
t75588 has joined #ruby
chare has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
s0ber has quit [Ping timeout: 252 seconds]
<burgestrand>
Even then you usually don’t do that, because a NoMethodError or NotImplementedError usually does not matter which.
s0ber_ is now known as s0ber
<ged>
Yep.
<levieraf>
cirwin, ged i need create: Create an interface Electric that has the methods IsCharged and Charge. IsCharged should return false unless Charge has been called
<burgestrand>
Interfaces would mostly be useful if ruby cared about types.
<Mon_Ouie>
Defining a blank method in a module could actually screw things up in some cases
<levieraf>
I know in php java
<levieraf>
but
scant has quit [Ping timeout: 240 seconds]
<levieraf>
in ruby
<Mon_Ouie>
If the method is already implemented in a superclass of the class including the module
<levieraf>
I am new to ruby
<ged>
Also true.
vegeek-ng has joined #ruby
<burgestrand>
levieraf: why do you need to use an interface for that?
mmitchell has quit [Remote host closed the connection]
<levieraf>
is a practice for me
mmitchell has joined #ruby
<levieraf>
burgestrand, is a practice for me
<Hanmac>
levieraf imo ruby Mixins/(an usecase of Module) are very more better then php's interfaces
azm has quit [Ping timeout: 248 seconds]
<Mon_Ouie>
Don't try enforcing practices coming from other languages on Ruby
mxbtty has joined #ruby
mistergibson has quit [Remote host closed the connection]
<Mon_Ouie>
(Actually, that applies for pretty much all languages; they all have their own idioms)
<levieraf>
my question is
<levieraf>
in ruby
<levieraf>
the interfaces
<levieraf>
they're not how java for example?
<Hanmac>
levieraf look at Enumerable ... all the methods only depend on an "each" method, or more easy look at Comparable
crazed has quit [Read error: Connection reset by peer]
<Mon_Ouie>
Yeah, suspense adds to the thrill in a movie but on IRC… the thrill you get from wondering what verb someone is going to use is much smaller :p
resure__ has quit [Remote host closed the connection]
<apeiros_>
levieraf: you can write a whole sentence on a single line in irc, you know?
<Mon_Ouie>
Ruby doesn't have a concept of interfaces
<Hanmac>
imo the ruby way it MORE better
<voodoofish430>
modules come close to interfaces
<levieraf>
apeiros_, thanks
<Mon_Ouie>
It has classes and mixins; sometimes a class that includes a module is expected to accept a certain interface.
fasta_ has quit [Remote host closed the connection]
fasta has joined #ruby
rippa has quit [Ping timeout: 260 seconds]
Dreamer3 has quit [Quit: Leaving...]
<Mon_Ouie>
For instance, a class that includes Comparable is expected to implement the <=> method to compare objects
<Hanmac>
as far as i knew, in php interfaces cant have methods with a body ... imo thats very shitty
<levieraf>
Mon_Ouie, thanks man
<levieraf>
so
beneggett has quit [Quit: Computer has gone to sleep.]
chussenot has quit [Quit: chussenot]
yxhuvud has quit [Ping timeout: 252 seconds]
fmcgeough has quit [Quit: fmcgeough]
twigmorewelsh has quit [Ping timeout: 276 seconds]
Dreamer3 has joined #ruby
<levieraf>
if need create a interface called Electric and them need have two methos called IsCharged and Charge.
beneggett has joined #ruby
<levieraf>
sorry guys
<apeiros_>
levieraf: ruby doesn't have Java style interfaces
<apeiros_>
a module doesn't enforce certain methods to be present
<levieraf>
apeiros_, like you would create this
<apeiros_>
levieraf: don't apply idioms of other languages
<apeiros_>
solve problems and ask for how to do it idiomatically in this language
<apeiros_>
i.e., ask for how to solve a *problem*, not for how to *translate a solution*
Dreamer3 has quit [Client Quit]
<Mon_Ouie>
If you're trying to make exercises to practice Ruby, don't add requirements about the class structure or method names; finding those is pretty much solving the exercise in practice.
<levieraf>
apeiros_, ok, how to solve a problem?
und3f has joined #ruby
carloslopes has quit [Quit: Leaving.]
<apeiros_>
o0
h4mz1d has quit [Ping timeout: 246 seconds]
<Mon_Ouie>
Just set yourself practical goal about what your program should do, like parsing a BMP file or connecting IRC and responding to commands, etc.
qwerxy has quit [Quit: offski]
asteve has quit []
<apeiros_>
levieraf: you'll have to formulate/phrase out your problem…
carloslopes has joined #ruby
JoshLambert has quit [Quit: Page closed]
chessguy has quit [Remote host closed the connection]
pdelgallego has quit [Quit: pdelgallego]
Dreamer3 has joined #ruby
Dreamer3 has quit [Remote host closed the connection]
carloslopes has quit [Read error: Connection reset by peer]
jrist_ has joined #ruby
luist has joined #ruby
jrist has quit [Read error: Connection reset by peer]
opus__ has quit [Quit:]
x77686d has joined #ruby
chessguy has joined #ruby
<luist>
hey guys…. im trying to run: cd /var/www/git.myproject.com.br/gitorious/ && bundle install but i'm getting Could not locate Gemfile
<luist>
can anyone help me?
beneggett has quit [Ping timeout: 276 seconds]
jeff_sebring has joined #ruby
<levieraf>
well
<apeiros_>
luist: sounds like there's no Gemfile in /var/www/git.myproject.com.br/gitorious/…
<levieraf>
thanks guys
* apeiros_
puts on captain obvious hat
<luist>
apeiros_: i run gem install bundler … is that right?
carloslopes has joined #ruby
<Mon_Ouie>
That's what gives you the bundle command
chessguy has quit [Remote host closed the connection]
<Mon_Ouie>
But you still need to create the Gemfile to use it
<apeiros_>
the Gemfile must be supplied by your project. in your case I'd assume that the project is gitorious
<apeiros_>
(of course, you didn't tell… so all I have is your path…)
<Mon_Ouie>
I'd have thought it was myproject.com, which is hosted on gitorious
justinmcp has joined #ruby
beneggett has joined #ruby
johnlcox_ has joined #ruby
<apeiros_>
there we go about assumptions and why making the people who help you making assumptions is BAD
<al2o3cr>
-e:1:in `eval': (eval):1: unknown regexp options - kgr (SyntaxError), (eval):1: syntax error, unexpected keyword_for, expecting $end, ...ls/installing_nokogiri.html for help with installing depende..., ... ^, from -e:1:in `<main>'
<apeiros_>
gah
hubub has joined #ruby
* apeiros_
smacks al2o3cr
* apeiros_
needs a new way to quote
<luist>
apeiros_: where is the mkmf.log :T
<apeiros_>
you don't need that
<apeiros_>
the relevant line is the one I just pasted.
<apeiros_>
luist: when you get an error, always read all of it. and really read it. it's hard the first few times.
<apeiros_>
but you get used to it. often the relevant bits are in the message. sometimes more obvious, sometimes less. but the more often you actually do read those messages, the easier you will spot the relevant part.
jrist_ is now known as jrist
<Muz>
When you get help, listen to it. And really listen to it. It's hard the first few times.
hadees has joined #ruby
<Hanmac>
xD
paulovittor23 has quit [Remote host closed the connection]
<luist>
apeiros_: ah ok… was trying to find what package contained libxslt
<luist>
apeiros_: found out
<Hanmac>
PS: you need the -dev package too for building
[MAN] has quit [Quit: Leaving...]
Dreamer3 has joined #ruby
jenrzzz has joined #ruby
<luist>
thats the one that i installed :)
und3f has quit [Quit: Leaving.]
robustus has quit [Ping timeout: 244 seconds]
GoGoGarrett has quit [Remote host closed the connection]
stat1x has joined #ruby
<Hanmac>
but why do you use an nearly outdated ruby?
<apeiros_>
because that's the only thing that could change image to nil right in between. it'd also need to be threaded…
mmitchell has joined #ruby
wvms has joined #ruby
<apeiros_>
otherwise the only other option is that not all code is there.
jrist has quit [Ping timeout: 245 seconds]
<apeiros_>
oh, robacarp, what does `defined?(image)` print?
<robacarp>
apeiros_: there is a pty block above, but the code isn't threaded
workmad3 has joined #ruby
<apeiros_>
put it after line 5 please
mwilson has quit [Excess Flood]
mwilson has joined #ruby
<robacarp>
apeiros_: image
<robacarp>
er...dammit...
<robacarp>
"method"
t75588 has quit [Remote host closed the connection]
stat1x has quit [Ping timeout: 260 seconds]
<apeiros_>
ok. image is not a variable…
<apeiros_>
you've got your answer then.
t31597 has joined #ruby
<apeiros_>
that method for some reason once returns an image, once nil. your bug is there.
banseljaj has quit [Ping timeout: 252 seconds]
rclark has joined #ruby
rclark has quit [Client Quit]
<robacarp>
something does not follow
machty has joined #ruby
sixtycakes has quit [Remote host closed the connection]
adeponte has joined #ruby
<apeiros_>
robacarp: ?
<apeiros_>
care to paste the image method?
ryanf has joined #ruby
banseljaj has joined #ruby
<robacarp>
its not a method I've defined, its an activerecord relation
dbck has quit [Quit: Be back later]
mmitchell has quit [Remote host closed the connection]
<robacarp>
this construct works sanely in other places
mmitchell has joined #ruby
<Hanmac>
activerecord? the evil spawn of rails?
luist has quit [Quit: luist]
answer_421 has quit [Quit: WeeChat 0.3.8]
justinmcp has quit [Remote host closed the connection]
TheShadowFog has joined #ruby
wedgeV has quit [Quit: wedgeV]
<robacarp>
okay, I don't really understand _why_ this fixes it, but prefixing every instance of image with self. fixes it.
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
invisime has joined #ruby
<robacarp>
which means it was some sort of scope issue.
<robacarp>
I can't really comprehend why or how the scope of image was getting overridden lower on the chain, but whatever.
bbttxu has quit [Quit: bbttxu]
arooni-mobile has quit [Ping timeout: 240 seconds]
Taichouchou2 has joined #ruby
Z_Mass has joined #ruby
tommyvYo has joined #ruby
tommyvYo has quit [Changing host]
tommyvYo has joined #ruby
<laen_>
Dude, no! You're going to destroy the skyscraper!
<laen_>
er..
gfontenot has quit []
<laen_>
Sorry, wrong window.
codeFiend has joined #ruby
<Hanmac>
robacarp you itself destroy the scope
<robacarp>
apeiros_: thanks for looking
reactormonk has quit [Ping timeout: 260 seconds]
<invisime>
so I'm having trouble with a nil value from a json parameter when it really is there: http://pastebin.com/9nGfqnPT am I missing something really obvious?
<Hanmac>
robacarp: your "image = Image.new" is the evil
Dreamer3 has joined #ruby
Taichouchou2 has quit [Ping timeout: 245 seconds]
reactormonk has joined #ruby
arooni-mobile has joined #ruby
joshman_ has quit [Ping timeout: 264 seconds]
athit has quit [Quit: leaving]
<adeponte>
Axsuul: hey, if you are interested just want to let you know that I finished the rewrite, added some fullstack tests and things seem to be working now. https://github.com/realpractice/wrap_in_module
alanp has joined #ruby
alanp has quit [Read error: Connection reset by peer]
sixtycakes has joined #ruby
<robacarp>
Hanmac: yes, I'm starting to see that, but I don't really understand why that destroys the scope when that line shouldn't be getting called
alanp has joined #ruby
<Hanmac>
yeah ... but ruby does get prepared that now a local variable may exist
SubliminalSquee has joined #ruby
<robacarp>
which doesn't seem like rational behavior
<koshii>
This channel is about to get crazy annoying isn't it :-)
<apeiros_>
savage-, Hanmac, stop flooding
<savage->
sorry
mneorr has quit [Quit: Leaving.]
<erikwb>
>> "what"
<al2o3cr>
(String) "what"
<savage->
stop it
<savage->
do not abuse the bot.
mmitchell has quit [Remote host closed the connection]
arooni-mobile has quit [Ping timeout: 276 seconds]
<robacarp>
apeiros_: yea, I was just discussing that if I change that to self.image, it stops breaking
<koshii>
:-P
<erikwb>
get that thing out of here :)
<apeiros_>
robacarp: yes, and I think I know why
sixtycakes has quit [Remote host closed the connection]
mmitchell has joined #ruby
<Hanmac>
robacarp ... i think you need "self.image =" currect?
<apeiros_>
if commenting out line 9 removes the issue too (without all the `self.`s), then I know the reason
johnlcox has joined #ruby
<robacarp>
ruby seems to lookahead and create local scope given the contents of the if-blocks regardless of which will execute.
<robacarp>
a sort of branch prediction.
<apeiros_>
yes. you create an lvar image
<apeiros_>
which shadows your method image
<Mon_Ouie>
if blocks don't create a new scope
chare has quit [Ping timeout: 260 seconds]
<Mon_Ouie>
statements* rather
<apeiros_>
the moment when that actually happens is odd
<apeiros_>
which is why I didn't consider it
<apeiros_>
but it most certainly is the reason
vlad__ has joined #ruby
<apeiros_>
in short: you do not need all those selfs. but you must not shadow the image method
<erikwb>
>> 100000.times { puts "evalbots in irc are a really bad idea" }
<al2o3cr>
(Fixnum) 100000, Console: evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in irc are a really bad idea, evalbots in...
<vlad__>
>> `id`
<al2o3cr>
-e:1:in `eval': No such file or directory - id (Errno::ENOENT), from (eval):1:in `<main>', from -e:1:in `eval', from -e:1:in `<main>'
erikwb was kicked from #ruby by apeiros_ [I said don't]
beneggett has quit [Ping timeout: 240 seconds]
<vlad__>
>> system("id")
<al2o3cr>
(NilClass) nil
erikwb has joined #ruby
<Muz>
You can PM the bot.
<Muz>
By which I mean, you can be irritating somewhere we don't have to see it.
<apeiros_>
if you guys can't use that bot responsibly in channel then he gets muted.
<eam>
this is a terrible idea
gurps has quit [Quit: bye]
<Muz>
You can be unoriginal in private too, and try to break it through means mostly tried and patched.
<Hanmac>
vlad__: there very few binaries
<Hanmac>
>> Dir["usr/bin/*"]
theRoUS has quit [Ping timeout: 260 seconds]
glistle has quit [Remote host closed the connection]
<Hanmac>
>> Dir["usr/bin/*"]
<Muz>
Hanmac: the bot's been muted from the channel.
Foxandxss has joined #ruby
gurps has joined #ruby
vlad__ has quit [Client Quit]
<Hanmac>
;'(
wpaulson has joined #ruby
<invisime>
Muz: like a boss^h^h^h^h mod
<erikwb>
lollin so hard
<otters>
"like a mod"
<otters>
sloppy
<rking>
otters + =1
<robacarp>
apeiros_: well, yea, I'm only selfing the one assignment statement. Thanks again for looking.
<apeiros_>
yw
ssspiff has joined #ruby
ssspiff has joined #ruby
ssspiff has quit [Changing host]
sspiff has quit [Ping timeout: 246 seconds]
matrixise has joined #ruby
RubyPanther has joined #ruby
* robacarp
sighs, goes to fight coworkers with nerf darts
ilyam has quit [Remote host closed the connection]
ilyam has joined #ruby
xaxxon has joined #ruby
jords has quit [Ping timeout: 245 seconds]
qwerxy has joined #ruby
riley526 has joined #ruby
iamjarvo has joined #ruby
stkowski has quit [Quit: stkowski]
dpk has quit [Quit: Asleep at the keyboard.]
pdelgallego has quit [Quit: pdelgallego]
Chryson_ has joined #ruby
internet_user has quit [Remote host closed the connection]
mwilson has quit [Excess Flood]
mwilson has joined #ruby
alphabitcity has quit [Quit: Leaving.]
davidcelis has joined #ruby
potatosalad has joined #ruby
pdelgallego has joined #ruby
nateberkopec has quit [Quit: Leaving...]
stopbit has quit [Quit: Leaving]
<potatosalad>
Does anyone happen to know why this works in Ruby 1.9.3-p194?
<potatosalad>
true if []...what-the-heck?
hadees has quit [Quit: hadees]
apok_ has joined #ruby
luxurymode has quit [Quit: Computer has gone to sleep.]
kpshek has quit []
tfitts has quit [Ping timeout: 265 seconds]
pdelgallego has quit [Client Quit]
xclite has quit [Remote host closed the connection]
<potatosalad>
also, 'why does this work?' if BasicObject...what?
<apeiros_>
potatosalad: what do you consider "work" there?
<apeiros_>
and why should it "not work"?
<apeiros_>
[] is a true-ish value in ruby
ibash has joined #ruby
<apeiros_>
so is *everything* except false/nil
apok has quit [Ping timeout: 265 seconds]
apok_ is now known as apok
<potatosalad>
right, but why am I allowed to do []...what-the-heck?
levieraf has quit [Remote host closed the connection]
<fowl>
what-the-heck!
<potatosalad>
exactly
<apeiros_>
I don't get your issue
t14598 has quit [Remote host closed the connection]
verto is now known as verto|off
<apeiros_>
[] is an empty array
<potatosalad>
try it outside the if statement
<potatosalad>
[] doesn't matter
<potatosalad>
you can use whatever you want
t97547 has joined #ruby
<potatosalad>
true if (BasicObject...non-existant-method)
<fowl>
thanks potatosalad you gave me a lul, and i'll never forget you for that
gen0cide_ has quit [Quit: Computer has gone to sleep.]
<apeiros_>
potatosalad: doesn't apply
<potatosalad>
I'm curious if that's a ruby bug or intended, if it's intended I'd like to know why it works
<apeiros_>
$ ruby -e 'p "hi" if BasicObject.foobar'
<apeiros_>
-e:1:in `<main>': undefined method `foobar' for BasicObject:Class (NoMethodError)
<potatosalad>
right, do multiple dots
<apeiros_>
that'd be a range…
gen0cide_ has joined #ruby
<potatosalad>
yup, and why does it not evaluate the right hand side of that range?
<apeiros_>
and it'd seem that ruby shortcuts to not even evaluate the range
<apeiros_>
probably all it sees is "literal which is not nil/false - conditions met"
<apeiros_>
it doesn't need to evaluate it
<Hanmac>
>> true if []...what-the-heck?# works
<Hanmac>
>> true if []..what-the-heck? #works not
<potatosalad>
yeah, what's the difference between the two?
<apeiros_>
that's interesting
<fowl>
well take a what-the-heck and push it up your callstacks
shiki has quit [Ping timeout: 264 seconds]
mwilson has quit [Excess Flood]
<apeiros_>
ah, .. can be a flip-flop too
mwilson has joined #ruby
<potatosalad>
where are the differences in .. and ... documented?
<apeiros_>
might be due to that
<apeiros_>
potatosalad: a..b is range including b, a...b is range excluding b
<apeiros_>
and flip-flop… google 'ruby flip-flop'
<potatosalad>
aperios_: thanks, I couldn't remember the difference
shiki has joined #ruby
<apeiros_>
potatosalad: also, use tab-completion. less embarrassing :-p
<apeiros_>
(for nicks)
<apeiros_>
the docs on range: ri Range
<apeiros_>
(documents .. and ... literals)
hsbt is now known as hsbt_away
bowlowni has quit [Remote host closed the connection]
mmitchell has quit [Remote host closed the connection]
mmitchell has joined #ruby
hemanth has quit [Ping timeout: 260 seconds]
SCommette has quit [Quit: SCommette]
w400z has quit []
<potatosalad>
apeiros_: weird, thanks for the flip flop suggestion (and the tab suggestion)
<Hanmac>
apeiros_ when you activate the bot again i can show you what happend
<eam>
Hanmac: you don't understand what sandboxing entails
<shevy>
did eam kill the bot already
johnlcox has quit [Ping timeout: 268 seconds]
Synthead has quit [Quit: p33 ba115]
<shevy>
hmm looks like a bug
vitor-br has quit [Ping timeout: 276 seconds]
fridim_ has quit [Ping timeout: 246 seconds]
<Hanmac>
eam and you dont understand how the bot has changed since Mon and i are involved?
<eam>
I do
<eam>
and you don't understand that there are countless other exploits
<eam>
I'm not sharing nearly all of the tricks
<eam>
but what I'm telling you, as someone who clearly has more domain experience, is that your bot is exploitable and likely will continue to be for a long time
specialGuest has joined #ruby
<eam>
I can still initiate network connections from it
specialGuest has quit [Changing host]
specialGuest has joined #ruby
<eam>
so just be aware
fridim_ has joined #ruby
tds has joined #ruby
<eam>
my main objection is that the bot's presence detracts from the discussion, btw
<eam>
no amount of reactionary patching will address that
<tds>
what's the cleanest way to make a class method also an instance method?
neersighted has joined #ruby
ilyam_ has joined #ruby
<shevy>
eam show us a trick!
<eam>
I've already shown them several
<apeiros_>
tds: module_function. but goes the other way round.
<apeiros_>
00:54 eam: my main objection is that the bot's presence detracts from the discussion, btw
enroxorz has joined #ruby
enroxorz has quit [Changing host]
enroxorz has joined #ruby
<Hanmac>
eam yeah the bot was sandboxed before ... but when you try to make it save it loses MANY features you could need from ruby
<tds>
apeiros_: i don't think module_function will work in the context of a class though?
<apeiros_>
of which eam is totally unblamable himself :-p
<apeiros_>
tds: sure does. Class is a subclass of Module
sebicas has quit [Quit: sebicas]
<shevy>
tds well. class Foo; def self.test; Foo.new.test; end; def test; puts 'Hi there; end; end Foo.test
<shevy>
forgot a '
CannedCorn has joined #ruby
ilyam has quit [Ping timeout: 246 seconds]
ilyam_ is now known as ilyam
<tds>
apeiros_: I know that it is, but I tried that earlier, and it doesn't work for some reason
<tds>
I get: "NoMethodError: undefined method `module_function' for A:Class"
cherrypeel has joined #ruby
kirun has quit [Quit: Client exiting]
lukekhamilton has quit [Read error: Connection reset by peer]
<tds>
shevy: it involves setting an instance variable either on the class or on the instance, so context is important
<apeiros_>
tds: hm, seems like it is indeed actively removed from Class
<apeiros_>
too bad
<Hanmac>
tds as far as i know module_function only works on modules?
caveat- has quit [Ping timeout: 252 seconds]
<shevy>
tds and this instance variable is defined how or where?
<shevy>
because in your original question you did not include the ivar requirement :-)
<apeiros_>
Hanmac: yes. I thought it'd work on classes too, given that Class < Module. but seems it's undef'ed
apok has quit [Remote host closed the connection]
apok has joined #ruby
iamjarvo has quit [Ping timeout: 240 seconds]
<Hanmac>
defining the exact same method on a class and an instance does not make much sense
<tds>
shevy: both the class method and instance method require a reference to @foo -- for the class method, it is a class instance variable, and for the instance method it is not
<shevy>
hmmmm
<tds>
Hanmac: it does in the context of what I am doing
<tds>
or maybe it doesn't…I dunno
apok_ has joined #ruby
<tds>
basically my domain models need a gateway to talk to a web service
chessguy has quit [Remote host closed the connection]
<tds>
my finder methods are class methods
<tds>
and they need to access that gateway
<tds>
my update methods are instance methods
<tds>
they also need access to that gateway
Dr4g is now known as Dr4g|sleep
<tds>
i just want a method called gateway that returns @gateway
<tds>
this allows me to override @gateway in my tests with a mock
uris has quit [Quit: leaving]
<Hanmac>
tds define it in a module as instance_method and then include AND extend it to your class
Takehiro has joined #ruby
<tds>
i was just thinking that as you said it :)
Emmanuel_Chanel has quit [Quit: Leaving]
codeFiend has quit [Ping timeout: 246 seconds]
<tds>
that seems like the best way to do it, especially given the duplication across all my domain models
<tds>
thanks
mmitchell has quit [Ping timeout: 240 seconds]
apok has quit [Ping timeout: 276 seconds]
apok_ is now known as apok
apok has quit [Remote host closed the connection]
jeff_sebring has quit [Quit: Leaving]
apok has joined #ruby
Juul has quit [Quit: Leaving]
pwf has left #ruby [#ruby]
Agis__ has quit [Quit: Agis__]
Takehiro has quit [Ping timeout: 244 seconds]
beneggett has joined #ruby
lukekhamilton has joined #ruby
beneggett has quit [Client Quit]
jgarvey has quit [Quit: Leaving]
brianpWins has joined #ruby
<rking>
Is this as idiomatic as it gets to make a Hash from an array plus a transformation?: Hash[*arr.map { |e| [ e*2, e ] }.flatten]
caveat- has joined #ruby
<rking>
Surely not.
<apeiros_>
drop the * and the flatten
<rking>
Aha
<rking>
Just another input that Hash[] can take? An Array of 2-item arrays?
chessguy has joined #ruby
chimkan___ has joined #ruby
<apeiros_>
yes
<apeiros_>
as of 1.8.7
<rking>
K, thanksmuch.
<rking>
See guys? apeiros_ is good for more than just kickbanning.
* rking
runs.
<apeiros_>
:-p
<rking>
=D
<apeiros_>
fun fact, only a tiny minority has ever been kicked by me. even less banned. so if you've been, maybe, just maybe it was because of you :-p (not directed at rking)
nexp has joined #ruby
Monie has joined #ruby
Monie has quit [Changing host]
Monie has joined #ruby
<rking>
Just ribbing you because of the botstuff.
RoomieGunns has joined #ruby
chimkan has quit [Ping timeout: 240 seconds]
chimkan___ is now known as chimkan
emsilva has joined #ruby
emsilva has quit [Changing host]
emsilva has joined #ruby
<Hanmac>
apeiros_ need to be praised because he took the might of the banister away :D
<apeiros_>
lol
awarner has quit [Remote host closed the connection]
<rking>
banisterfiend had might, once?
emmanuel__ has joined #ruby
shiki has quit [Remote host closed the connection]
<jerrad>
real quick, could you help me out with a regex?
BrokenCog has quit [Quit: leaving]
<jerrad>
so when i try and run this
<jerrad>
result = searchText.gsub(/(^[a-zA-Z0-9_].?)|[\W-,]([a-zA-Z0-9_])|[\W-,]/, "\\L$1\\u$2")
BrokenCog has joined #ruby
BrokenCog has quit [Changing host]
BrokenCog has joined #ruby
<jerrad>
i get this output: invalid regular expression; can't use character class as a start value of range: /(^[a-zA-Z0-9_].?)|[\W-,]([a-zA-Z0-9_])|[\W-,]/
<banisterfiend>
>> 1
<al2o3cr>
(Fixnum) 1
<seanstickle>
#regex is your friend here
<jerrad>
the regex validates though in other languages, i tested it
HRida has joined #ruby
<banisterfiend>
>> "Hanmac, stop saying disrespectful things about your lord and master"
<al2o3cr>
(String) "Hanmac, stop saying disrespectful things about your lord and master"
gfontenot has joined #ruby
<fowl>
milords a maniac sir
c0rn_ has joined #ruby
<jerrad>
>> "Just A Smalltown Girl Living In A Lonely World".gsub(/(^[a-zA-Z0-9_].?)|[\W-,]([a-zA-Z0-9_])|[\W-,]/, "\\L$1\\u$2")
<al2o3cr>
-e:1:in `eval': (eval):1: empty range in char class: /(^[a-zA-Z0-9_].?)|[\W-,]([a-zA-Z0-9_])|[\W-,]/ (SyntaxError), from -e:1:in `<main>'
mucker has joined #ruby
M- has joined #ruby
danhunter has quit [Quit: danhunter]
nilg has quit [Read error: Connection reset by peer]
davejacobs has joined #ruby
davidcelis has quit [Quit: K-Lined.]
kenichi has quit [Remote host closed the connection]
nilg has joined #ruby
adac has quit [Ping timeout: 248 seconds]
chare has joined #ruby
matty5000 has quit [Read error: Operation timed out]
BrokenCog has quit [Quit: leaving]
apeiros_ has joined #ruby
brianpWins has quit [Quit: brianpWins]
capsule_toy has quit []
Emmanuel_Chanel has joined #ruby
alphabitcity has left #ruby [#ruby]
c0rn_ has quit [Quit: Computer has gone to sleep.]