apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
<nvez>
if you can make out the transalation, seems to be related
<etag_>
I did translate but it just says it is the problem and it works in ubuntu
baroquebobcat has joined #ruby
nikhil_ has joined #ruby
andantino has joined #ruby
andantino has joined #ruby
EzeQL has joined #ruby
pu22l3r has joined #ruby
albemuth has joined #ruby
pu22l3r has joined #ruby
snip_it has joined #ruby
cbuxton has joined #ruby
liluo has joined #ruby
<etag_>
again bump
<etag_>
require 'openssl' pkcs12 = OpenSSL::PKCS12.new('cert.p12', 'pass') and this is the error: `initialize': PKCS12_parse: mac verify failure (OpenSSL::PKCS12::PKCS12Error) this works in centos but in windows
<etag_>
but not in windows*
emmanuelux has joined #ruby
dwon has joined #ruby
Sailias has joined #ruby
adamkittelson has joined #ruby
jaywastaken has joined #ruby
wefawa has joined #ruby
Haydos has quit ["Leaving"]
emmanuelux has joined #ruby
yoklov has joined #ruby
otters has joined #ruby
bglusman has joined #ruby
linoj has joined #ruby
brngardner has joined #ruby
ryanf has joined #ruby
mikeg has joined #ruby
emmanuelux has joined #ruby
chimkan has joined #ruby
jaysig has joined #ruby
adeponte has joined #ruby
mikepack has joined #ruby
kevinbond has joined #ruby
hrs_ has joined #ruby
tommyvyo has joined #ruby
td123 has joined #ruby
igotnolegs has joined #ruby
dwon has joined #ruby
savage- has joined #ruby
blueadept has joined #ruby
dbgster has joined #ruby
Nisstyre has joined #ruby
jfelchner has joined #ruby
sporkbomb has joined #ruby
kish has joined #ruby
pastjean has joined #ruby
wmoxam has joined #ruby
abra has joined #ruby
jgrevich_ has joined #ruby
looopy has joined #ruby
sroy2 has joined #ruby
jaysig has quit ["Leaving"]
banisterfiend has joined #ruby
slartibartfast_ has joined #ruby
<slartibartfast_>
Hey
<slartibartfast_>
I've got a question, something weird I noticed while playing around in an IRB
<slartibartfast_>
And doing Project Euler problems
<slartibartfast_>
Anyway, I'm making a pastebing with the interesting question.
<slartibartfast_>
And, err, my IRB has linux shell commands, syntax highlighting, autocompletion, etc.
<slartibartfast_>
Because I've installed gems to make it do so.
<slartibartfast_>
Although it still sucks. Why doesn't the ruby site talk much about Pry?
<fowl__>
cool, well if thats all you got from that page then keep your janky irb
<fowl__>
:p
<slartibartfast_>
Notice the sentence I got in above your condescending one.
<fowl__>
not being condescending bud, dont get butthurt just yet
iamjarvo has joined #ruby
<slartibartfast_>
Not getting butthurt, guy who calls me bud. Ah, issues of conveying tone in text-based communication. I'm new to Ruby, and experimenting in it, and I noticed something weird that I'm about to ask about.
emmanuelux has joined #ruby
<banisterfiend>
slartibartfast_: cool, got a pastebin yet? im curious :)
<slartibartfast_>
Redoing the steps so I can copy-paste the results.
<banisterfiend>
slartibartfast_: fowl__ is american, i think 'bud' is quite common slang there for buddy/friend/mate
redgetan has joined #ruby
emmanuelux has joined #ruby
radic_ has joined #ruby
<shevy>
fowl__ uses funny words
<shevy>
"janky irb" I never read the word janky before :(
<shevy>
and I used to think I am ok with english
williamcotton has joined #ruby
<banisterfiend>
shevy: we're both foreigners, though you're slightly more exotic than me. We still have a lot to learn about the dominant culture
<fowl__>
noprompt, you should tell this man how to generate the std lib docs for ri
<shevy>
and you get social feedback instantly!!!
<noprompt>
hehe
ed_hz_ has joined #ruby
<shevy>
and google ads
<shevy>
see how limited ri is? :)
<fowl__>
LOL shevy i never scrolled all the way to the bottom before
<noprompt>
i'm obessed with the keyboard, maybe its a phase :P
<fowl__>
Ruby-doc.org is a service of James Britt and Neurogami, an avant garage application development company in Scottsdale, AZ. -_-
albemuth has joined #ruby
startling has quit [#ruby]
<shevy>
usualy, at least on ruby 1.8.x the rdoc docu was installed via "make install-doc" but I guess axisys did not compile from source
<shevy>
*usually
<etag_>
again asking: require 'openssl' pkcs12 = OpenSSL::PKCS12.new('cert.p12', 'pass') produces error: `initialize': PKCS12_parse: mac verify failure (OpenSSL::PKCS12::PKCS12Error) this works in centos but not in windows
anildigital has joined #ruby
<anildigital>
What is the difference between
savage- has joined #ruby
<anildigital>
module Less
<anildigital>
class Error < ::StandardError
<anildigital>
and
<anildigital>
module Less
<anildigital>
class Error < StandardError
<fowl__>
:: tells it to skip all the bullshit and look immediately at the top level
<fowl__>
as opposed to looking for StandardError in the Less module before going up
<noprompt>
"skip all the bullshit" lmao
<noprompt>
that's awesome
<fowl__>
lol
<noprompt>
alright i'm gonna ask a question, here i go
<anildigital>
fowl__: I did not get it... which lines tells "skip all the bullshit"
<noprompt>
haha
<shevy>
noprompt yeah fowl__ finds the proper words
<shevy>
I am going to remember the :: as the "skip all bullshit" operator from now on
<fowl__>
anildigital, ::StandardError refers to StandardError, but from inside Less, it will look for Less::StandardError, and go up until it finds it
<anildigital>
fowl__: hmm
<shevy>
anildigital that was an epic question
<anildigital>
shevy: may be.
<noprompt>
ok so say i have something like this in a class
<fowl__>
like i said, define your StandardError before you try to make a class (Error) that inherits from it
<noprompt>
i'm kinda trying to ripoff an update_attributes type of thing
<fowl__>
otherwise, when you define Error you are always going to get ruby's StandardError, yours does not exist yet
<fowl__>
ruby runs top-down that's why require statements are always at the top, then method definitions, then main code
<etag_>
again asking: require 'openssl' pkcs12 = OpenSSL::PKCS12.new('cert.p12', 'pass') produces error: `initialize': PKCS12_parse: mac verify failure (OpenSSL::PKCS12::PKCS12Error) this works in centos but not in windows
<anildigital>
fowl__: the gist you pasted doesn't print "BAD BAD BAD"
<fowl__>
SIGH
<fowl__>
class Error < ::StandardError
<fowl__>
take out the :: like you were before
<fowl__>
try it both ways
<fowl__>
like you did before >:(
<anildigital>
fowl__: yeah.. removing :: prints "BAD BAD BAD"... that what i am saying .. when you have :: it will make sure it will use the original StandardError class
<fowl__>
yep
fowl__ has quit ["Leaving"]
<anildigital>
when you don't have :: it will use the class overridden
<iamjarvo>
Hi all I am trying to install ree-1.8.7-2010.02 on lion but not having much luck. looks like it fails around here make: *** [.rbconfig.time] Abort trap: 6
<iamjarvo>
gcc version 4.2.1
<noprompt>
man i'm just grossing everyone out today
<kalleth>
ah gprs we meet again
<noprompt>
gprs?
<kalleth>
slow kobile phone bet
<kalleth>
net
<kalleth>
think 3g but 2 generations earlier
ctwiz has joined #ruby
<noprompt>
lmao
<kalleth>
why is that differebt frkm jjust returning attributes, btw?
<kalleth>
or is attributes an array
<noprompt>
attributes is a hash
<noprompt>
and it sends the keys as key= to the object
<kalleth>
oh, oj
<kalleth>
ok
<kalleth>
makes more sense now
mailtruck_ has joined #ruby
<kalleth>
in my book, i just ak 'does it work'
<noprompt>
it works up until you give it a key that causes a NoMethodError
<noprompt>
i could rescue the error
<noprompt>
but i'd still need to raise something ya know
<kalleth>
if bject respinds to key=? i guess then toure asking for permission rathrr than forgiveness
<kalleth>
responds to
<kalleth>
its early i should go to sleep :p
<noprompt>
so your saying just check if it responds, then run it
<noprompt>
otherwise fuck it
<noprompt>
?
<noprompt>
lol
<kalleth>
im saying dont ask a guy on irc at 5am whos newly sibgle for architectural advice :p
<any-key>
anyone here familiar with curses?
<noprompt>
man i can't wait to be single
<noprompt>
lol
<kalleth>
anykey: fuck blsst damn
<kalleth>
more?
<kalleth>
yep im getting obnoxious
<noprompt>
man, ask a rubyist for a straight answer lol
<kalleth>
bedtime :p n
<any-key>
when I clear the screen it just scrolls the terminal buffer down, I'm trying to figure out a way to not do that
<any-key>
so you don't have your scrollbar getting smaller each time you redraw the screen :P
<kalleth>
nah, im no ruby master, noprompt, i just hack it till it works
<noprompt>
lmfao
<noprompt>
sometimes i read these books and listen to these podcasts
<kalleth>
anywsy, gl, nn, etc
<noprompt>
and ya know, i feel brainwashed
<kalleth>
lol
<noprompt>
i sit there and think, hmm i wonder if this is OO
<noprompt>
or somethign like that
<noprompt>
haha
<kalleth>
Make It Fscking Work is my motyo :p
<noprompt>
no shit right?
<noprompt>
haha
<kalleth>
anyway nn
<noprompt>
any-key: i wish i new more about curse
ken_barber has joined #ruby
<noprompt>
s/(curse)/\1s
<kalleth>
nerd
<noprompt>
i'll have regex on my headstone when i'm dead
<noprompt>
and something that says "He use Vim in life, and he was happy."
<noprompt>
lmfoa
<shevy>
ok
<shevy>
I will die next to you
<shevy>
with an arrow saying
<shevy>
----------> loser
<shevy>
and pointing at your grave man
<noprompt>
oh that's awesome
<shevy>
or
<noprompt>
i'd be proud
<shevy>
emacs >
<shevy>
just kidding
<noprompt>
haha
<shevy>
I dont think I'll ever have a grave
KL-7 has joined #ruby
<noprompt>
dude as long as its not visual studio
<shevy>
The problem is
<shevy>
I dont believe in dying
<noprompt>
all good, i don't either
<noprompt>
buy shevy, can you give me a straight opinion on that code?
hukl has joined #ruby
krusty_ar has joined #ruby
hukl has joined #ruby
dfamorato has joined #ruby
<noprompt>
btw my mind was blown today by ctrl+w, ctrl-a, ctrl-e, in the terminal
<noprompt>
it works as long as you don't give it a key for a method= that doesn't exist
<noprompt>
then obviously it raises a NoMethodError
<iamjarvo>
shevy: thanks. but im trying to figure out how ruby versioning works
<shevy>
iamjarvo there is only one real site to look at which is the official ruby source -> ftp://ftp.ruby-lang.org/pub/ruby/
<noprompt>
i could rescue the error and then do some hackery to raise an ArgumentError or something
<shevy>
noprompt you could query via a .respond_to?
<noprompt>
i could, and then i guess say, if it doesn't, skip it
<shevy>
Your code uses send. In my book that is already a huge hack so you can build on top of that hack for another hack to make the BIGGEST hack ;)
<iamjarvo>
shevy: im not looking for line by line diffs. i guess what i want to know is ree-1.8.7.2010.02 is just ree-1.8.7.2012.01 with patches and bug fixes
<iamjarvo>
like is the pattern of what happens
<noprompt>
what's funny is that i hardly ever reach for something like send
<shevy>
iamjarvo yeah but you know that this is not official source right?
<noprompt>
it feels somewhat wrong, but afterall it's ruby
<noprompt>
the garden of forbidden pleasures
<shevy>
so whoever made the ree- versions either had a homepage or he put in the diff changes he made within those two archives
<noprompt>
the garden of "skip all the bullshit" this is my program
<noprompt>
oh man, i tell you, whenever i have to do c++ for school i'm just in tears
<shevy>
with ruby it is like this:
<iamjarvo>
shevy: but there is someone official that makes the rees right? so i cant make a ree
<shevy>
if you go the classical OOP way then things work fine
<shevy>
once you try to be clever and use metaprogramming, or deviate into modules, things tend to just suck
<shevy>
iamjarvo yeah who makes those ree releases?
<becom33>
shevy: what I gave you is a example . I think its work correct what I gave . lets say its a huge paragraph and I wanan check some senteces it has
<shevy>
my suggestion is to write a method and pass the paragraph into it
<becom33>
it doesnt *
vectorshelve has joined #ruby
<becom33>
shevy: let me show you a code
<banisterfiend>
becom33: shevy is a gentle giant
<becom33>
banisterfiend: I know :) hes a very good guy :)
freeayu has joined #ruby
roolo has joined #ruby
dknight has joined #ruby
<dknight>
is any sass package necessary for rails 3.2?
<shevy>
the people on #rubyonrails might know
<Squarism>
is there anything wierd with unary negation operator "!" in ruby
<shevy>
Squarism dunno, do you use () parens in your example?
<Squarism>
yep
<shevy>
hmm
<shevy>
then I would say there can be nothing weird with it
<banisterfiend>
shevy: did u blush when we said those nice things about you
<sgronblom>
Squarism: Why do you hate Ruby so much?
<ksk>
i have some files i need to check stuff against mulitple times (eg, get all lines that contain "error:foo" then, look for something that was in that line in all other lines etc pp)
<ksk>
im wondering if theres a more performant way then just opening this files every time, eg putting thir content into a variable or something? (im new to ruby)
<ksk>
any cool ideas about this?
senny has joined #ruby
<rippa>
ksk: var = File.read(file)
visof has joined #ruby
visof has joined #ruby
<ksk>
i didnt asked how to get files into ruby ;) but thx
<rippa>
you asked how to put content into a var
<rippa>
that's how
<ksk>
mhmmm. you may be right.. thanks
deobald_ has joined #ruby
<Squarism>
my regexp : /href="(.*)"/.match(fallback_html) obviously doesnt do what it should.. as it eagerly eats any " because of the . character class/set
<Squarism>
can i modify that to be non greedy in someway
<rippa>
Squarism: .*?
<rippa>
or [^"}
<sgronblom>
or [^"]* instead of .*
<rippa>
*]
<Squarism>
thanx
bawer has joined #ruby
etehtsea has joined #ruby
bnm008 has joined #ruby
kaiwren has joined #ruby
ab9 has joined #ruby
<ksk>
may i asked how to use the "ri" bundled with debian in here?
<ksk>
"No ri documentation found in:"
justinmcp has joined #ruby
sohocoke has joined #ruby
ab9 has joined #ruby
gucki has joined #ruby
<gucki>
hi there
<gucki>
i'm using latest ruby 1.9.3 and got a yaml (psych) parse error
<gucki>
Psych::SyntaxError: (<unknown>): couldn't parse YAML at line 1 column 1059
<gucki>
the error is exactly where the key (yes it's 1059 chars long) ends....so i wonder if there's a max key length limit and how i can workaround it?
<gucki>
Psych::SyntaxError: (<unknown>): couldn't parse YAML at line 165 column 1027
mengu__ has joined #ruby
<gucki>
deleting one more char (so having a key with 1026) and the yaml parses...
<gucki>
crap :-(
<banisterfiend>
anyone here use pry?
<hemanth>
banisterfiend, lately
<banisterfiend>
hemanth: how is it?
<hemanth>
banisterfiend, liked it very much
<banisterfiend>
hemanth: cool, what features do you like most?
<hemanth>
banisterfiend, first of all color, then the pretty print and tab completions
<banisterfiend>
hemanth: oh ok, what about show-method and show-doc ?
seoaqua has joined #ruby
<hemanth>
banisterfiend, had seen that in the demo video, havn't used it much; but yes it shall be very useful
<banisterfiend>
hemanth: cool :)
<hemanth>
banisterfiend, try ls :)
<banisterfiend>
hemanth: hehe ;)
latrommi has joined #ruby
<banisterfiend>
hemanth: in the version just released (5 mins ago) you can view all monkey patches of a class, and do a recursive search for methods that contain certain code
<hemanth>
banisterfiend, m serious! :) ls -> Show the list of vars and methods in the current scope.
<banisterfiend>
like a ruby grep :)
<banisterfiend>
hemanth: cool
<banisterfiend>
glad u like it
ph^_ has joined #ruby
<hemanth>
banisterfiend, you are one of the devs! :)?
<banisterfiend>
hemanth: yeah, it's my project ;)
<hemanth>
banisterfiend, zomg! glad to meet you
<banisterfiend>
hemanth: thx :)
<hemanth>
:)
mengu__ has joined #ruby
<hemanth>
banisterfiend, the above lines are going to bashorg
<hemanth>
;)
<banisterfiend>
hemanth: cute :) nice site too thx for the link
<banisterfiend>
bbs
Muz has joined #ruby
<hemanth>
Ok :)
<hemanth>
Quote #951028 is pending moderation. Hmmm
nikhil_ has joined #ruby
bnm008 has quit [#ruby]
nilg` has joined #ruby
mengu has joined #ruby
artm has joined #ruby
Foxandxss has joined #ruby
mengu has joined #ruby
foo-bar- has joined #ruby
banjara has joined #ruby
falena has joined #ruby
nu7hatch has quit [#ruby]
wargasm has joined #ruby
<wargasm>
anyone use johnson much?
mengu_ has joined #ruby
sohocoke has joined #ruby
zemanel has joined #ruby
arturaz has joined #ruby
rohit has joined #ruby
iocor has joined #ruby
Guedes0 has joined #ruby
Guedes has joined #ruby
Guedes has joined #ruby
Guedes has joined #ruby
Foxandxss has joined #ruby
elliot98 has joined #ruby
proffalken has joined #ruby
<proffalken>
hi all
<proffalken>
I need to convert a range to an array and retain the formatting
<proffalken>
r = (00..60).to_a returns 1,2,3,4,etc
<proffalken>
I'd like it to return 00,01,02 etc
<proffalken>
is this possible?
knirhs has joined #ruby
<banisterfiend>
proffalken: that's a matter of display
<banisterfiend>
proffalken: after they're converted to strings
<banisterfiend>
nothing to do with the raw data itself, which is always just stored as fixnums, which do not have the preceding 0
<proffalken>
banisterfiend: ok, so I just check if it's less than 10 and add a "0" to the front if that matches?
soveran has joined #ruby
bwlang has joined #ruby
<banisterfiend>
proffalken: sure, though im sure printf also has a formatter for that
<banisterfiend>
though i dont know what it is
<proffalken>
ok thanks
<drizz>
proffalken:
<drizz>
>> 60.to_s.rjust 4, '0'
<drizz>
=> "0060"
apeiros_ has joined #ruby
<proffalken>
drizz: thanks, but I only want to add the leading 0 if the value is under 10
<proffalken>
not to the whole strinbg
A5c97fdb9 has joined #ruby
<proffalken>
my current logig is as follows
<proffalken>
r = (0..60)
<proffalken>
if r.to_i < 10
<proffalken>
r = "0#{r}"
<proffalken>
end
<proffalken>
it's not pretty, but it seems to work... ;)
<apeiros_>
r = "%02d" % r
<apeiros_>
though, the `r = (0..60)` part in the sample makes little sense…
<apeiros_>
banisterfiend: hey, good you caught me - leaving for my flight in half an hour :)
* apeiros_
updates pry
proffalken has quit [#ruby]
<apeiros_>
hmmm, that'd be a good thing to do during the flight - port my stupid irbrc to pry
<apeiros_>
banisterfiend: I assume pry uses ~/.pryrc ?
iamjarvo has joined #ruby
elliot98 has joined #ruby
<banisterfiend>
apeiros_: yep ~/.pryrc. It also loads a ./.pryrc for your current project (if it exists). what are some cool features you have in your irbrc ? maybe we can steal them and fold them in
<banisterfiend>
apeiros_: hmm weird, i just released 0.9.9 about an hour ago, a couple of other people have successfully updated. Maybe some weird caching issue?
<apeiros_>
ooooh
<apeiros_>
wrong ruby version, no pry installed - therefore nothing to update :D
<banisterfiend>
ah
<apeiros_>
srsly, rubygems could be more clear about that…
<banisterfiend>
Yeah
* apeiros_
pinged drbrain abou tit
<apeiros_>
*about it
<banisterfiend>
apeiros_: when u get it going, type $ String -a
<apeiros_>
banisterfiend: my irbrc is online, I'll link you
<banisterfiend>
apeiros_: then try: find-method -c highlight Pry
<banisterfiend>
cool
<banisterfiend>
ill check it out
<apeiros_>
hrmpf, password there is an older version. it should use a custom class PasswordString < String, which has an inspect returning "[PASSWORD]"
<apeiros_>
banisterfiend: will do
<apeiros_>
any suggested read for configuring pry?
<banisterfiend>
apeiros_: your history stuff looks interesting
<apeiros_>
banisterfiend: yeah, but it's not stable enough yet
<apeiros_>
but you can steal the ideas behind it :)
<banisterfiend>
there's a whole bunch more that can be configured but it's not yet documented
<banisterfiend>
there's a few hooks for example
<WhereIsMySpoon>
Hey guys, what would be a good 2d game library for ruby?
<WhereIsMySpoon>
Leaning more towards simple and ease of use than customisation
<banisterfiend>
WhereIsMySpoon: gosu or ray
<banisterfiend>
WhereIsMySpoon: they're both fantastic
<rohit>
I thought ray was a graphics opengl based graphics lib
<banisterfiend>
rohit: it's for game dev
jonathanwallace has joined #ruby
<WhereIsMySpoon>
banisterfiend, which out of the two would you use and why?
<rohit>
WhereIsMySpoon, Take a look at both the libs readme and see which appeals to you :)
<WhereIsMySpoon>
oki
pureluck has joined #ruby
<banisterfiend>
WhereIsMySpoon: ray is written by a genius (Mon_Ouie), but i dont think he's maintaining it so well. It has very good and highlevel abstractions that make it easy to use. Gosu on the other hand is a little bit more lowlevel, but still very usable, and is actively maintained with a large community: http://libgosu.org
<banisterfiend>
WhereIsMySpoon: #gosu and #ray
<WhereIsMySpoon>
thanks a lot banisterfiend
<WhereIsMySpoon>
im looking into doing ludum dare
<WhereIsMySpoon>
and id like to do it using ruby
<rohit>
WhereIsMySpoon, I can suggest something crazy. Use JRuby and take advantage of Java libs through ruby. :D
tatsuya_o has joined #ruby
<banisterfiend>
WhereIsMySpoon: hmm probably gosu for ludum dare, as you'd get more support on #gosu which is a reasonably large channel and there's a number of people doing it too, so there's be a kind of a community
<WhereIsMySpoon>
oki
<banisterfiend>
WhereIsMySpoon: but ray is a very good library, and i'd look into it for future development after ludum dare
elliot_ has joined #ruby
nikhil_ has joined #ruby
<banisterfiend>
rohit: gosu and ray are C++ and C
<banisterfiend>
rohit: they're lightning fast, faster than java libs i'd say
emmanuelux has joined #ruby
rohit_ has joined #ruby
<WhereIsMySpoon>
this ray tutorial here is very nice
<WhereIsMySpoon>
banisterfiend, how long did it take to maek that
<WhereIsMySpoon>
*make
rohit has joined #ruby
<banisterfiend>
WhereIsMySpoon: couple of weeks
ph^ has joined #ruby
fr0gprince_mac has joined #ruby
<WhereIsMySpoon>
thats pretty cool :)
<banisterfiend>
WhereIsMySpoon: but i also wrote the library to manipulate images (the background is fully destructive), i wrote that in 6, which took me about 2 months :P
<WhereIsMySpoon>
banisterfiend, does either gosu or ray do sound stuff too?
<WhereIsMySpoon>
or would i need another lib for that
<banisterfiend>
WhereIsMySpoon: yes
<banisterfiend>
WhereIsMySpoon: they both do music and sound effects
<WhereIsMySpoon>
cool
<ksk>
how do i just get matching pattern from a regex? i managed to compare a "line" with a regex, and just print it if regex matches. but how to if i just wanted a part of the line (the matchin part)?
<WhereIsMySpoon>
ill try the install stuff here as well
<WhereIsMySpoon>
nope still a load of errors
Faris has joined #ruby
<banisterfiend>
WhereIsMySpoon: join #gosu
<WhereIsMySpoon>
banisterfiend, when i do "sudo gem install gosu" i get this: https://gist.github.com/2413096 although I dont know why its trying to use 1.8 :S
<WhereIsMySpoon>
ok then
<banisterfiend>
WhereIsMySpoon: dont use sudo
<banisterfiend>
WhereIsMySpoon: are you on rvm?
<WhereIsMySpoon>
yes
<banisterfiend>
then dont use sudo
<banisterfiend>
just use gem install
elliot_ has joined #ruby
pastjean has joined #ruby
rohit has joined #ruby
<WhereIsMySpoon>
banisterfiend, i tried that too, im on #gosu now anyways
elliot__ has joined #ruby
facefox3 has joined #ruby
L-----D has joined #ruby
keymone has joined #ruby
`brendan has joined #ruby
moos3 has joined #ruby
<`brendan>
morning folks
elliot__ has joined #ruby
Sailias has joined #ruby
tatsuya_o has joined #ruby
tommyvyo has joined #ruby
_ack has joined #ruby
liluo has joined #ruby
josefig has joined #ruby
nikhil_ has joined #ruby
knirhs has joined #ruby
ryannielson has joined #ruby
jitesh_shetty has joined #ruby
matti has joined #ruby
matti has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
Hoornet has joined #ruby
facefox has joined #ruby
fr0gprince_mac has joined #ruby
nilg` has joined #ruby
Synthead has joined #ruby
pastjean has joined #ruby
elalande has joined #ruby
lobolars has joined #ruby
justinmcp has joined #ruby
tommyvyo has joined #ruby
jrist-mtgs has joined #ruby
ChampS666 has joined #ruby
mstratman has joined #ruby
iamjarvo has joined #ruby
Gesh has joined #ruby
Foxandxss has joined #ruby
Gesh has quit [#ruby]
jrist-mtgs has joined #ruby
jonathanwallace has joined #ruby
waxjar has joined #ruby
Jackneill has joined #ruby
Kruppe has joined #ruby
chimkan has joined #ruby
sbanwart has joined #ruby
wmoxam has joined #ruby
bashdy has joined #ruby
fbernier has joined #ruby
tayy has joined #ruby
foo-bar- has joined #ruby
platzhirsch has joined #ruby
<platzhirsch>
When I want to plot data with Ruby I guess Ruby gnuplot is my best chance, isn't it?
nlc has joined #ruby
bwlang has joined #ruby
ukd1_ has joined #ruby
jimeh has joined #ruby
pu22l3r has joined #ruby
pu22l3r has joined #ruby
Drewch has joined #ruby
ABK has joined #ruby
ab9 has quit [#ruby]
jlebrech has joined #ruby
chimkan has quit [#ruby]
seanstickle has joined #ruby
provideal has joined #ruby
bwlang_ has joined #ruby
lorandi has joined #ruby
chad_ has joined #ruby
kpshek has joined #ruby
Shrink has joined #ruby
geekbri has joined #ruby
mattyoho has joined #ruby
mattyoho has joined #ruby
platzhirsch has quit [#ruby]
WhereIsMySpoon has quit ["Leaving"]
DMKE has joined #ruby
dv310p3r has joined #ruby
waxjar has joined #ruby
heftig has joined #ruby
steg132 has joined #ruby
td123 has joined #ruby
asobrasil has joined #ruby
bglusman has joined #ruby
lenochka has joined #ruby
<Sp4rKy>
is there a way to print all environment contained in a "binding" object ?
mdhopkins has joined #ruby
<lenochka>
hi, what is the purpose of p method? is it different from puts?
<banisterfiend>
Sp4rKy: what do u mean by environment
<banisterfiend>
lenochka: yes, it displays the #inspect of an object rather than its to_s, so it contains more info useful for debugging
<banisterfiend>
it also has a return value that is the object itself
<lenochka>
OK.. like what type of useful info?
<banisterfiend>
lenochka: ivars, usually
<Sp4rKy>
banisterfiend: the list of variable contained inside the binding environment
<banisterfiend>
Sp4rKy: just invoke local_variables
<keyword>
hi guys anyone knows some parser for ruby for parse a html with js
ephemerian has joined #ruby
<apeiros>
keyword: nokogiri will parse the html
<apeiros>
search for <script> nodes and pass it to a js parser to parse the js
<ksk>
is a hash limited to be 2dimensional? are there other "variable-types" I could store mulitple information in? like one entry is "jim,20,china,bla" - hope you get what i want to ask...
<keyword>
apeiros: I'm using nokogiri but the html use a js for add the content there, so if I jsut use nokogiri it doenst get the data cause it is load from js
<keyword>
apeiros: so I need that the parser support js so it can get the source with the content generated by js
<apeiros>
ksk: no. a hash is only limited to consist of key/value pairs. but both, the key and the value can be (almost) any object. meaning you can use a collection as value to get "more dimensions"
<apeiros>
keyword: you mean dynamically modified html? use capybara.
<ksk>
apeiros: i see, thanks
<apeiros>
ksk: for example with the webkit driver (headless)
<keyword>
apeiros: capybara need qt for use webkit
<keyword>
apeiros: I need run it in a server without X
<apeiros>
afaik, we run it on a server without x too
<apeiros>
might be that we use some additional software to pretend an x server, though
kevinbond has joined #ruby
ephemerian has joined #ruby
mango_ has joined #ruby
ephemerian1 has joined #ruby
v0n has joined #ruby
artm has joined #ruby
elliot98 has joined #ruby
linoj has joined #ruby
mango_ has quit [#ruby]
yorzi has joined #ruby
jeebster has joined #ruby
KL-7 has joined #ruby
mikepack has joined #ruby
keyword has quit [#ruby]
snip_it has joined #ruby
Teomari has joined #ruby
netrealm has joined #ruby
pastjean has joined #ruby
artm has joined #ruby
maasha has joined #ruby
theRoUS has joined #ruby
theRoUS has joined #ruby
albemuth has joined #ruby
ohergal has joined #ruby
eph3meral has joined #ruby
JonSchuff has joined #ruby
albemuth has joined #ruby
<maasha>
I would like to build a list of sorted intervals. I was thinking of binary search for the insertion of new intervals in the sorted list. A bit tricky or what?
pen has joined #ruby
brngardner has joined #ruby
vectorshelve has joined #ruby
williamcotton has joined #ruby
Sieben has joined #ruby
Sieben has quit [#ruby]
Karlo has joined #ruby
<Karlo>
bonjour \o/
<eph3meral>
maasha, no need
<eph3meral>
maasha, foo = [1,2,3,5]; a = 4; rhs = foo.index{|i| i > a}; lhs = foo.index(foo.select{|i| i < a}.last)
<maasha>
eph3meral: well, something like this: http://pastie.org/3811049 - but I suspect it will fail at all sorts of edge cases with overlapping intervals.
<eph3meral>
maasha, yes that was part of the point of pastebin, to see your data set
<eph3meral>
maasha, if you have overlapping intervals then you need to decide on some more criteria for when a value (or sub interval) goes in to an interval if it could go in to two intervals
looopy has joined #ruby
<eph3meral>
maasha, you need to do some more thinking on specifications - first go determine what the behavior should be, then we can talk about how to solve your problem
<maasha>
eph3meral: yeah, I guess that it is the deciding here that is the problem more than coding it ... :o/ - my brain is not big enuf.
emmanuelux has joined #ruby
<eph3meral>
maasha, also, it would help if we knew why you are doing this? what problem are you solving? what goal are you trying to achieve? what does this data actually represent in the real world?
<catphish>
fearoffish: thanks, sinatra looks more powerful than i first thought
carlyle has joined #ruby
<maasha>
eph3meral: my question is if a given interval is completely embedded in another interval.
krusty_ar_ has joined #ruby
CheeToS has joined #ruby
<maasha>
eph3meral: I want to locate all matching intervals between two similar strings.
<maasha>
The interval check is to speed things up.
<shevy>
not sure there is an inbuilt way for that
<maasha>
shevy: there might in bioruby, but it is too slow :o) - this is DNA stuff on a large scale.
Synthead has joined #ruby
<maasha>
anyway. consider this a fun little interval exercise!
rainytooo has joined #ruby
<eph3meral>
maahes, if interval_in[0] > interval_containing[0] && interval_in[1] < interval_containing[1]
<eph3meral>
maahes, that's pretty simple
andrebras has joined #ruby
<eph3meral>
maahes, if you're just talking two intervals
<Synthead>
if I install a gem, is there a de-facto way to figure out what "require" line I should be using (without googling for it)?
<eph3meral>
maahes, you'll have to adapt that to your "binary tree" thing or whatever structure you store them in
glosoli has joined #ruby
<eph3meral>
maahes, and you may need or want >= and <= respectively instead of > and <
glosoli has quit [#ruby]
<eph3meral>
maahes, i guess it depends on your definition of "completely contained within"
soveran has joined #ruby
LiquidInsect has joined #ruby
<eph3meral>
maahes, or the slightly more human readable version: if interval_in.min > interval_containing.min && interval_in.max < interval_containing.max
<maasha>
well, I am not going for a tree, but rather a list that is queried binary.
<eph3meral>
maahes, either way, you'll have to tell us more about the criteria/purpose/reason/application/problem-domain
mikos_ has joined #ruby
ckrailo has joined #ruby
<eph3meral>
maahes, simply figuring out if one interval contains another is easy - the rest is up to you
becom33 has joined #ruby
<becom33>
how can I change somthing like ":and:1=1" into "+and+1=1" ? repace anyone in :
baroquebobcat has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
<maasha>
becom33: gsub
oooPaul has joined #ruby
mikos has joined #ruby
<maasha>
becom33: or tr
lkba has joined #ruby
KarlFreeman has joined #ruby
<rippa>
tr is faster
<KarlFreeman>
I'm currently working out a Ruby API but have hit a wall with ACL. Does anyone have any good resources for ACL's for REST API's?
<eph3meral>
KarlFreeman, since you would know that cancan in no way precludes you from storing ACL info in the DB
albemuth has joined #ruby
<KarlFreeman>
Well i've used it in the 'creating global role abilities'
<KarlFreeman>
eph3meral, will look in to it more :)
waryof has joined #ruby
waryof has quit [#ruby]
fr0gprince_ has joined #ruby
elliot98 has joined #ruby
<eph3meral>
KarlFreeman, all cancan does is give you the ability to set either "allow" or "deny" - how you determine whether to allow or deny is up to you - it's one of the FIRST things he says in his docs
<Karlo>
thank you very much catphish :)
philcrissman_ has joined #ruby
davidcelis has joined #ruby
ChampS666 has joined #ruby
KL-7 has joined #ruby
berserkr has joined #ruby
<ksk>
hi again
<ksk>
is it possible to use .include? method from array with a variable? im not able to get it working... :x
<ksk>
"array.include?(var)" 'does not work', but if i putt ("var-content") with """ in there it works
<ksk>
any helpful idea?
<oooPaul>
ksk: There's nothing stopping that from working. What do you mean by "does not work"?
<ksk>
ah, i actually do something else.. my variable comes from "while (line = file.gets)" - this seems to behave somehow different
<ksk>
your example works great..
<oooPaul>
Yeah, it sounds like what you THINK is in your variable is NOT what is actually there.
<oooPaul>
Dump the var with "puts var.inspect" and see what is actually in that var.
<supernova>
can anyone suggest me some online materials for learning Ruby
Akuma has joined #ruby
<oooPaul>
If you're pulling from a file, I'm betting you have a carriage return in your string that you aren't expecting.
<oooPaul>
supernova: ruby-lang.org
ABK has joined #ruby
<ksk>
true that oooPaul :) thanks a lot!
mailtruck_ has joined #ruby
tercenya has joined #ruby
<axisys>
how do I do a nice exit if ARGV[0] is not provided. I need a nicer output than line 13 here http://dpaste.com/733759/
maletor has joined #ruby
eywu has joined #ruby
<oooPaul>
axisys: exit(0) ?
emmanuelux has joined #ruby
Bofu2U has joined #ruby
mikeliss has joined #ruby
<oooPaul>
Or exit(1)...
<oooPaul>
Or just don't run the loop if ARGV[0] is nil?
jgrevich has joined #ruby
jgrevich has joined #ruby
<axisys>
so add if ARGV[0]? == nil ?
<axisys>
or true
<oooPaul>
"exit(1) if ARGV[0].nil?
<axisys>
oooPaul: ok
<oooPaul>
or "if ARGV[0].nil? ; puts "No filename provided"; exit(1); end"
<axisys>
oooPaul: even better.. thanks
<axisys>
oooPaul: works like a charm.. thanks a lot
<axisys>
man.. ruby is fun.. i am hoping to continue to sysadmin stuff with ruby .. going forward
<axisys>
much easier to follow than doing it with awk
<oooPaul>
Yep. I've had more fun writing Ruby code than any other language...
<axisys>
oooPaul: i should start finding local meetups of rubyst (?)
<oooPaul>
Can if you want. There are plenty out there.
<axisys>
so puts '\'' is the right way to print `` ' '' ?
<axisys>
or may be "'" ?
sabooky has joined #ruby
benkevan has joined #ruby
mailtruck__ has joined #ruby
<benkevan>
I'm using Puppet::Provider::ParsedFile however, when I have a value that has spaces, every time I run puppet it says it changes. However, if I change the seperation to a tab, it works as expected.. how can I fix this?
heftig has joined #ruby
<benkevan>
record_line :parsed, :fields => %w{name val}, :joiner => ' = ', :separator => /\s*=\s*/ < is my record line, and I get the same results with /\s+=/\s+ also
<oooPaul>
axisys: Both work. The differences are minor.
<axisys>
"'" worked
cousine has joined #ruby
<oooPaul>
axisys: If you use double quotes, the contents are parsed for substitutions. If you use single quotes, they are not.
ABK has joined #ruby
<oooPaul>
So: x = 'foo'; puts '#{x}' => "#{x}"; puts "#{x}" => "foo"
artm has joined #ruby
looopy has joined #ruby
btaitelb has joined #ruby
<Synthead>
if I install a gem, is there a de-facto way to figure out what "require" line I should be using (without googling for it)?
Karlo_ has joined #ruby
<sabooky>
Is this considered "clean" code? lines.map {|line| (match = line.match(/Include (.*)/)[1] ? parse_inclue(match) : line)}
<sabooky>
basically, if a line has an "Include" statement, I want to read the file and substitute the line with the contents of the file
banseljaj has joined #ruby
SegFaultAX|work has joined #ruby
joaoh82 has joined #ruby
<benkevan>
anyone?
<eph3meral>
sabooky, I wouldn't consider it dirty, but I personally would prefer to see it written with do end and if else instead of {} and a ternary all on one line
cwang has joined #ruby
<eph3meral>
sabooky, another alternative would be includes = lines.select { |l| l.match(...) }; includes.map { |i| parse_include(i) }
two- has joined #ruby
<eph3meral>
sabooky, includes = lines.select { |l| l.match(...) }; includes.each { |i| parse_include(i) }; would work just as well
<eph3meral>
sabooky, for practical purposes .each and .map can be considered the same
ABK has joined #ruby
akem has quit ["Forget progress by proxy. Land on your own moon."]
<sabooky>
eph3meral: replacing them inline, so the "Include" line would need to be substituted, having two arrays I think would require them to be merged later on
<sabooky>
each would work though
<eph3meral>
sabooky, hmm, ok so on second thought, nm, cuz you need the backreference
<eph3meral>
sabooky, oh, i see, you want to replace inline
<sabooky>
hmm.. got an undefined method for nil class, since some lines dont match the regex
<axisys>
oooPaul: gotcha
<sabooky>
maybe this is better for me to just spell it out rather than attempt a one-liner
bwlang has joined #ruby
<eph3meral>
sabooky, I think your code is fine, just write it in a more readable format (not all on one line)
philcrissman_ has joined #ruby
<sabooky>
ok, so second question
linoj_ has joined #ruby
<sabooky>
is there a shortcut for
rainytooo has joined #ruby
seme has joined #ruby
<sabooky>
foo = match[1] if match = my_string.match(/someregex with (group)/)
adeponte has joined #ruby
<eph3meral>
sabooky, not that I know of
<sabooky>
oh, nvm, found it
<workmad3_>
sabooky: if my_string =~ /someregex (group)/; some_method($1)
<sabooky>
my_string[/regex (group), 1]
<eph3meral>
hmm, $1 eh?
<sabooky>
err.. my_string[/regex (group)/, 1]
<eph3meral>
ahh, both very interesting
<sabooky>
thanks both of you for your help
<workmad3_>
eph3meral: yeah, $1 - $9 correspond to capture groups after a regex
<eph3meral>
workmad3_, cool, good to know
LMolr has joined #ruby
<workmad3_>
they're sort of like globals, but I think they have some interesting behaviour with nesting... but it's generally safest to use them very quickly after a match :)
<workmad3_>
(hell, I dislike if !condition in general)
<eph3meral>
workmad3_, also agreed
<workmad3_>
LMolr: because there's only one version of it
Araxia_ has joined #ruby
Ronnie_ has joined #ruby
<Synthead>
if I install a gem, is there a de-facto way to figure out what "require" line I should be using (without googling for it)? nobody knows?
<eph3meral>
LMolr, and if you want the non altering version, there's foo = "blerp" + foo
<davidcelis>
Synthead: If it's not the name of the library, then the gem's README should say
<workmad3_>
LMolr: or foo = "#{foo} blerp"
pi3r has joined #ruby
<eph3meral>
workmad3_, that would be append, not prepend :P
<LMolr>
workmad3_, eph3meral: ok thanks. The lack of "!" got me wrong
ABK has joined #ruby
<EvanR>
if a method takes a block, can i use a proc or lambda instead somehow?
<pi3r>
hi guys
<eph3meral>
EvanR, yes
<workmad3_>
eph3meral: good point :) I'd use interpolation either way though
<eph3meral>
EvanR, TIAS
<pi3r>
i have a question about a ruby idiom
<workmad3_>
eph3meral: 1 less string object get's created ;)
<pi3r>
what does <<-ANYTEXT means?
<eph3meral>
pi3r, heredoc
<workmad3_>
pi3r: it's basically a multiline string
<eph3meral>
workmad3_, indeed, I have heard that interpolation is actually faster than concatenation in ruby
<eph3meral>
(in contrast to PHP for example)
<workmad3_>
pi3r: that's ended with the token ANYTEXT at the start of a line
<LMolr>
workmad3_, eph3meral: do you think i can beautify this? : out_ext.prepend('.') if out_ext == ''
<EvanR>
eph3meral: ok
<pi3r>
heredoc? let me google that :D
<pi3r>
workmad3_: eph3meral thanks ! :D
<workmad3_>
eph3meral: depends on the interpreter, but yeah it frequently is (I believe mostly because as I said, it creates fewer string objects that then need GC)
schovi has joined #ruby
<EvanR>
eph3meral: failed miserably
<eph3meral>
EvanR, works for me
<EvanR>
[1,2,3,4,5].select{|x| x>2} works
<pi3r>
workmad3_: eph3meral does string interpolation works with heredoc?
<Synthead>
davidcelis: right on, thank you
<workmad3_>
pi3r: can't quite remember... you could try it in IRB though ;)
<EvanR>
p = lambda {|x| x>2}; [1,2,3,4,5].select p fails
<binaryplease>
workmad3_: i know java and a bit of c++ but not professional
<binaryplease>
i also need to learn how to work with ruby on rails
<EvanR>
im coming to ruby from haskell
<davidcelis>
binaryplease: The Ruby Programming Language, or The Well Grounded Rubyist
<workmad3_>
binaryplease: right... others may have other suggestions, but you probably won't go far wrong with Programming Ruby (a.k.a. the Pickax book) or something like _why's poignant guide or the little book of ruby
<davidcelis>
Pickaxe is a great reference, but I wouldn't recommend it as a learning guide
<workmad3_>
binaryplease: and for rails, 'Rails 3 in Action' is pretty good
<davidcelis>
_why's Poignant Guide is great literature, but I wouldn't recommend that as a learning guide either
jergason has joined #ruby
<workmad3_>
davidcelis: yeah, your suggestions are probably better :)
<davidcelis>
everybody should read the poignant guide though
<EvanR>
workmad3_: actually it turns out to be .select &f.(x)
williamcotton has joined #ruby
<workmad3_>
EvanR: oh, I thought f was a method already... what is it? another lambda? if so, f.call(x) is probably nicer on the eyes of most rubyists :)
ecksit has joined #ruby
<workmad3_>
(I had a bit of a brain-derp seeing f.() :) )
<EvanR>
yeah
<EvanR>
lambda
<EvanR>
so it can closure
<ecksit>
Hi, I need a ruby script to spit out the disk space remaining. Anyone got some resources? (I don't want to use gems)
<workmad3_>
EvanR: you taught me a new trick to calling lambdas today though :) thanks
<EvanR>
workmad3_: agree all this syntax is rather harsh
<shevy>
ecksit not sure there is a direct way. on linux, you can use "fdisk -l" from within a ruby script
<workmad3_>
EvanR: and yeah... ruby can do functional programming to a certain extent, but the syntax is neater for OO programming with method calls that you pass blocks to
Careott has joined #ruby
<lectrick>
Can anyone explain why ObjectSpace._id2ref n where n is an odd number is the n-2 instance of Fixnum?
<shevy>
or some other command than fdisk -l
<workmad3_>
lectrick: because those are the object ids of fixnums
JivaD has joined #ruby
<workmad3_>
lectrick: did you not do the ruby koans? :)
<lectrick>
workmad3_: Why do fixnums have object id's? workmad3_ Apparently I have to lol
<ksk>
is there something like bashs "-x" commandline option, to see what happens internally for ruby?
<workmad3_>
lectrick: well, a fixnum is an object... why wouldn't it have an object id?
<any-key>
if it exists, it is an object
<lectrick>
workmad3_: stop making sense. :) Do floats have object id's?
<lectrick>
Because that could get complicated
<workmad3_>
lectrick: yes, but they don't follow a pattern
<lectrick>
workmad3_: So every float value that is ever the result of any calculation gets assigned an object ID?
<lectrick>
Isn't that a memory problem?
medik has joined #ruby
<binaryplease>
davidcelis: workmad3_ thanks ill look into taht
<shevy>
hmm
<shevy>
Floats have the same object id all the time, I think
<lectrick>
shevy: I just tried. Nope.
<workmad3_>
lectrick: if you ever grab the float, it will act like an object... it's entirely possible that the interpreter will optimise away intermediate floats that are only temporary, but semantically they are objects and so would have object ids (it's sort of quantum... if you ever observe it, certain things will happen, otherwise not)
<shevy>
hmmmm strange
<EvanR>
workmad3_: i see that, but i end up with a lot of blocks which repeat code
<workmad3_>
EvanR: proc {} is a 'first class' block
<EvanR>
yes
ABK has joined #ruby
<EvanR>
and this is the syntax ;)
<lectrick>
workmad3_: There is a strange beauty to that
<workmad3_>
lectrick: it's the difference between a mental model (it's an object, so it has an object id) and an optimisation (we'll only actually make an object if you ever treat it like an object)
c0rn has joined #ruby
DMKE has joined #ruby
Oog_ has joined #ruby
<Oog_>
there is a function run_process in module Delayed::class Command that is in the delayed_job gem. I need to override this function... how? after i require 'delayed/command.rb' if i reopen the module/class and define the function will my version take precedence or must i do something else?
<workmad3_>
lectrick: I'd also need to check interpreter code to see if that is actually the case too... I know the interpreter does that sort of thing with blocks and procs and it would make sense for calculations but I don't *know* it's true
<lectrick>
>> 6.object_id == 6.object_id #=> true
<workmad3_>
lectrick: as already stated, fixnums are special :)
<lectrick>
workmad3_: yes. just demonstrating :)
<shevy>
stupid stinking fixnums
<workmad3_>
lectrick: if you get into Bignum territory, it acts the same as floats (different object ids all the time)
<shevy>
stupid stinking bignums
<workmad3_>
lectrick: and seeing as you can have bignum literals in ruby, that can get interesting :)
<workmad3_>
lectrick: each float literal creates a new object
<shevy>
ruby cheats
<lectrick>
shevy: I was just using it to demonstrate hidden attributes on individual fixnums :)
<shevy>
they are not so individual!
<EvanR>
please tell me floats, ints, bignums, etc are immutable ;)
<workmad3_>
EvanR: I wouldn't trust them to not be immutable, but I realise that's not the same thing :)
ed_hz_ has joined #ruby
<shevy>
they are not even real objects :(
<shevy>
x = 5.5; def x.hi; puts "hi"; end
<shevy>
TypeError: can't define singleton method "hi" for Float
<workmad3_>
shevy: they are... they're just special objects :)
<workmad3_>
(aren't they value objects or something?)
<shevy>
they are like the most archaic prototypic objects
<shevy>
they think "one day we grow big and strong!"
<shevy>
but they only disappoint :(
imsplitbit has joined #ruby
apok has joined #ruby
<waxjar>
what's best practice in defined class methods (i do it the class << self way). place them at the end of the class or at the beginning?
<waxjar>
*defining
<any-key>
think about it, floats are handled by ALU magic
<workmad3_>
shevy: they only disappoint if you try to abuse them :P
<shevy>
workmad3 I try to treat them like the best object ever!
<shevy>
but they just say no :(
<any-key>
waxjar: I tend to prefer doing self.method instead of class << self
<any-key>
I'd say at the top
<shevy>
I too!
KJF has joined #ruby
<workmad3_>
top
<shevy>
def Foo.foo sucks because it's tied to the name
<any-key>
def self.foo makes a lot more sense
<workmad3_>
and yeah, def self.method, unless I need to do class << self to do an attr_accessor or something and so already have it
kuzushi has joined #ruby
<shevy>
you can change the name at a later point too and it will still work
<supernova>
hello everyone
<shevy>
die supernova!
<shevy>
oops
<shevy>
hi supernova!
<waxjar>
y do some attr_readers indeed, so i chose for class << self
<waxjar>
*I
<EvanR>
ok
<EvanR>
to sort, i need to compare stuff
<EvanR>
so subtract
<any-key>
<=>
<EvanR>
ok
<EvanR>
<=>
<workmad3_>
EvanR: spaceships are your friend :)
<seme>
I must be dense can anyone help me to understand the synxtax of the some_array.sort { |x,y| y <=> x }... I get that it sorts the items descending but whats going on there...
<EvanR>
first question, i want to compare values which might be nil
<EvanR>
numbers | nil
<any-key>
seme: it might help to read up on the "diamond" operator (the <=> thing)
<EvanR>
number - nil is an error (good)
<seme>
thanks... let me take a look.
<supernova>
some one tell me some sites where i can in depth knowledge on ruby
<supernova>
i tried some of the official .org pages
<workmad3_>
EvanR: any chance you can remove the nils first? .compact.sort would make it trivial ;)
<workmad3_>
any-key: <=> is the spaceship operator :)
stkowski has joined #ruby
<any-key>
bah! it's a diamond!
<any-key>
=> is a rocket ship
<EvanR>
workmad3_: the nils are in the data, and should be. when they appear in the sort function, they should be 'less than any number' or whatever
<EvanR>
no number is like that
steg132 has joined #ruby
<workmad3_>
EvanR: ah, fair enough
berserkr has joined #ruby
<workmad3_>
EvanR: was just checking :)
<EvanR>
(assuming you wanted me to treat nil as a number)
maloik has joined #ruby
<workmad3_>
EvanR: no, I was just suggesting you get rid of them
<EvanR>
no they are part of the record and need to be pushed all the way down or up
<EvanR>
alright skip that question, how do i conveniently sort of more than one aspect of the record, like first field :a then :b
<EvanR>
sort on*
havenn has joined #ruby
<workmad3_>
EvanR: do it in your comparison block
<EvanR>
right
brngardner has joined #ruby
<EvanR>
its gonna be complex :(
jitesh_shetty has joined #ruby
<workmad3_>
EvanR: feel free to call out to other methods in your comparison block ;)
<EvanR>
and not too obvious
<EvanR>
well its not gonna be methods because the methods i need arent defined yet on the relevant classes
<EvanR>
lambdas maybe
<workmad3_>
EvanR: hmm, I'd do it all inline and pull it out into methods later tbh
adamkittelson has joined #ruby
<EvanR>
pull it out into methods? youre suggesting i actually make new methods for nil and number and stuff?
<EvanR>
:S
rbanffy has joined #ruby
<shevy>
change the world man, change the world
<shevy>
take a broom and start nearby!
<EvanR>
>_>
<any-key>
monkey patching is like violence
zakwilson has joined #ruby
<any-key>
well, it is violent
<shevy>
I prefer to call it god patching
<any-key>
but you need more of it
<EvanR>
i prefer local changes
<shevy>
it shows that there are monkeys who can't handle it
<any-key>
programming ruby is like playing games with god mode on
ABK has joined #ruby
<shevy>
well yeah
<shevy>
I want to be able to constrain god patching to certain projects too
<shevy>
perhaps we are monkey-gods
<EvanR>
spooky action at a distance
<msch>
anyone here using goliath.io?
<shevy>
io??? the Io language?
<shevy>
is it still alive? :P
Advocation has joined #ruby
<any-key>
languages don't die
Bofu2U_ has joined #ruby
tommyvyo has joined #ruby
micah has quit [#ruby]
<shevy>
they do!
<lectrick>
io was so cute
<shevy>
it just takes a long time for most
<shevy>
my main indicator is for where all the young programmers go for
<shevy>
(Java) :(
<any-key>
Java isn't a horrible way to learn
<any-key>
you have to be very specific with it
jonathanwallace has joined #ruby
<EvanR>
7 - nil, error
ringotwo has joined #ruby
<EvanR>
7 == nil, not an error
<EvanR>
>_<
<any-key>
then you get tired of it and things like attr_accessor make you feel relieved
<any-key>
EvanR: the - operator is defined on fixnum, it requires another fixnum object
<any-key>
the whole concept of no side effects and shifting the world state is interesting
<EvanR>
shevy: its different for every object
<any-key>
lectrick: that's a shame :(
<EvanR>
world state is a red herring dont listen to that stuff
<any-key>
too late!!!
<lectrick>
i like the no side effects thing, which is why I started using object.freeze in my ruby code, but now people here keep telling me not to lol
nemesit has joined #ruby
<any-key>
it makes sense though, I think it helped me
<shevy>
of course it is different for different objects as different objects contain different data
<lectrick>
So instead, now I simulate frozen-ness by duping incoming values and only allowing them to be set once
<any-key>
I'm currently picking apart JVM bytecode in haskell, it's getting tedious :(
<shevy>
it's like trying to throw an elephant into a blender and ask "will it blend" and then be surprised if it does not blend as easily as a mouse :(
<EvanR>
shevy: its a method that returns a string, exactly what that means is not defined
<shevy>
a string is a string
<any-key>
EvanR: the IO monad does that
<lectrick>
TIL haskell is yet another language that runs on the jvm
<any-key>
lectrick: no
<EvanR>
any-key: no
<shevy>
I don't understand how you can say a string is not well defined
<niklasb>
lectrick: what?
<any-key>
lectrick: it's for a school project
<lectrick>
oh nvm sorry... misread what any-key said
moshef has joined #ruby
<EvanR>
shevy: 'string' is, but what 'to_s' does exactly is not defined
<lectrick>
shevy: Probably... encoding
<EvanR>
the >>= method for monads has an obvious signature, but what it means it not defined
<EvanR>
so people get confused
<lectrick>
EvanR: You define your to_s. :)
<EvanR>
just think of to_s
mrsolo has joined #ruby
<shevy>
what is a monad?
<EvanR>
... class with >>= method
<niklasb>
shevy: it's unbelievably cool and mind-bending
<EvanR>
alright im done
<niklasb>
EvanR: and return and monad laws
Sailias has joined #ruby
<shevy>
niklasb that I heard!
ABK has joined #ruby
<EvanR>
niklasb: yes, im trying to analogize with to_s here
<shevy>
I am not quite sure why it is so cool and mind-bending but one day I will find out
<niklasb>
EvanR: sry, didn't follow the discussion
<EvanR>
should be equally mind blowing
<any-key>
it takes a thing, and that thing tells you how to make a string out of it
<any-key>
then you get a string
<niklasb>
also fail to see how that has anything to do with monads ? oO
* any-key
kicks haskell in the monads
<EvanR>
any-key: you take a monad, >>= with a function, and you get another monad (monadic value)
<EvanR>
end of
<any-key>
EvanR: correctamundo
<EvanR>
not mind blowing
<niklasb>
EvanR: no, >>= combines *functions*
<EvanR>
its x >>= f
<EvanR>
not f >>= g
<any-key>
monads aren't limited to the IO monad
<niklasb>
oh.. right
<niklasb>
stupid me
<any-key>
I like the do syntax, I hardly ever write >>= for my code :P
<niklasb>
any-key: it's often more readable though
<jaysern>
I'm getting a [BUG] Bus Error when I do a bundle install on my OS X 10.5 machine. Any suggestions? /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Bus Error
becom33 has joined #ruby
fungoat_ has joined #ruby
snip_it has joined #ruby
lampe2 has joined #ruby
jergason has joined #ruby
<shadoi>
rvm install 1.9.3 --with-gcc=gcc-4.2
SQLStud has joined #ruby
<shadoi>
jaysern: ^^
<shadoi>
you'll probably need to use homebrew to install it
<shadoi>
(gcc 4.2 that is)
kvirani has joined #ruby
mdw has joined #ruby
<lampe2>
hey i wanne save meta tags in a a db and a refrence to a file on the file system and a reference to a parent file oder to child files is there mongodb a good database for ?
fungoat_ has joined #ruby
A50352cf2 has joined #ruby
<jaysern>
shadoi: doing that now. sudo rvm reinstall 1.9.3 --with-gcc=gcc-4.2
savage-_ has joined #ruby
francisfish has joined #ruby
DDAZZA has joined #ruby
bwlang has joined #ruby
timonv has joined #ruby
mattyoho has joined #ruby
stephenjudkins has joined #ruby
<shadoi>
lampe2: any database will work fine for that.
<shadoi>
lampe2: you need more requirements to narrow it down.
<lampe2>
shadoi, okay it should be a noSQL db and the thing is that hmm how to explain it
Careott has joined #ruby
n3m has joined #ruby
<lampe2>
shadoi, there is like a wrapper object with the meta data and the things in the object should have meta tags too
<shadoi>
lampe2: why noSQL? What's the need that makes that a requirement?
<lampe2>
shadoi, this is not my requirement
bawer has joined #ruby
<jaysern>
shadoi: darn, it choked. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension........ Make sure that `gem install libarchive -v '0.1.2'` succeeds before bundling.
<lampe2>
shadoi, i must find some clever arguments for postgresql ;)
shinobi_one has joined #ruby
<shadoi>
lampe2: I have a feeling your problems stem from the fact that you have to come up with clever arguments for it.
apok has joined #ruby
shinobi_one has joined #ruby
jergason has joined #ruby
<lampe2>
shadoi, i wanted it the easy way. just store it in a big DB but then the others in the team wanted NoSQL ...
peterhil has joined #ruby
<lampe2>
cause its fancy and new and .....
<shadoi>
ask them why.
<shadoi>
get real reasons.
<jaysern>
lampe2: thanks - i will install this
<shadoi>
lampe2: it really depends on the data, if it will be relational at all, then relational databases make good sense.
<shadoi>
If it will always be single-document data, then a k/v simplifies things a lot.
<shadoi>
lampe2: if they just want to try something cool and new out, use kyotocabinet + kyototycoon
<lampe2>
the thing is every object in a document should have some meta tages.... example: you got a text document(object with reference to the sub objects) this contains 1 text(more meta tags and more sub objects) and 1 picture(more meta tags and more sub objects) and now lets say the text hase chapter 1 to 4 so this are all objects and so one i hope you get it ?
<jaysern>
lampe2: i can't gem install libarchive-ruby. checking for main() in -larchive... *** extconf.rb failed *** /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)You have to install development tools first.
<shadoi>
lampe2: would the sub-objects ever be shared between documents?
<lampe2>
yes shadoi this is the clue
<shadoi>
jayne: 10.5 may just not be compatible.
<shadoi>
jaysern: ^^
<lampe2>
jaysern, You have to install development tools first
<shadoi>
lampe2: if so, you want a relational DB, or at least something with linking semantics (Riak does this)
<jaysern>
sorry for the noob question .. what development tools?
<lampe2>
jaysern, in the rake file is this: s.required_ruby_version = ">=1.8.7"
skrewler has joined #ruby
<shadoi>
jaysern: Xcode has the development tools, but it sounds like they are too old for 1.9.3
<shadoi>
jaysern: there are tons of people reporting issues on stackoverflow for 1.9.3 on 10.5
jonathanwallace has joined #ruby
<lampe2>
shadoi, linking semeantics with riak ?
<shadoi>
lampe2: Riak has support for linking documents builtin
<lampe2>
oh thats cool
<lampe2>
thats a real good argument
ringotwo has joined #ruby
<jaysern>
so there's no way to basically install ruby 1.9.3 on 10.5 ?
<shadoi>
The only downside to Riak is that if you need advanced customization, you have to learn Erlang.
QKO has joined #ruby
<jaysern>
i'm doing a search on my machine, i see 2 archive.h's: /Developer/SDKs/MacOSX10.5.sdk/usr/include/wx-2.8/wx/archive.h and /opt/local/include/archive.h
<shadoi>
jaysern: I'm sure it's possible, but you need to fight with it, and go through all those stackoverflow pages to find solutions.
<lampe2>
urgh osx...
<shadoi>
jaysern: add /opt/local/include to your compile options (use -I)
<burgestrand>
lampe2: cucumber and rspec are not exclusive, you can use both together
zyzz has joined #ruby
<lampe2>
burgestrand, yeah i know
<zyzz>
hey
<lampe2>
burgestrand, but to keep it simple ;)
catphish has joined #ruby
<any-key>
I thought the "KISS" principal was "Keep It Sleazy, Stupid"
havenn has joined #ruby
jonathanwallace has joined #ruby
<catphish>
i realise this is a little offtopic but does anyone know if a request can be prematurely ended by a before filter in sinatra for authentication?
<aszurom>
if they dropped the Kids off kidsruby and maybe called it N00bR00b it would be applicable to me
<lampe2>
its funy iam debuging a project that is writen in java and the coder codet like a c++ coder so the code is realy bullshit :D
<lampe2>
_john, i like the new name better :D "friendship" haha
jeebster1 has joined #ruby
<lampe2>
and zyzz with just whatching youtube you cant learn any language ;) read a book and code ;)
pangur has joined #ruby
<lampe2>
and zyzz look at code from strangers LEARN TO READ THE SOURCE LUKE ;)
jonathanwallace has joined #ruby
<pangur>
[2012-04-18 21:12:05] WARN TCPServer Error: Address already in use - bind(2)
<pangur>
/home/calum/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE) I have tried ps aux | grep webrick. Any suggestions for how to recover the address in use, please?
<lampe2>
pangur, OS ?
<pangur>
ubuntu
<lampe2>
i see ps aux :D
<lampe2>
and with | grep ruby ?
<pangur>
thanks lampe2 - that was it :)
<pangur>
Thanks very much!
<lampe2>
no problem pangur
jonatha__ has joined #ruby
<lampe2>
good night good fight to you all !
<pangur>
goodnight
SQLStud has joined #ruby
poincare101 has joined #ruby
s0ber has joined #ruby
ctwiz has joined #ruby
cbuxton has joined #ruby
davidw has joined #ruby
bpg has joined #ruby
eywu has joined #ruby
Azure|netbook has joined #ruby
Sailias has joined #ruby
kaiwren has joined #ruby
SQLStud has joined #ruby
SQLStud has joined #ruby
sabooky has joined #ruby
SQLStud has joined #ruby
netrealm has joined #ruby
rondale_sc has joined #ruby
krusty_ar has joined #ruby
n8ji has joined #ruby
apeiros_ has joined #ruby
cloke has joined #ruby
yoklov has joined #ruby
<dbgster>
when you require a file, but never use the methods, is it lazy loaded?
<oooPaul>
Not if you specifically require it, AFAIK.
<oooPaul>
The file has to be parsed to know what methods/classes/modules it defines.
atmosx has joined #ruby
robbyoconnor has joined #ruby
mengu has joined #ruby
jonathanwallace has joined #ruby
<dbgster>
oooPaul: ok good to know thanks
jax_ has joined #ruby
<oooPaul>
One way to show that is to stick the line 'puts "I'm in you."' into a file you require, and see that it gets output at the point of the require.
<oooPaul>
There are ways to lazy-load things -- Rails has done that by monkeypatching some of the "constant not found" code so that it goes looking for a file named similarly to the constant, requires it at that point, then retries.
<oooPaul>
But that's not a Ruby standard.
<apeiros_>
Module#const_missing
<oooPaul>
That's the one.
<apeiros_>
also there's autoload
<apeiros_>
but both are bad practices
<oooPaul>
Meh.
<oooPaul>
:)
<jax_>
new ruby dev on os x: textmate, netbeans, or rubymine?
<oooPaul>
vim
<apeiros_>
bbedit!
<jax_>
i can use vim too but i'd rather have something that helps me out a little
<oooPaul>
Textmate, then.
<apeiros_>
rubymine or sublime then
<apeiros_>
rubymine helps a lot, but it's slow as molasses…
<oooPaul>
Depends on your definition of "helps me out a little". I turn syntax highlighting on in vim and that helps me all I need. ;)
<josefig>
jax_, TextMate or Sublime, just remember no more than 80 columns and you're safe ;)
<lectrick>
Sublime Text 2 is so fucking awesome. Someone finally out-Textmated Textmate.
<dbgster>
jimeh: so is that compatible with both versions?
<jimeh>
should work, I haven't had that issue with a Rakefile specifically, but I'd imagine it works like regular Ruby files :)
philcrissman has joined #ruby
<jimeh>
yeah, it won't effect 1.8.x :)
Gonzih has joined #ruby
<jimeh>
however, if your server is running 1.8.7, you should really be running that locally too...
yannis has joined #ruby
<dbgster>
jimeh: seems to have worked. so what does it do? (besides format my c dirve)
SphericalCow has joined #ruby
<dbgster>
jimeh: its a test box, hope to update it
atmosx has joined #ruby
<zyzz>
is there a way to search channels list
artm has joined #ruby
lewis has joined #ruby
Ethan has joined #ruby
shruggar has joined #ruby
<zyzz>
i wanna find a visual basic channel
<jimeh>
dbgster: $LOAD_PATH is an array of paths/folders that Ruby looks through whenever you call `require`, that code adds the directory the current file (the Rakefile) is in to the beginning of that array
jonathanwallace has joined #ruby
stephenjudkins has joined #ruby
tatsuya_o has joined #ruby
Squarepy has joined #ruby
<apeiros_>
jimeh: actually what was added to $LOAD_PATH in 1.8 was '.', which is not the same as $LOAD_PATH.unshift File.expand_path('..', __FILE__)
zyzz has joined #ruby
Squarepy has joined #ruby
<jimeh>
apeiros_: true, bad wording on my behalf :)
<jimeh>
with "current path" I meant the directory you're cd'd into, which is "." :)
rondale_sc has joined #ruby
turdbiscuit has joined #ruby
<turdbiscuit>
hi
rondale_sc has quit [#ruby]
flagg0204 has joined #ruby
rondale_sc has joined #ruby
turdbiscuit has quit [#ruby]
looopy has joined #ruby
ChampS666 has joined #ruby
maesbn has joined #ruby
_class_ has joined #ruby
jonathanwallace has joined #ruby
matt312 has joined #ruby
havenn has joined #ruby
pangur has joined #ruby
asobrasil has quit [#ruby]
MrGando has joined #ruby
<pangur>
Where should I ask questions about setting up aptana to let me see ruby 1.9.3 output to browser?
rondale_sc has quit [#ruby]
<oooPaul>
Not sure I grok what you mean by "ruby output to browser"?
<pangur>
Basically, rather than have to http://localhost:9292 in an external browser, I want to be able to do it in an aptana window.
<pangur>
Currently, the default that I have it set up to is python, in which I also dabble.
gilead_ has joined #ruby
<pangur>
Normally, I just press a run button and I can see console output and browser output.
<oooPaul>
No clue. Is this a Rails app?
<pangur>
No, it is a sinatra app
<pangur>
Maybe I should ask there.
Jakee` has joined #ruby
<pangur>
Aptana does not seem to have a freenode room
<pangur>
Eclipse has not responded - although I think that maybe if I had not mentioned aptana, the eclispe answer would have done :)
<pangur>
oooPaul, got my aptana browser going - thanks for being interested in helping.
<oooPaul>
Woot. :)
adeponte has joined #ruby
<pangur>
It turns out to be a rails app after all even though I have it running on what looks like a sinatra configuration.
fridim_ has joined #ruby
eywu has joined #ruby
lorandi has joined #ruby
<pangur>
Hence the 9292
<pangur>
Anyway, all is working.
<oooPaul>
Huzzah!
btaitelb has joined #ruby
TheIronWolf has joined #ruby
demian`_ has joined #ruby
gglitch has joined #ruby
gglitch has quit [#ruby]
<headius>
arturaz: that could be a JRuby problem
<headius>
in the past our bad-concurrency detection caught too many errors, but I thought I'd fixed that
<headius>
there could be remaining cases
<arturaz>
Was any of those fixed in 1.6.6 -> 1.6.7?
<arturaz>
We're still using 1.6.6
<headius>
I don't think so
<headius>
you can pass -Xbacktrace.style=raw to get a full Java backtrace
<arturaz>
JRUBY_OPTS?
<headius>
yeah
viaov has joined #ruby
viaov has quit [#ruby]
MrGando has joined #ruby
<arturaz>
ok, lets try that next time server crashes :)
<arturaz>
headius, will that still include ruby backtrace?
<headius>
it will not unless the ruby code has compiled
<headius>
which you can force with -X+C
<headius>
we have the ruby trace though
<arturaz>
yeah, but if my other code crashes it would be nice to know where the problem is :)
ZachBeta has joined #ruby
<luckyruby>
Trying to write a ruby tcp server using socket lib. Can someone show me how to read from a client until buffered data contains the string "foo"?
<lectrick>
That is certainly a bizarre omission considering there is a File.read
<lectrick>
Why not? That's the most often used case. Slurp up a file and close it
<oooPaul>
Yeah, but it's not obvious from the syntax that the file handle is actually released.
<oooPaul>
Shouldn't it be "data = File.read(filepath)" anyway?
sroy2 has joined #ruby
jeedey_ has joined #ruby
zigidias has joined #ruby
<oooPaul>
Looks like they finally added it in 1.9.3...
brngardner has joined #ruby
CoverSli1e has joined #ruby
<banisterfiend>
lectrick: it was written by a 14 year old ;)
jlogsdon_ has joined #ruby
<lectrick>
For real?
<lectrick>
oooPaul: crap. i'm not on 1.9.3 yet.
<banisterfiend>
lectrick: shota is 14 yeah
<oooPaul>
lectrick: Yeah, scroll down to the bottom of that link you found, they have a patchset that adds it.
michaelmartinez has joined #ruby
grin has joined #ruby
<oooPaul>
Okay, I'm outta here. Ciao y'all.
jitesh_shetty has joined #ruby
pu22l3r has joined #ruby
jbpros_ has joined #ruby
eywu has joined #ruby
sayakb_ has joined #ruby
xsdg_ has joined #ruby
akhkharu_ has joined #ruby
srydberg has joined #ruby
starburs1 has joined #ruby
wereHams1er has joined #ruby
mrmist_ has joined #ruby
Muz_ has joined #ruby
MrGando has joined #ruby
mpereira has joined #ruby
stephenjudkins has joined #ruby
libertyprime has joined #ruby
zakwilson_ has joined #ruby
bgupta_ has joined #ruby
krz has joined #ruby
dipnlik has joined #ruby
scwh has joined #ruby
sonkei has joined #ruby
mutewinter has joined #ruby
<rking>
I'm brand new to rake, but am making a project that will work well as a sort of task library. Is there an established practice for this kind of thing, or is it simply a matter of making a foo.rb and users will "require 'foo'" from their Rakefile?
xrl has joined #ruby
MetaCosm has joined #ruby
tomzx has joined #ruby
libertyprime has joined #ruby
catphish has joined #ruby
axl_ has joined #ruby
cephalobod has joined #ruby
jmeeuwen has joined #ruby
madhatter has joined #ruby
m_3 has joined #ruby
jshsu has joined #ruby
yeltzooo7 has joined #ruby
ewag has joined #ruby
sj26 has joined #ruby
cinaski has joined #ruby
tdmackey has joined #ruby
danheberden has joined #ruby
benwoody has joined #ruby
rcs has joined #ruby
regedarek has joined #ruby
russfrank has joined #ruby
preller has joined #ruby
brngardner has joined #ruby
stephenjudkins has joined #ruby
carlyle has joined #ruby
jgrevich_ has joined #ruby
jgrevich_ has joined #ruby
nyrb has joined #ruby
Ethan2 has joined #ruby
mitchty has joined #ruby
Cyrus has joined #ruby
M- has joined #ruby
<lectrick>
Is there any way to Marshal.dump a complex object and just skip anything that is not serializable?