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
pdtpatr1ck_ has joined #ruby
nari has joined #ruby
<CannedCorn> hey guys, whats the best way to let users store choose a local time for something to run, would you store their timezone
<CannedCorn> ?
mmokrysz1 has joined #ruby
sixteneighty has joined #ruby
caiges has joined #ruby
mmokrysz1 has quit [#ruby]
fr0gprince_ has joined #ruby
M- has joined #ruby
tomzx has joined #ruby
trend has joined #ruby
dv310p3r has joined #ruby
linoj_ has joined #ruby
Jay_Levitt has joined #ruby
nik_-_ has joined #ruby
Pheen has joined #ruby
CannedCorn has joined #ruby
deryldoucete has joined #ruby
Hydroxide has joined #ruby
deryldoucete has joined #ruby
red13 has joined #ruby
deryldoucete has joined #ruby
deryldoucete has joined #ruby
ZachBeta has joined #ruby
deryldoucete has joined #ruby
mmokrysz has joined #ruby
deryldoucete has joined #ruby
pastjean has joined #ruby
deryldoucete has joined #ruby
deryldoucete has joined #ruby
deryldoucete has joined #ruby
deryldoucete has joined #ruby
<fowl> the fuck ^
pgpkeys has joined #ruby
pgpkeys has joined #ruby
lkba has joined #ruby
mmokrysz has quit [#ruby]
bwlang has joined #ruby
bwlang has joined #ruby
artOfWar has joined #ruby
vitoravelino has joined #ruby
vitoravelino has joined #ruby
libertyprime has joined #ruby
libertyprime has joined #ruby
<red13> Hmmm... I'm contemplating deleting my Twitter account... on account of the fact that I waste too much time following people and not creating anything of value in the world.
<red13> I deleted my Facebook account 4 years ago and never looked back.
<red13> But I absolutely adore Twitter and find it fascinating to follow certain interesting people.
<arubin> red13: Replace those addictions with IRC.
<red13> That might just work.
deryldoucette has joined #ruby
trend_ has joined #ruby
<red13> I've heard that nature abhors a vacuum. And my life is definitely a vacuum. In that it sucks shit. I wish I could be one of those fancy Dyson vacuums.
artOfWar has joined #ruby
mrbrdo has joined #ruby
thone has joined #ruby
Rishi_ has joined #ruby
pu22l3r has joined #ruby
badabim has joined #ruby
mmokrysz has joined #ruby
waxjar has joined #ruby
superguenter has joined #ruby
BRMatt has joined #ruby
tds has joined #ruby
cableray has joined #ruby
superguenter1 has joined #ruby
dwon has joined #ruby
lkba has joined #ruby
caiges has joined #ruby
waxjar has joined #ruby
nfluxx has joined #ruby
polarist has joined #ruby
sj26 has joined #ruby
tommyvyo has joined #ruby
neohunter has joined #ruby
nfluxx_ has joined #ruby
liluo has joined #ruby
mikepack has joined #ruby
Targen has joined #ruby
deryldoucette has joined #ruby
emanu has joined #ruby
S2kx has joined #ruby
td123 has joined #ruby
_|christian|_ has joined #ruby
luxurymode has joined #ruby
Anastasiya has joined #ruby
Anastasiya has quit [#ruby]
Fari has joined #ruby
duard has joined #ruby
looopy has joined #ruby
eywu has joined #ruby
headius has joined #ruby
robbyoconnor has joined #ruby
cook1es has joined #ruby
jetblack has joined #ruby
jetblack has joined #ruby
nari has joined #ruby
hydrozen has joined #ruby
sekretskwerl has joined #ruby
crescendo has joined #ruby
pu22l3r has joined #ruby
pdtpatr1ck has joined #ruby
shtirlic_ has joined #ruby
cableray has joined #ruby
iamjarvo has joined #ruby
CannedCorn has joined #ruby
pastjean has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
caiges has joined #ruby
robbyoconnor has joined #ruby
carlyle has joined #ruby
sacarlson has joined #ruby
dbgster has joined #ruby
looopy has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
nopolitica has joined #ruby
dhruvasagar has joined #ruby
badabim_ has joined #ruby
shadoi has joined #ruby
r0bby has joined #ruby
liluo has joined #ruby
ed_hz_ has joined #ruby
QKO has joined #ruby
fbernier has joined #ruby
phantasm66 has joined #ruby
drake10 has joined #ruby
nfluxx has joined #ruby
nikhgupta has joined #ruby
nikhgupta has quit [#ruby]
Avanine has joined #ruby
havenn has joined #ruby
nfluxx_ has joined #ruby
sbanwart has joined #ruby
igotnolegs has joined #ruby
CheeToS has joined #ruby
pu22l3r has joined #ruby
__main__ has joined #ruby
snip_it has joined #ruby
kah has joined #ruby
SegFaultAX has joined #ruby
c0rn has joined #ruby
eignerchris has joined #ruby
headius has joined #ruby
Evixion` has joined #ruby
apok_ has joined #ruby
Drewch has joined #ruby
Fou_DRA has joined #ruby
albemuth has joined #ruby
acekiller has joined #ruby
sarguru__ has joined #ruby
maxximith has joined #ruby
Evixion has joined #ruby
n8ji has joined #ruby
<maxximith> hi eveyrone - over the past few months I've been finishing up a prototype for a website i'm trying to develop.. so far i've created a prototype/skin for each page based on user role and how each page interacts - i had been planning to offset what i've done to a developer to help me program it. I haven't prototyped the admin panel yet.. and was hoping to get your guys' opinion on whether it would
<maxximith> be good for me to try to create what i believe to be what i want on the admin panel - or would this be counterproductive and my work probably scrapped as the developer starts developing?
baroquebobcat has joined #ruby
zodiak has joined #ruby
cmasseraf has joined #ruby
badabim has joined #ruby
pu22l3r has joined #ruby
Zac_o_O has joined #ruby
frishi has joined #ruby
<banistergalaxy> maxximith: or you're going to pay a developer to build it for u?
<banistergalaxy> oh*
td123 has joined #ruby
ElderFain has joined #ruby
liluo has joined #ruby
technel has joined #ruby
dhruvasagar has joined #ruby
methoddk has quit ["["Textual IRC Client: www.textualapp.com"]"]
methoddk has joined #ruby
gabeh has joined #ruby
radic has joined #ruby
fragmachine has joined #ruby
gabeh has joined #ruby
<fragmachine> Hey how can I search for 'something' or 'something else' With grep? Eg something like 'cats dogs kangaroos'.split.grep(/(cats)||(dogs)/) - retruns cats and dogs but not kangaroos?
danishkhan has joined #ruby
Teddy2st_ has joined #ruby
<sarguru__> Sorry for posting again but please let me know if there is away to write to fd1 of the process or is dup2 possible with ruby?
The_Tick has quit [#ruby]
csherin has joined #ruby
<heftig> sarguru__: IO.new(1)
<heftig> though STDOUT should already be FD 1
j0bk has joined #ruby
j0bk has joined #ruby
Gesh has joined #ruby
<sarguru__> heftig, I want to write to it and not read from it
j0bk has quit [#ruby]
<sarguru__> This is exactly what I want but I cannot see any continuation of it heftig
<heftig> IO.new(1, "r")
<sarguru__> and pass it on to popen4
<sarguru__> I want to pass it to a sub process
rohit has joined #ruby
<heftig> hmm
tomato64 has joined #ruby
stefanp_ has joined #ruby
caiges has joined #ruby
liluo has joined #ruby
<sarguru__> heftig, for example I use open(STDOUT,<&pipeout) in perl
<sarguru__> is there any similar thing in ruby
adeponte has joined #ruby
tomato16 has quit ["Leaving"]
pu22l3r has joined #ruby
stefanp has joined #ruby
stefanp has joined #ruby
bbttxu has joined #ruby
baroquebobcat has joined #ruby
CannedCorn has joined #ruby
<heftig> sarguru__: test.rb:11:in `reopen': <STDOUT> can't change access mode from "w" to "r" (ArgumentError)
<heftig> that just gets you an error
btfriar has joined #ruby
fowl has joined #ruby
<sarguru__> mmm
stkowski has joined #ruby
zulax has joined #ruby
<sarguru__> I know reopen wont work, What I wanted was to create a dup entry to a pipeout. Close stdout and write to it from pipe in in the parent process
<sarguru__> but cant figure the way heftig
sefiu has joined #ruby
<fowl> you gotta check those pipes, kids
<fowl> clean em out
<fowl> now think about your dad
<fowl> i wanna meet that dad
shevy has joined #ruby
<sarguru__> fowl, :)
<cout> sarguru__: iirc it's something like r,w = IO.pipe; STDOUT.reopen(w)
<cout> then write to r
<sarguru__> reopen. will try with it cout
<sarguru__> i was doing stdout=r.dup
banistergalaxy has joined #ruby
n8ji has joined #ruby
<sarguru__> btw has anybody seen a qmail-queue replacement in ruby
<fowl> sarguru__: did you dream about it or something? does such a thing exist?
<sarguru__> Im trying to write one
<sarguru__> The qmail-scanner in perl is very difficult to modify easily
<sarguru__> I thought ruby should give more clarity
bbttxu has joined #ruby
cha1tanya has joined #ruby
Vadim2 has joined #ruby
<sarguru__> fowl, thats what made me endup in trying to write to fd1 of the qmail-queue binary when I want to queue it back
rippa has joined #ruby
<shevy> ruby is definitely nicer than perl
cmasseraf has joined #ruby
<fowl> sarguru__: i recommend just thinking about how your going to handle the data, then write some concise ruby around that thought
<sarguru__> but I am stuck with the initial prototyping itself due to this problem
<sarguru__> fowl, true
gokul has joined #ruby
kawa_xxx has joined #ruby
EddieS has joined #ruby
Jay_Levitt has joined #ruby
Vadim has joined #ruby
nate_h has joined #ruby
Zac_o_O has joined #ruby
baroquebobcat has joined #ruby
mneorr_ has joined #ruby
confounds has joined #ruby
radmacd has joined #ruby
<radmacd> Hey, silly question. What would you think is the most elegant way to grab a directory listing of a directory and put the list of tiles [not directories] with full absolute path into a string for further processing?
<shevy> it must be a string?
<radmacd> naw
<radmacd> hash, array...
<shevy> then I would make it an array
<sarguru__> array any day
<shevy> with full absolute path
<shevy> to its members
<radmacd> Yes
<sarguru__> one more silly question from my side. kern#exece will take the input from STDIN and print the output to STDOUT replacing the present process. Correct?
pdtpatr1ck has joined #ruby
max_ has joined #ruby
<shevy> radmacd: problem solved? :)
<shevy> array = Dir['/some/location/*']
<radmacd> shevy: nope… still not sure how to nail it
<shevy> sarguru__: not sure if it will replace the current process at all
<shevy> doesnt it start something like a subshell or subthread instead?
arvidkahl has joined #ruby
<shevy> hmm
<shevy> exec "echo *"
<radmacd> that easy eh… pfft. Now I feel like a dummy
<shevy> waaaah
<radmacd> thanks
<shevy> my irb exited
<shevy> is that normal when doing exec ???
Synthead has joined #ruby
<shevy> good radmacd dont worry there are hard problems too :)
<rippa> shevy: exec replaces current process
<rippa> which means irb too
<Synthead> with nginx and unicorn, can I start unicorn with nginx, or is it always supposed to run separately?
<shevy> aha
<shevy> ok that makes sense then
pgpkeys has joined #ruby
pgpkeys has joined #ruby
albemuth has joined #ruby
cobragoat has joined #ruby
kenperkins has joined #ruby
c0rn has joined #ruby
bier has joined #ruby
kp666 has joined #ruby
krz has joined #ruby
wyhaines has joined #ruby
krz has joined #ruby
sarguru__ has joined #ruby
<radmacd> How is Hash.new(0) different from Hash.new ?
PsiliPharm has joined #ruby
<shevy> "If obj is specified, this single object will be used for all default values. "
<shevy> in your case, obj is 0
<shevy> so the default value of such a hash should be0
<shevy> * 0
<shevy> hash = Hash.new 0 # => {}
<shevy> hash['hi'] # => 0
mikepack has joined #ruby
<shevy> normally, that would return nil
<shevy> you see radmacd ?
<radmacd> Ah, ok… that makes sense. Because I am trying to increment nil, thats why its failing
<radmacd> hence undefined method `+' for nil:NilClass
<shevy> nil is not able to do much
<shevy> nil + 5
<shevy> NoMethodError: undefined method `+' for nil:NilClass
<shevy> it is the dumbest object I've ever seen
arvidkahl has joined #ruby
<shevy> it responds to .to_s though
<shevy> nil.to_s # => ""
<radmacd> weird… thats not really consistent. Thanks though…
n8ji_ has joined #ruby
albemuth has joined #ruby
rramsden has joined #ruby
<shevy> well, nil is just not very useful
<shevy> Arrays have the method .compact which removes all nil objects from them
libertyprime has joined #ruby
n8ji has joined #ruby
arvidkahl has joined #ruby
_|christian|_ has joined #ruby
<fowl> radmacd: nobody will hate you for failing out early if something.nil?
<fowl> ie return if something.nil?
guns has joined #ruby
<banistergalaxy> shevy: you should spam your ideas about 'pipes' all over this thread: http://www.reddit.com/r/ruby/comments/qr5qe/a_unix_shell_in_ruby_part_3_a_login_shell_and_the/
phantomfakeBNC has joined #ruby
<shevy> hmm
<shevy> but my pipes are kinda different
<shevy> and it is actually only my 4. most important project right now
<shevy> my shell comes 2nd
<shevy> I still need to find out how to integrate it with pry
<shevy> http://www.picresize.com/popup.html?images/rsz_ack.png <-- haha
<banistergalaxy> shevy: what other projects are you working on
EddieS has joined #ruby
<shevy> well the "build tools" is the most important one right now. you know, everything that can be used to compile and install anything
<shevy> then the diashell... and then the pseudo-web framework for all my servable ruby pages... which I am using since about 7 years...
Student has joined #ruby
<Student> hi
<shevy> oh I know seydar
rohit has joined #ruby
<shevy> he was in the ancient team around the first version of rush, the one that had the ncurses dropdown box
<Student> Is anyone here good with java im doing an assignment and im nearly done, I just need help with my last part
dankest has joined #ruby
<fowl> #java
<fowl> DUH
<shevy> why is seydar using bitbucket
<shevy> it makes me ANGRY :(
<fowl> shevy: hows RBT
<banistergalaxy> shevy: seydar is your enemy
<fowl> upgrade to 1.9
<fowl> (:
<banistergalaxy> shevy: how tall are you
<Student> how do i get to java chat room
<shevy> why is he my enemy, we used to be an ancient team
<shevy> he aint using IRC much anymore though :(
<shevy> fowl I am still rewriting it... I should have never done a hard rewrite ...
Teddy2steper has joined #ruby
<shevy> but hey, once it is done the "circular require" shit will no longer appear
snip_it has joined #ruby
<shevy> hmm I'll also probably be on 1.9.x finally
<banistergalaxy> shevy: are you happier now that fowl has returned from skyrim, or is he not the old fowl that you knew
Atrika has joined #ruby
caiges has joined #ruby
<shevy> well seems to be alright
caiges has joined #ruby
<shevy> he has returned to #gobolinux
<shevy> I am not on xchat right now btw, I somehow broke it again. stupid webchat ...
arvidkahl has joined #ruby
<fowl> Student: /join #java
<banistergalaxy> shevy: i hope you're reestablish the strong bond of friendship that you two once shared
<shevy> but I have to leave in 8 minutes, cya all in ~5 hours after that
<banistergalaxy> you'll*
<fowl> shevy: <3
<fowl> i'll await your return dad
<fowl> is that weird?
<banistergalaxy> shevy is the dad horse experience
porco has joined #ruby
nikhgupta has joined #ruby
<deryl> hahahah that is sweet!
<deryl> in limechat i see a ruby in the right lower corner in this channel and only this one
<deryl> thats sweet as hell
<deryl> i know i know.simple things for simple minds and all that ;)
DrShoggoth has joined #ruby
stephenjudkins has joined #ruby
djdb has joined #ruby
JohnBat26 has joined #ruby
Teddy2steper has joined #ruby
libertyprime has joined #ruby
willyum has joined #ruby
Morkel has joined #ruby
greenarrow has joined #ruby
x0F__ has joined #ruby
yxhuvud has joined #ruby
liluo has joined #ruby
ziyadb has joined #ruby
banistergalaxy has joined #ruby
stepnem has joined #ruby
ringotwo has joined #ruby
codezombie has joined #ruby
dankest has joined #ruby
cmasseraf has joined #ruby
polarist has joined #ruby
Guest93992 has joined #ruby
adeponte has joined #ruby
liluo has joined #ruby
cirwin has joined #ruby
csherin has joined #ruby
gytis_z has joined #ruby
nemesit has joined #ruby
sarguru__ has joined #ruby
rburton- has joined #ruby
<rburton-> I'm trying to find a nice way with RabbitMQ + AMQP to do a publish/reply_to but cap how long to wait for a reply. Any suggestions?
cirwin has joined #ruby
Azure has joined #ruby
dhruvasagar has joined #ruby
Indian has joined #ruby
jmccune has joined #ruby
cirwin has quit [#ruby]
zakwilson_ has joined #ruby
jmccune has joined #ruby
CheeToS has joined #ruby
thecreators has joined #ruby
ethan_ has joined #ruby
ringotwo has joined #ruby
PsiliPharm has joined #ruby
undersc0re has joined #ruby
undersc0re has joined #ruby
arvidkahl has joined #ruby
etehtsea has joined #ruby
fukushima has joined #ruby
rramsden has joined #ruby
_undersc0re_ has joined #ruby
PsiliPharm has joined #ruby
scientes has joined #ruby
<scientes> system "echo *".split " "
<scientes> doesn't work
<scientes> how do i pass a system call to not be executed in a shell without seperating all the argvs apart
sleetdrop has joined #ruby
shruggar has joined #ruby
<yxhuvud> scientes: try system(*"echo *".split(""))
<yxhuvud> " "
<scientes> nop
<scientes> it doesnt like the array
<scientes> i thought it would work with multiple assignment stuff
<scientes> oh that &
<scientes> **
<yxhuvud> thing is system [foo, bar] is not the same as system foo, bar
<scientes> gotcha
<scientes> the * breaks it apart?
<yxhuvud> yes
<scientes> cool
<scientes> what is that like?
<scientes> is that kinda like a pointer to a struct
<scientes> is that why it uses that syntax
<yxhuvud> it is the splat operator
<yxhuvud> and it works both for breaking apart or putting together.
<scientes> cool im reading up on it thx
dhruvasagar has joined #ruby
ezkl has joined #ruby
csherin has joined #ruby
mafolz has joined #ruby
shruggar1 has joined #ruby
ed_hz_ has joined #ruby
polarist has joined #ruby
robbyoconnor has joined #ruby
dhruvasagar has joined #ruby
havenn has joined #ruby
nachtwandler has joined #ruby
ph^ has joined #ruby
zommi has joined #ruby
t-mart has joined #ruby
seoaqua has joined #ruby
<seoaqua> https://gist.github.com/2034918 could anyone help,pls :)
shruggar has joined #ruby
<seoaqua> im suddenly confuzed about the class params of ruby
<seoaqua> oops, typo.... sorry guys
moshee has joined #ruby
moshee has joined #ruby
LMolr has joined #ruby
pastjean has joined #ruby
<t-mart> so, in ruby, you don't make binaries--its an interpreted language. how should i install my application on a system then if it requires many files? i don't want to just throw it all in usr/bin. im suspecting something like "require usr/lib/myapp/andsoforth"? anyone have an example project that installs to the system that might provide some insight?
PsiliPharm has joined #ruby
emmanuelux has joined #ruby
<scientes> t-mart, rubygems is really popular, and is part of the core library with ruby 1.9
twqla has joined #ruby
<scientes> but yeah t-mart, put it in /usr/lib/$PACKAGE/
<scientes> if you are not going to use rubygems
<scientes> or rather /usr/local/lib/$PACKAGE if it is not packaged and distributed by/with the OS
Shrink has joined #ruby
<t-mart> my goal is command line execution. rubygems is really only a solution for development, right? not really end-use?
<scientes> t-mart, rubygems can install executables which lie in the path
<scientes> and you can use gem2rpm to package for rpm-based OS's
<t-mart> mmm. nifty
<scientes> and maybe even alien that to a .deb
<scientes> but that is a streach
<scientes> there was alot of opposition AFAIK to rubygems at one point
<scientes> but it kinda won
<t-mart> how long ago was this?
<t-mart> the debate
<scientes> not sure
undersc0re has joined #ruby
Azure_ has joined #ruby
<t-mart> ah, but anyway, i found the docs relating to making command line utilities with ruby gems. thanks a lot! im actually glad to here there's a standardized solution built right in
undersc0re has joined #ruby
undersc0re has joined #ruby
<t-mart> hear*
alem0lars has joined #ruby
<scientes> e.g. rubygems put's its cache files in /var/lib/ instead of /var/cache
lobak_ has joined #ruby
undersc0re has joined #ruby
undersc0re has joined #ruby
nemesit has joined #ruby
flippingbits has joined #ruby
<scientes> wait /usr/lib on this box
luoluoluo has joined #ruby
<scientes> t-mart, now, native c extentions as distributed as source, and require a compiler on the target machine
<scientes> t-mart, http://packages.debian.org/sid/gem2deb <--didn't know this existed
cableray has joined #ruby
adman65 has joined #ruby
adman65_ has joined #ruby
nikhgupta has quit [#ruby]
<seoaqua> is there any way to ignore all 'puts' if i need to keep a program slient, except ruby a.rb > /dev/null ?
pi3r has joined #ruby
<seoaqua> * silent
artOfWar_ has joined #ruby
tonini has joined #ruby
dekroning has joined #ruby
nopolitica has joined #ruby
<rippa> $stdout = StringIO.new
rramsden has joined #ruby
rushed has joined #ruby
trivol has joined #ruby
AxonetBE has joined #ruby
mikewintermute has joined #ruby
dhruvasagar has joined #ruby
pzol has joined #ruby
InBar has joined #ruby
moemen has joined #ruby
ukwiz has joined #ruby
<seoaqua> what is the right way to alias vi=vim for sudo ,pls?
blacktulip has joined #ruby
<sgronblom> Anyone had any luck with using ruby-debug with 1.9?
<sgronblom> Oh wow, works now!
<heftig> seoaqua: alias sudo="sudo "
d3vic3 has joined #ruby
liluo has joined #ruby
johndbritton has joined #ruby
<banistergalaxy> sgronblom: on 1.9.3 u mean?
artm has joined #ruby
trend_ has joined #ruby
berkes has joined #ruby
<sgronblom> 1.9.2
dhaivat has joined #ruby
KJF has joined #ruby
KJF has joined #ruby
Helius has joined #ruby
DuoSRX has joined #ruby
<banistergalaxy> sgronblom: yeah, ruby-debug is broken on 1.9.3 afaik
<banistergalaxy> sgronblom: why are you using 1.9.2 btw?
sarguru__ has joined #ruby
fr0gprince_ has joined #ruby
workmad3 has joined #ruby
nari has joined #ruby
mengu has joined #ruby
visof has joined #ruby
shruggar has joined #ruby
tatsuya_o has joined #ruby
fr0gprince_mac has joined #ruby
nopolitica has joined #ruby
justinmcp has joined #ruby
ephemerian has joined #ruby
ephemerian1 has joined #ruby
jlebrech has joined #ruby
mklappstuhl has joined #ruby
maasha has joined #ruby
<maasha> Hi,
<maasha> I want to reshape a NArray, but I fail to see how this can be done unless you have to create a new array from a slice/mask?
AxonetBE has quit [#ruby]
<maasha> and that could give a memory problem
<seoaqua> heftig, in a normal user's bashrc?
<seoaqua> heftig, i dont get it
<seoaqua> heftig, but it seems to work. confuzed
<maasha> dammit! There _is_ a reshape method :D
<maasha> w00t!
* maasha cluebat.autobeat
zaydana has joined #ruby
Helius has joined #ruby
<maasha> hm, no, that size must be the same for reshape.
simao has joined #ruby
Helius has joined #ruby
francisfish has joined #ruby
fearoffish has joined #ruby
<t-mart> scientes, i am up and running with my new gem! thanks again!
hukl has joined #ruby
ephemerian has joined #ruby
Amorsen has quit ["Client exiting"]
wyhaines has joined #ruby
pw_ has joined #ruby
roolo has joined #ruby
apok has joined #ruby
trivol has joined #ruby
berserkr has joined #ruby
adman65 has joined #ruby
gyre007 has joined #ruby
banistergalaxy has joined #ruby
rohit has joined #ruby
mycle_vername has joined #ruby
alem0lars has joined #ruby
mycle_vername has quit [#ruby]
visof has joined #ruby
tayy has joined #ruby
mavenastic has joined #ruby
sawgij has joined #ruby
n1x has joined #ruby
cal has joined #ruby
clockwize has joined #ruby
Afal has joined #ruby
clockwize has joined #ruby
WhereIsMySpoon has joined #ruby
<WhereIsMySpoon> hey
<WhereIsMySpoon> ive been going through the learn ruby the hard way tutorial
<WhereIsMySpoon> when does it actually start teaching me stuff i dont already know? :S
<WhereIsMySpoon> i havent really learned any proper ruby yet ^^
Pheen has joined #ruby
<WhereIsMySpoon> just general programming principles
fortysixandtwo has joined #ruby
<Afal> the idea of lrthw is that it teaches complete beginners on how to program ruby
<Afal> also define "proper ruby"
sacarlson has joined #ruby
<WhereIsMySpoon> Afal i meant that i havent really learned anything that is ruby specific
<WhereIsMySpoon> Afal i was told to use lrthw when i asked for a tutorial in here <_>
<banistergalaxy> WhereIsMySpoon: skip through it at your leisure then
<WhereIsMySpoon> is there a tutorial that is more suited for someone who has a few years of programming in java/python?
<Afal> koans?
eldariof has joined #ruby
mklappstuhl has joined #ruby
pzol has quit ["Sayonara!"]
gokul has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
kremiak has joined #ruby
<WhereIsMySpoon> Afal thanks
n1x has joined #ruby
liluo has joined #ruby
symb0l has joined #ruby
<banistergalaxy> WhereIsMySpoon: also check out why's poignant guide
iocor has joined #ruby
<Afal> that book has lots of pretty pictures :)
eddie_ has quit ["Ex-Chat"]
xlogic has joined #ruby
<shevy> WhereIsMySpoon: dont listen to any of them. start here -> http://pine.fm/LearnToProgram/?Chapter=01
xlogic has quit [#ruby]
eddie_ has joined #ruby
<eddie_> seoaqua: Got any idea about ignoring 'puts' ???
<DefV> ignoring puts?
<DefV> how so
<eddie_> yes
<eddie_> this buddy here wanted to ignore all puts in his code
<eddie_> for some purpose
<DefV> just puts or any output?
<eddie_> he mentioned puts only
<jjp> redefine puts
<jjp> proc puts {args} {}
<jjp> oops sorry, mistook with #tcl :-)
<eddie_> jjp: i dint get you
<DefV> eddie_:
<DefV> module Kernel; def puts(*args); nil; end; end
<eddie_> yes that was the one in my mind
<DefV> but tbh, that's nasty
<eddie_> DefV i was about to help the guy the same way
<DefV> eddie_: another option is to rewrite stdout
<DefV> $stdout = File.new('/dev/null', 'w')
<eddie_> DeFV: can you explain that if you dont mind
bluenemo has joined #ruby
<DefV> eddie_: any output (like puts) is technically a write to $stdout, standard out
<WhereIsMySpoon> eddie_, instead of stdout writing to stdout, it writes to /dev/null
<WhereIsMySpoon> which basically will throw all output into the garbage without you even seeing it
<DefV> $stdout is in most cases your TTY
<WhereIsMySpoon> which isnt what he asked for as far as i can tell
<WhereIsMySpoon> he only wanted puts to be thrown awa
<WhereIsMySpoon> y
<DefV> eddie_: also look at Rails's implementation of Kernel.silence_stream
polarist has joined #ruby
<eddie_> Thanks Guys
<DefV> WhereIsMySpoon: why would anyone want puts to be thrown away but not, for example, p
<WhereIsMySpoon> shevy, that is another learn to program tutorial
<WhereIsMySpoon> not a learn to program ruby tutorial
<WhereIsMySpoon> DefV, i dont know
<WhereIsMySpoon> thast what he asked for
<WhereIsMySpoon> <DefV> just puts or any output?
<WhereIsMySpoon> <eddie_> he mentioned puts only
<WhereIsMySpoon> ...
<eddie_> WhereIsMySpoon: Yes
<eddie_> he might have had many puts in his code
<eddie_> and wanted to silence the program
<eddie_> while running
<WhereIsMySpoon> mmh
<WhereIsMySpoon> then tbh just ./myProg.rb > /dev/null
<shevy> WhereIsMySpoon it is a learn to program ruby tutorial
<WhereIsMySpoon> then tbh just ./myProg.rb > /dev/null 2>&1
<WhereIsMySpoon> even
<WhereIsMySpoon> wait no that doesnt make any difference
<WhereIsMySpoon> im a bit slow today
<WhereIsMySpoon> shevy
<WhereIsMySpoon> it starts off with "what on earth is this + ?!?!"
<shevy> did you work through the chapters already?
<shevy> ok then here comes an exam question, which you can answer when you worked through:
<shevy> - How do you use a conditional block within a ruby method?
tvw has joined #ruby
<WhereIsMySpoon> shevy you mean an if-else statement?
<shevy> damn it you are right
<shevy> my question was not accurate :(
<WhereIsMySpoon> not sure if serious or trolling
<shevy> oh, I am never trolling
<WhereIsMySpoon> *squint*
<WhereIsMySpoon> this koans thing is a bit odd
<WhereIsMySpoon> is it just supposed to familiarise myself with the ruby debugger output?
<shevy> WhereIsMySpoon, how do you determine whether a block was given to a ruby method or not?
<WhereIsMySpoon> shevy, what do you mean, given to? you mean a block passed as an argument to a method?
<WhereIsMySpoon> like passing a function as a parameter?
<shevy> what
<shevy> a block
<WhereIsMySpoon> i dont understand the syntax "block was given to a ruby method"
<shevy> ok example:
<WhereIsMySpoon> or it isnt clear
<shevy> foo vs foo { "hi" }
<shevy> how can you discriminate between these two invocations of the method foo?
flou has joined #ruby
<WhereIsMySpoon> those are method descriptions not invocations
<WhereIsMySpoon> method parameters are passed inside ()
<WhereIsMySpoon> not {}
falena has joined #ruby
<shevy> please read a tutorial before writing such
<shevy> the right answer would have been on http://pine.fm/LearnToProgram/?Chapter=11 but you are no longer allowed to have a look at it
jrist-afk has joined #ruby
<WhereIsMySpoon> what
<shevy> it is ok, you can use 5% of ruby and still do useful things
<shevy> you dont have to use any block
<WhereIsMySpoon> what the heck are you on about
<WhereIsMySpoon> if i had
<WhereIsMySpoon> def main
<WhereIsMySpoon> foo {"hi"}
<shevy> I am just expanding on your statement that foo { "hi" } has no arguments
<WhereIsMySpoon> i would have an error
<DefV> not if foo exists
hukl has joined #ruby
<WhereIsMySpoon> so you can use {} as parameter brackets like ()?
<DefV> no
<DefV> { } starts a block
<DefV> like do; end does
<DefV> foo { "bar" } sends a block which does "bar" to foo
<DefV> with 0 arguments
<WhereIsMySpoon> so if i had
<WhereIsMySpoon> foo = 1
<WhereIsMySpoon> and then did
asteros has joined #ruby
<WhereIsMySpoon> huh i cant think of any way to interact with foo without mentioning it
<WhereIsMySpoon> like
<WhereIsMySpoon> foo { foo += 1 }
<WhereIsMySpoon> would add one to foo
<WhereIsMySpoon> i dont see how the block is useful
<rippa> def foo; <stuff here>; end
<DefV> no it wouldn't :-)
<WhereIsMySpoon> rippa that syntax makes sense
<rippa> foo {<another stuff>}
<WhereIsMySpoon> ah i see
<DefV> usefull example: writing a file without block:
<rippa> you can attach block to method
doublethink has joined #ruby
<DefV> f = File.open 'foo', 'w'; f.write 'hi'; f.close
<DefV> writing a file with a block:
<DefV> File.open('foo', 'w') { |f| f.write 'hi' }
<WhereIsMySpoon> f isnt defined
<DefV> naive implementation of File.open: "def open(*args); normal_open_stuff(*args); if block_given?; yield self; close; end; end"
<DefV> but you should just read up on blocks
<WhereIsMySpoon> or does ruby just assume that f is the File.open()?
<DefV> because you have no idea what a block does
<DefV> and how they work
<WhereIsMySpoon> it woudl have been useful if shevy maybe started with what you guys helped me with
<WhereIsMySpoon> isntead of being condescending
<DefV> how am I condescending
<WhereIsMySpoon> not you
<WhereIsMySpoon> shevy
cjk101010 has joined #ruby
<DefV> oh :-)
<WhereIsMySpoon> thanks def
<WhereIsMySpoon> :)
<WhereIsMySpoon> and rippa
<rippa> f is block argument
clockwize has joined #ruby
<shevy> WhereIsMySpoon but I don't think you will learn ruby
<WhereIsMySpoon> oh you're right
<WhereIsMySpoon> ill just float around
<WhereIsMySpoon> in the sky
<WhereIsMySpoon> wait
<shevy> "<WhereIsMySpoon> not a learn to program ruby tutorial"
<shevy> if you would have went through it you would have seen "yield" already
MasterIdler_ has joined #ruby
<WhereIsMySpoon> shevy, then maybe you could have simply said "here, start on this chapter"
Afal has joined #ruby
<shevy> <shevy> WhereIsMySpoon: dont listen to any of them. start here -> http://pine.fm/LearnToProgram/?Chapter=01
mattp_ has joined #ruby
<WhereIsMySpoon> wow
<WhereIsMySpoon> you just
<WhereIsMySpoon> dont read
<shevy> ^^^ I did show you precisely where to start. I cant link you into chapter 11 if you dont understand the things before
durre has joined #ruby
<defV> I have to agree with shevy
<WhereIsMySpoon> im gonna stop this conversation before i say something bad
<defV> and anything you already know & understand, just skip it
<shevy> The only real way to learn ruby is to start writing ruby scripts
senthil has joined #ruby
<shevy> and I also meant it that you don't *need* to understand blocks. You can really use just a subset of ruby and still be productive
<durre> is RVM the recommended way of handling ruby & it's gems?
<shevy> durre I would say the most natural one would be to compile ruby from source into /usr. I think when rubygems was started, RVM did not even exist
<shevy> (into /usr prefix that is)
<banistergalaxy> durre: yes use rvm
<defV> shevy: you still do that?
<defV> <3 rvm
<WhereIsMySpoon> so you cant pass functions as method parameters in ruby?
tatsuya__ has joined #ruby
<shevy> defV well actually no, I compile into /Programs/Name/Version, which expands to /Programs/Ruby/1.8.7something and /Programs/Ruby/1.9.3something
<WhereIsMySpoon> if you want to do that you do it with procs?
<defV> WhereIsMySpoon: you can, either as a block or with Class.method(:method_name)
<WhereIsMySpoon> oh ok..this tutorial says you can't pass methods into other methods (but you can pass procs into methods), and methods can't return other methods (but they can return procs).
<WhereIsMySpoon> soo
<defV> well, for anything you need to know in that tutorial, it's not possible
<defV> in fact, it's not very customary to pass methods to other methods
<defV> but it is possible
<shevy> you can do pretty much everything by using
<shevy> eval
<shevy> :)
<senthil> does the term 'composition' refer to combining objects or combining methods/modules into a single object?
<shevy> I'd assume it refers to behaviour and traits of objects
<senthil> shevy: so both?
<shevy> in ruby? I dont think you can detach behaviour from objects in ruby
<shevy> would be nice to ship behaviour between objects without being constrained to subclassing
<rippa> you can use array inside your object to store information
<rippa> that would be composition
<defV> yeah, most of the time, when the term composition is used in Ruby it's about module inclusion
<senthil> defV: yea, every example about 'composition vs inheritance' talks about modules
<rippa> I like this
<senthil> which is odd, since building more objects would be a better solution, not just cutting them into modules
<senthil> rippa: why not 'def_delegators'
cha1tanya has joined #ruby
<defV> senthil: yup, modules are for adding behaviour on classes
kng has joined #ruby
liluo has joined #ruby
Mac_ has joined #ruby
d3vic3 has joined #ruby
bassplayerdoug has joined #ruby
Rishi_ has joined #ruby
<visof> how can i check object is a hash or not ?
<visof> foo.class == "Hash" ?
<visof> foo.class.to_s == "Hash" ?
Mon_Ouie has joined #ruby
<WhereIsMySpoon> foo.class == Hash.class?
<TTilus> visof: foo.is_a? Hash
<visof> WhereIsMySpoon if foo hash it will return true
<visof> foo.class.to_s == "Hash"
canton7 has joined #ruby
<TTilus> visof: show the whole method
<TTilus> visof: pastie
apeiros_ has joined #ruby
Morkel has joined #ruby
<TTilus> visof: you might not want typechecking at all, but "duck type checking", i.e. foo.respond_to? :bar
<TTilus> visof: ok
<TTilus> visof: hows that gonna help in anything?
<TTilus> visof: and thats not what you are actually doing, right?
mneorr has joined #ruby
<TTilus> visof: what do you need that for?
<visof> TTilus, just curious about it
<TTilus> visof: "it" being?
<rippa> why do you convert it to string?
<visof> rippa, foo.class return string ?
<rippa> no
<rippa> why do you need a string?
<rippa> {}.class == Hash #=> true
<visof> rippa, ok
<visof> thanks
Foxandxss has joined #ruby
doublethink has joined #ruby
bburhans has joined #ruby
<visof> rippa, is my is_hash? method worse than is_a? Hash ?
<rippa> no idea
<rippa> but it probably is
<WhereIsMySpoon> visof i think the point is that you're writing extra code when you dont need to, and its superfluous
senthil has joined #ruby
<TTilus> visof: definitely worse
Indian has joined #ruby
<TTilus> visof: consider class SpecialHash < Hash; end; SpecialHash.new.is_hash? # => false
<visof> ah gotcha
<TTilus> visof: well, depends on what you want?
<TTilus> visof: you arent doing anything really arent you?
<visof> TTilus, you are right
<TTilus> visof: tried rubykoans?
<TTilus> visof: and tryruby?
<visof> what is that ?
d3vic3 has joined #ruby
<TTilus> visof: http://tryruby.org/
<TTilus> visof: http://rubykoans.com/
<WhereIsMySpoon> why is false.objectid == 0, true.objectid == 2 and nil.objectid == 4 ?
<WhereIsMySpoon> are they just values that were chosen for no particular reason
<WhereIsMySpoon> or am i missing something
<TTilus> WhereIsMySpoon: magical
<WhereIsMySpoon> then this koans tutorial is asking me to guess
<WhereIsMySpoon> wtf
<TTilus> WhereIsMySpoon: magical but constant
<TTilus> WhereIsMySpoon: check (-3..3).map &:object_id and you'll see the light
<WhereIsMySpoon> TTilus, sure but its asking me to fill in these values
<WhereIsMySpoon> for no particular reason
<WhereIsMySpoon> and how should i know them
<WhereIsMySpoon> if i havent known them before
<WhereIsMySpoon> as theyre magic numbers
<TTilus> WhereIsMySpoon: thats the whole point
<TTilus> WhereIsMySpoon: how do you find out?
mklappstuhl has joined #ruby
<TTilus> WhereIsMySpoon: apparently you _did_
<TTilus> WhereIsMySpoon: so you can =D
<WhereIsMySpoon> yes but i dont see the point
<WhereIsMySpoon> the exercise is useless
<WhereIsMySpoon> as it can only be completed by looking at the answer
<WhereIsMySpoon> :S
<WhereIsMySpoon> (-3..3).map &:object_id
<WhereIsMySpoon> => [-5, -3, -1, 1, 3, 5, 7]
<WhereIsMySpoon> what is this
<WhereIsMySpoon> o.o
<TTilus> WhereIsMySpoon: think about it
<workmad3> WhereIsMySpoon: the exercise is to get you to look at the object ids :)
<workmad3> WhereIsMySpoon: admittedly, it was much more useful to know that 'nil' had an id of 4 in 1.8.6 and 1.8.7 days
<TTilus> WhereIsMySpoon: theres more to the exercises than focusing to the answers to the questions, you learn the paths you walk
<cout> WhereIsMySpoon: if you really want to know the answer, look at the comments for rb_obj_id() in gc.c
<WhereIsMySpoon> TTilus, i tried Integer.object_id but that didnt help me to why the object ids for those numbers are like htat
<WhereIsMySpoon> i thought it might have been some combination of Integer.object_id adn the number
<workmad3> WhereIsMySpoon: it's a simple pattern tbh... just look at it
<TTilus> WhereIsMySpoon: integers (fairly constant things) have been assigned odd integers as their object ids
dbgster has joined #ruby
<WhereIsMySpoon> in that case
<WhereIsMySpoon> ah damn
<WhereIsMySpoon> i tried with floats
<WhereIsMySpoon> D:
<TTilus> WhereIsMySpoon: that is to free some (namely even) integers for other "fairly constant" objects, such as nil, true and false
<WhereIsMySpoon> ah ok
banistergalaxy has joined #ruby
<rippa> 111111111.object_id == 222222223; 1111111111.object_id == 9814548
<WhereIsMySpoon> er
<WhereIsMySpoon> im guessing 1111111111 is a long
<rippa> Bignum
<rippa> so, yeah
<WhereIsMySpoon> ok
<rippa> it only works on Fixnum
<WhereIsMySpoon> yea ok
<WhereIsMySpoon> what is an object_id of a integer useful for
<workmad3> WhereIsMySpoon: you can also gain some insight by looking at the object_id... if it's an odd number, then you have a Fixnum
<rippa> also, it's different each time
<rippa> tbh, I never used object_id at all
<workmad3> the object_id for a Fixnum is static
<workmad3> it's not exactly 'useful' info... but it's kinda interesting IMO :)
<rippa> for Bignum*
<WhereIsMySpoon> rippa, no it isnt
<WhereIsMySpoon> 3.object_id is alwasy 7
<rippa> for Fixnum it's static
<WhereIsMySpoon> oh ok
<TTilus> WhereIsMySpoon: ruby interpreter (kind of) instantiates bunch of objects every time it starts, the same way every time, nil, true, false and 0 belong to them, 1234.29348756 does not
<WhereIsMySpoon> heh so it is
<WhereIsMySpoon> so object_id for Bignum is useless
<rippa> 10.times.map {(10**12).object_id}
<WhereIsMySpoon> unless you want to use it for a random number generator algorithm
<TTilus> WhereIsMySpoon: definitely not useless
<WhereIsMySpoon> if it is rando
<WhereIsMySpoon> m
<workmad3> WhereIsMySpoon: it isn't random
<TTilus> WhereIsMySpoon: no
<WhereIsMySpoon> oh ok
<rippa> you can check if it's the same object
<WhereIsMySpoon> whats it useful for
<TTilus> WhereIsMySpoon: you identify the object
<rippa> a = b = 10**80
<rippa> a.object_id == b.object_id
<workmad3> WhereIsMySpoon: it's essentially the memory reference (sort of)
<rippa> a.object_id != (10**80).object_id
<TTilus> WhereIsMySpoon: if you ever want to identify particular object, you use object_id
<WhereIsMySpoon> i mean object_id specifically for bignums
<WhereIsMySpoon> doesnt seem useful
<workmad3> WhereIsMySpoon: it's as useful as for any object
<WhereIsMySpoon> but its different every time you ask for it
<workmad3> WhereIsMySpoon: which tells you?
<WhereIsMySpoon> i guess you could infer that its a bignum
<WhereIsMySpoon> but that would be a bit risky
<rippa> it means it's different object each time
<workmad3> WhereIsMySpoon: and is it different *every* time you ask for it? if I did 'a = 1111111111' and then '1000.times {a.object_id}' would I get a different number each time?
<WhereIsMySpoon> no idea
<WhereIsMySpoon> from the small test i did with 10 different executions of object_id it was different
<workmad3> WhereIsMySpoon: would there be a difference if I did '1000.times { 1111111111.object_id }' ?
<workmad3> WhereIsMySpoon: what does your intuition tell you happens? and can you test that intuition? ;)
<WhereIsMySpoon> hm
<workmad3> rippa: I'm trying to not just give the answer ;)
<WhereIsMySpoon> yea im thinking
scalebyte has joined #ruby
<WhereIsMySpoon> if you assign 1111111111111 to a
<WhereIsMySpoon> a is now a bignum
schovi has joined #ruby
<WhereIsMySpoon> but its in a different memory location than 111111111111
<WhereIsMySpoon> which is i assume just on the stack
<WhereIsMySpoon> stack
<scalebyte> what exactly is store..the essential difference between a hash and a store.. ??
<WhereIsMySpoon> i meant heap
<workmad3> WhereIsMySpoon: is it?
<WhereIsMySpoon> workmad3, id say yes
<WhereIsMySpoon> but i dont know
<WhereIsMySpoon> for sure
<WhereIsMySpoon> yes to your original question that is
<workmad3> WhereIsMySpoon: maybe you can test your answer? :)
<WhereIsMySpoon> about there being a difference
<rippa> if you assign object to a variable
<rippa> it's the same object each time
<WhereIsMySpoon> oh
<WhereIsMySpoon> yea so
<WhereIsMySpoon> i was right
<WhereIsMySpoon> :)
<WhereIsMySpoon> but not in the way i thought iw as
<WhereIsMySpoon> AHHH
<WhereIsMySpoon> i se
<WhereIsMySpoon> e
<WhereIsMySpoon> why it changes
<workmad3> WhereIsMySpoon: there we go :)
<WhereIsMySpoon> the bignum objhect is being recreated each time
<WhereIsMySpoon> so it has different id each time
<workmad3> bingo
<WhereIsMySpoon> but why
<rippa> bignum is arbitrarily big
<scalebyte> == scalebyte is waiting for a response
<rippa> you can't have them all precomputed
<rippa> unlike fixnum
<WhereIsMySpoon> ah yes
<WhereIsMySpoon> yep
<WhereIsMySpoon> ok
<WhereIsMySpoon> makes sense :p
<WhereIsMySpoon> you cant store infinity in a finite memory storage
<WhereIsMySpoon> :D
<workmad3> WhereIsMySpoon: yeah... and you can figure out that behaviour just by looking at the object_id ;)
frishi has joined #ruby
<workmad3> WhereIsMySpoon: bear in mind that the koans are as much about giving you insight into the language as they are about learning the syntax :)
<WhereIsMySpoon> well
<WhereIsMySpoon> that was certainly interesting
<WhereIsMySpoon> it is very strange to me
<WhereIsMySpoon> that ints are not primitive
<WhereIsMySpoon> and are objects
<WhereIsMySpoon> ^^
<scalebyte> WhereIsMySpoon: Please clean up your spoon :)
<workmad3> WhereIsMySpoon: yeah... but they're still different from other objects, as can be evidenced by their object id not following 'normal' rules ;)
<WhereIsMySpoon> ;)
<WhereIsMySpoon> i think scale needs help
<WhereIsMySpoon> :)
<workmad3> scalebyte: I don't know what you mean by a 'store'
<scalebyte> WhereIsMySpoon: yep.. I thought if you werent busy searching for the lost spoon of yours :) probably you can help me out a lil in understand what exatly is store and its difference with hash
<WhereIsMySpoon> i cant
<WhereIsMySpoon> i dont know what a store is
<WhereIsMySpoon> and im a beginner at ruby xD
<scalebyte> workmad3: seems likes its a rails concept... http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html
<WhereIsMySpoon> scalebyte, did you google it?
<workmad3> scalebyte: oh, a cache store
<workmad3> scalebyte: it's a backend for an ActiveSupport cache
<scalebyte> workmad3: Yes... could u explain a lil.. the doc seems very implicit
<workmad3> scalebyte: basically, you can implement a cache in different ways. The Cache store gives you an abstract interface to interact with the cache independent of the exact implementation
<workmad3> scalebyte: and then you could swap out implementations... e.g. you could start with just a big Hash stored in your process memory, but you could swap it out for an implementation that uses memcached, or one that uses redis, and they fit the same interface so you don't need to alter how you use the cache
<scalebyte> workmad3: so if I use a store over a hash I can cache it.. ryt ? apart from that I hope it doesnt get any better from there !!
<WhereIsMySpoon> ooh
<workmad3> scalebyte: you wouldn't create a Store normally... if you want to cache a value, you can grab the configured cache store from within your application, but you shouldn't just create one on the fly
<WhereIsMySpoon> i quite like this
<WhereIsMySpoon> array = Array.new
<WhereIsMySpoon> array << 1
<WhereIsMySpoon> thats nice
pastjean has joined #ruby
<workmad3> scalebyte: and if you're just looking for storing some values, you probably don't want to get into the mess that can be caching :)
<WhereIsMySpoon> instead of needing an add() function
<workmad3> WhereIsMySpoon: are you coming to us from java by any chance? :)
<WhereIsMySpoon> or push function rather
<WhereIsMySpoon> yes i know java, also python
<WhereIsMySpoon> i tried c++ for 2 months
<scalebyte> workmad3: ok now the matter is i have a user.rb and inside that http://pastie.org/3593007 i do this so that for each user inside Profile object (profile belongs to user ) the serialized attribute detail gets initialized with some values
LMolr has joined #ruby
<WhereIsMySpoon> i know how to use pointers somewhat but c++ was like one long slog
<WhereIsMySpoon> so i gave it up
<workmad3> scalebyte: in all honesty, you're likely to get better answers from the #rubyonrails channel
tenderloaf has joined #ruby
<scalebyte> workmad3: I cant get into that channel since my office IP is blocked in that channel..
<workmad3> (or at least, more discussion... I'm pretty active in there too, but I have to admit I'm going purely on intuition with these answers)
<workmad3> scalebyte: oh, is someone in your office a #rubyonrails troll?
dql has joined #ruby
nanderoo has joined #ruby
<workmad3> WhereIsMySpoon: C++ can be fun... but only once you get into templates really :)
<WhereIsMySpoon> workmad3, it was extremely difficult
<WhereIsMySpoon> and i got into language related issues almost immediately
<WhereIsMySpoon> which is just stupid
<scalebyte> workmad3: I think so :P its a big one so hard to find the culprit !!
<scalebyte> workmad3: could you please help me with this.?
<workmad3> scalebyte: in all honesty... I don't think you want a cache store
<workmad3> scalebyte: if you don't know the reasons for caching, and the pitfalls, you don't want to go down that route
<workmad3> WhereIsMySpoon: yeah, it can be annoying like that
<WhereIsMySpoon> if i have array = [ :stuff, :stuff1, :stuff2 ] why is array[0, 1] only [:stuff] instead of [:stuff, :stuff1]
mmokrysz has joined #ruby
mmokrysz has quit [#ruby]
<workmad3> WhereIsMySpoon: what would array[1,1] be?
<WhereIsMySpoon> [:stuff1] in my head
<workmad3> WhereIsMySpoon: first a guess based on intuition, then test it ;)
<WhereIsMySpoon> i know it will be []
<WhereIsMySpoon> because of what i now kno
<workmad3> WhereIsMySpoon: and what about array[2,1] ?
<WhereIsMySpoon> know*
<workmad3> WhereIsMySpoon: and test your answers ;)
<WhereIsMySpoon> [:stuff2]
<WhereIsMySpoon> ohhh
<WhereIsMySpoon> its from 0, 1 time
<WhereIsMySpoon> not from 0th to 1st element
<workmad3> WhereIsMySpoon: yup :)
<WhereIsMySpoon> k
tommyvyo has joined #ruby
<workmad3> WhereIsMySpoon: any ideas why ruby would have that syntax instead of the one you were thinking?
<WhereIsMySpoon> why is array [4,0] not an out of bounds exception
monban has joined #ruby
<WhereIsMySpoon> and instead just reutnrs nill
<WhereIsMySpoon> returns
<WhereIsMySpoon> if i have an array of less than length 4
<WhereIsMySpoon> that is
doublethink has joined #ruby
<WhereIsMySpoon> er, length 5
<WhereIsMySpoon> you get what i mean
<workmad3> WhereIsMySpoon: ok... that one I've never been convinced by :)
<WhereIsMySpoon> try it
<WhereIsMySpoon> array = [:stuff, :stuff1, :stuff2]
<workmad3> WhereIsMySpoon: yeah, I know it does it
<WhereIsMySpoon> array [4,0]
<WhereIsMySpoon> its just nil
<workmad3> WhereIsMySpoon: I've just never convinced myself it's 'correct'
catphish has joined #ruby
<WhereIsMySpoon> ah
sawgij has joined #ruby
<WhereIsMySpoon> eh
<WhereIsMySpoon> workmad3, if i do array = [:a, :b, :c]
<WhereIsMySpoon> then array[3,0]
<WhereIsMySpoon> it returns []
<WhereIsMySpoon> but if i do
<WhereIsMySpoon> array [4,0]
<WhereIsMySpoon> it returns nil
<WhereIsMySpoon> wtf is this
<WhereIsMySpoon> o.o
<WhereIsMySpoon> index 3 isnt even in the array
<WhereIsMySpoon> how can it not return nil
altivec_ has joined #ruby
<rippa> just accept it
<scalebyte> workmad3: where do you think using store (cache) are beneficial ?
<WhereIsMySpoon> D:
<rippa> not like you will use it or something
<WhereIsMySpoon> rippa, but array[3,0] isnt even IN the array
<rippa> it's just a weird corner case
<WhereIsMySpoon> if i do array[2,0] it also returns []
<WhereIsMySpoon> which is fine
<WhereIsMySpoon> because i am getting 0 elements
<rippa> think of indexes a places between elements
<rippa> 1 | :a | 2 | :b | 3 | :c | 4
<rippa> I mean
<rippa> 0..3
<WhereIsMySpoon> yea
<WhereIsMySpoon> its still frickin weird
<rippa> yes it is
<rippa> also, array[0..1] returns first two elements
<WhereIsMySpoon> it really looks to me like a bug :S
`brendan has joined #ruby
shevy has joined #ruby
anderse_ has joined #ruby
<banistergalaxy> WhereIsMySpoon: google 'weird ruby array slice behaviour'
<banistergalaxy> WhereIsMySpoon: ad you'll find a tonne of explanatins
gianlucadv has joined #ruby
anderse_ has quit [#ruby]
beha has joined #ruby
tingo has joined #ruby
mcwise has joined #ruby
nemesit has joined #ruby
gregorg_taf has joined #ruby
<apeiros_> if anybody knows a useable image pastebin, I can upload a pic explaining WhereIsMySpoon's issue
yalue has joined #ruby
<banisterfiend> apeiros_: imgur.com :P
<catphish> i'm having trouble with zombie processes, can someone check over my code and tell me how i might be able to more reliably kill and dispose of child precess trees? http://paste.codebasehq.com/pastes/ir57q7dvt3880puw75
<apeiros_> WhereIsMySpoon: http://imgur.com/zUeit
ccapndave has joined #ruby
lorandi has joined #ruby
<banisterfiend> apeiros_: that's cool, u should add it to channel topic as it's one of the most common questions we get in here ;)
<apeiros_> banisterfiend: I had an FAQ page once…
<apeiros_> I should put it up again on apeiros.me and add that to the channel topic
pu22l3r has joined #ruby
Jackneill has joined #ruby
Jackneill has joined #ruby
davidpk has joined #ruby
phantasm66 has joined #ruby
phantasm66 has joined #ruby
mcwise has joined #ruby
wubino has joined #ruby
Pwdrkeg has joined #ruby
<catphish> think i fixed my problem :)
<catphish> scope issue :)
tommyvyo has joined #ruby
iamjarvo has joined #ruby
Morkel has joined #ruby
<visof> hello
Beoran__ has joined #ruby
<visof> rails use a lot databases supported , what if i want to support ldap , where should i start ?
<visof> how can i do that ?
bigkm has joined #ruby
<visof> i want to migrate my rails app to use ldap instead of sql ?
<visof> how can i start doing that ?
kf8a has joined #ruby
Targen has joined #ruby
linoj_ has joined #ruby
theRoUS has joined #ruby
gabeh has joined #ruby
<roolo> Is it possible to have more rack apps in one directory? e.g. server for application and server for yard documentation
canton8 has joined #ruby
cloke has joined #ruby
tomzx has joined #ruby
jetblack has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
Russell^^ has joined #ruby
fr0gprince_ has joined #ruby
<WhereIsMySpoon> thanks apeiros_
shellox has joined #ruby
<shellox> hi!
cpruitt has joined #ruby
sbabiy has joined #ruby
<shellox> How can i dump the contents of a Nokogiri scheme? It works for a normal nokogiri document with doc.to_xml, but trying xsd.to_xml fails
<shellox> I tried xsd.methods then and there is no .to_xmll in it
<shellox> *.to_xml
<shellox> anyone have an idea how to do it right?
yoklov has joined #ruby
geekbri has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
nacengineer has joined #ruby
jetblack has joined #ruby
mneorr has joined #ruby
<WhereIsMySpoon> meh
<WhereIsMySpoon> i still dont think that if i have an array of length 2 that array[2,x] it should return []
<WhereIsMySpoon> it should either return nil or return a special value
<WhereIsMySpoon> but im sure people more intelligent than me have a reason
CannedCorn has joined #ruby
senthil has joined #ruby
Zugschlus has joined #ruby
<Zugschlus> hi
<Zugschlus> http://paste.debian.net/159699/ - why does this leave an empty file on the remote host instead of a file with six bytes of contents?
bglusman has joined #ruby
philips has joined #ruby
jgarvey has joined #ruby
TaTonka has joined #ruby
td123 has joined #ruby
rohit_ has joined #ruby
BrianE|mobile has joined #ruby
Vert has joined #ruby
paissad has joined #ruby
pastjean has joined #ruby
zandt has joined #ruby
GoBin has joined #ruby
malcolmva has joined #ruby
vraa has joined #ruby
crankycoder has joined #ruby
drake10 has joined #ruby
asobrasil has joined #ruby
ethd has joined #ruby
waxjar has joined #ruby
fmcgeough has joined #ruby
phantasm66 has joined #ruby
<WhereIsMySpoon> i thought if i did something like "ri class.method" it would show the doc?
bburhans has joined #ruby
nari has joined #ruby
<sarguru__> any pipe,dups experts around. I need some help with a small piece of code
nyuszika7h has joined #ruby
<zandt> WhereIsMySpoon, what is it doing instead ?
KL-7 has joined #ruby
<WhereIsMySpoon> i tried "ri Array.unshift"
<WhereIsMySpoon> and it says undefined method for unshift for Array:class
<WhereIsMySpoon> and i know unshift is an array method
jrist-afk has joined #ruby
<heftig> try "ri Array#unshift"
<WhereIsMySpoon> undefined method `ri' for main:Object
<heftig> not in irb
<WhereIsMySpoon> oh
<zandt> ah
carlyle has joined #ruby
<WhereIsMySpoon> er
<WhereIsMySpoon> it popped up some text
<WhereIsMySpoon> apparently i dont have it installed
carlyle has joined #ruby
<zandt> WhereIsMySpoon, that is exactly how I learned ri wasn't part of irb
<WhereIsMySpoon> :p
<zandt> :P
<sarguru__> somebody please tell me where I screwed this up http://pastebin.com/KGb1hePr
TaTonka_ has joined #ruby
zakwilson has joined #ruby
bbttxu has joined #ruby
pastjean has joined #ruby
<WhereIsMySpoon> you have some odd tabbing
<WhereIsMySpoon> ^^
<sarguru__> :(
mneorr has joined #ruby
<WhereIsMySpoon> on env_wr.puts you have it tabbed in
<sarguru__> I was trying to edit it a bit on the pastebin site and I screwed the tabbing too bigtime
<WhereIsMySpoon> :P
mneorr has joined #ruby
<WhereIsMySpoon> it just irks me :P
Drewch has joined #ruby
<WhereIsMySpoon> im a ruby newbie (woo rhyming) so dont expect an answer from me :P
waxjar has joined #ruby
<WhereIsMySpoon> ARGH
<WhereIsMySpoon> Why is gnome3 so goddam awful
jchauncey has joined #ruby
releod has joined #ruby
<zandt> WhereIsMySpoon, same here... when I said that was how I discovered ri wasn't part of irb, I meant like... yesterday.
<WhereIsMySpoon> haha
<WhereIsMySpoon> :D
<zandt> I was like: "I bet I know what's wrong..." lol
PaciFisT has joined #ruby
jchauncey has joined #ruby
allaire has joined #ruby
<allaire> hey guys, why does the brackets modify directly my object passed as an argument? see: https://gist.github.com/71ba9d288de7b0ee4e07
davidpk has joined #ruby
<allaire> reverse, and = operator does not modify my initial object that was passed as an argument, but [] do.
sbanwart has joined #ruby
zandt has joined #ruby
havenn has joined #ruby
tatsuya_o has joined #ruby
<WhereIsMySpoon> zandt, i only started last week with ruby :)
chson has joined #ruby
<zandt> WhereIsMySpoon, started monday. so far, so good
<WhereIsMySpoon> :D
<zandt> trying to be productive during spring break
<WhereIsMySpoon> good stuff
<WhereIsMySpoon> im a little bit
<WhereIsMySpoon> kinda
<WhereIsMySpoon> nervous
<WhereIsMySpoon> at the fact that if i do
<WhereIsMySpoon> a, = [a, b, c]
<WhereIsMySpoon> it doesnt blurt out an error
<WhereIsMySpoon> it just continues
<zandt> spoiler alert, I'm not that far
<WhereIsMySpoon> it wasnt for you :)
<zandt> haha
<zandt> let me ask you
<zandt> what is the comma for ?
<WhereIsMySpoon> its like if i had
<WhereIsMySpoon> a, b = [a, b, c]
<zandt> ahh
<WhereIsMySpoon> a = a
<WhereIsMySpoon> b = b
<zandt> I see
<WhereIsMySpoon> its just that
<WhereIsMySpoon> if i do that a, =[a, b, c]
<WhereIsMySpoon> it doesnt say YOU HAVE A COMMA WITH NOTHING AFTER IT
<zandt> haha
<WhereIsMySpoon> its a little worrying
<canton7> bit like python then :P
internet_user has joined #ruby
<zandt> you can have open parentheses @ the end of chain, as well
<zandt> er
<zandt> not open
<zandt> empty
<WhereIsMySpoon> nope CannedCorn
<zandt> sorry :P
<WhereIsMySpoon> oops
<WhereIsMySpoon> nope canton7
<WhereIsMySpoon> i just did that in python
<WhereIsMySpoon> python complains
<zandt> brb
moshee has joined #ruby
moshee has joined #ruby
<canton7> WhereIsMySpoon, ah, so it does. Python is rather fond of its trailing commas in general though
* WhereIsMySpoon pokes heftig
<heftig> aaaaah!
<WhereIsMySpoon> how come ruby doesnt churn out an error
<WhereIsMySpoon> when i do
<WhereIsMySpoon> a, = ['a', 'b', 'c']
<WhereIsMySpoon> and just carries on
<zandt> back
<WhereIsMySpoon> front
<zandt> left
<heftig> because.
<WhereIsMySpoon> *shiv*
<heftig> weird quirk of multiple assignment
<WhereIsMySpoon> thats the 2nd "weird quirk" today
<WhereIsMySpoon> :p
aibo has joined #ruby
kpshek has joined #ruby
arturaz has joined #ruby
<arturaz> Hey. Is there a way to regain STDOUT if I get Errno::EBADF: Bad file descriptor - Bad file descriptor when writing to it?
<canton7> WhereIsMySpoon, quote from o'reilly: "If you want to prevent the multiple rvalues from being combined into a single array, follow the lvalue with a comma. Even with no lvalue after that comma, this makes Ruby behave as if there were multiple lvalues"
<canton7> so, I'm guessing feature
<WhereIsMySpoon> ahhhhh
<WhereIsMySpoon> yea its so you can assign only the first part fo the array
<WhereIsMySpoon> without having to do x = array[0]
<zandt> ahhh
dv310p3r has joined #ruby
<WhereIsMySpoon> makes sense, thats quite cool
Beoran__ has joined #ruby
axl_ has quit [#ruby]
randym has joined #ruby
spox has joined #ruby
Indian has joined #ruby
tayy has joined #ruby
doublethink has joined #ruby
<WhereIsMySpoon> ehh
<WhereIsMySpoon> if i have
<WhereIsMySpoon> hash = { :one => "uno", :two => "dos" }
<WhereIsMySpoon> and then have
<WhereIsMySpoon> expected = { :one => "eins", :two => "dos" }
<WhereIsMySpoon> oh wiat
<WhereIsMySpoon> nvm
<WhereIsMySpoon> no
<WhereIsMySpoon> still
<WhereIsMySpoon> why is hash == expected
<WhereIsMySpoon> theyre different objects
<WhereIsMySpoon> sorry i missed a thing
<WhereIsMySpoon> hash[:one] = "eins"
axl_ has joined #ruby
AxonetBE has joined #ruby
<WhereIsMySpoon> hash = { :one => "uno", :two => "dos" }
<WhereIsMySpoon> hash[:one] = "eins"
<WhereIsMySpoon> expected = { :one => "eins", :two => "dos" }
snip_it has joined #ruby
fbernier has joined #ruby
<WhereIsMySpoon> why is hash == expected
* zandt head explode
<WhereIsMySpoon> if theyre different objects
<WhereIsMySpoon> surely you'd need some sort of compare method
<WhereIsMySpoon> and then they could be the same
<canton7> WhereIsMySpoon, hash comparisons are done value-by-value iirxc
<WhereIsMySpoon> but they are different objects
<canton7> *iirc
<WhereIsMySpoon> oh
<canton7> like strings, and arrays
<WhereIsMySpoon> wah ;_;
<WhereIsMySpoon> its like
<WhereIsMySpoon> the opposite
<WhereIsMySpoon> of java
<WhereIsMySpoon> D:
<canton7> almost all scripting languages do this sort of stuff for you
MasterIdler has joined #ruby
<WhereIsMySpoon> hm
<WhereIsMySpoon> ok
vipaca has joined #ruby
vipaca has joined #ruby
lockweel has joined #ruby
<canton7> WhereIsMySpoon, .equal? exists to determine object identity, if that's what you mean
<lockweel> hello, I'm wondering if someone knows any script or gem for data mining written in ruby...
<canton7> "Equality
<canton7> Unlike ==, the equal? method should never be overridden by subclasses: it is used to determine object identity (that is, a.equal?(b) iff a is the same object as b)."
<WhereIsMySpoon> canton7, ok
axl_ has joined #ruby
<WhereIsMySpoon> and whats up zandt? ^^
coreydaley has joined #ruby
<WhereIsMySpoon> canton7, are hashes unsorted
<zandt> WhereIsMySpoon, just reading
<zandt> you ?
<WhereIsMySpoon> no i mean
<WhereIsMySpoon> * zandt head explode
<canton7> WhereIsMySpoon, they're ordered in 1.9, not 1.8
AxonetBE has quit [#ruby]
<WhereIsMySpoon> sooo
<WhereIsMySpoon> hash1 = { :one => "uno", :two => "dos" }
<WhereIsMySpoon> hash2 = { :two => "dos", :one => "uno" }
<WhereIsMySpoon> (hash1 == hash2) == true in 1.8
<WhereIsMySpoon> but false in 1.9?
rowanu has joined #ruby
<canton7> i don't think equality tests order
<WhereIsMySpoon> ah
adambeynon has joined #ruby
<zandt> WhereIsMySpoon, head explode from trying to understand what everyone is saying here :P
<zandt> I'm not that far along
<WhereIsMySpoon> haha
<WhereIsMySpoon> ok :)
<WhereIsMySpoon> zandt, you new to programming in general?
<zandt> yeah
yoklov has joined #ruby
<WhereIsMySpoon> you tried the lrthw (learn ruby the hard way) tutorial?
<zandt> nope, I have some books
<WhereIsMySpoon> ah
<zandt> and I'm using them to compliment each other
<WhereIsMySpoon> that tutorial is for newbies to programming
<zandt> pickaxe + well-grounded rubyist + poignant guide + learn to program (chris pine)
<WhereIsMySpoon> i see
<WhereIsMySpoon> oki :)
<zandt> learn to program is very, very basic so I start learning about a concept there
<WhereIsMySpoon> cool
<zandt> then shift to the pickaxe
<zandt> and when I feel like I can't read anymore, why's guide
iocor has joined #ruby
<zandt> I dunno, reward system I guess
<WhereIsMySpoon> haha
<WhereIsMySpoon> :)
<zandt> :)
<zandt> I'll check out learn ruby the hard way though
<WhereIsMySpoon> its quite intensive
<WhereIsMySpoon> but seems to go over all the basics in a really solid way
<WhereIsMySpoon> its just a bit basic for me ;P
<WhereIsMySpoon> *:P
<zandt> do you have previous prog exp?
ethicalhack3r has joined #ruby
axl_ has joined #ruby
<WhereIsMySpoon> yes
<ethicalhack3r> Hi, how do I return an array of matches from this? "open_ports = nmap_output[%r{<port protocol="tcp" portid="(.+)">.+</port>}]"
polarist has joined #ruby
pastjean has joined #ruby
<ethicalhack3r> open_ports returns a string
<WhereIsMySpoon> zandt, id say if you learnt ruby as a first language, you might struggle with learning a strict language like java, or a pointer-oriented language like c++ or C, but you need to start somewhere :)
<WhereIsMySpoon> by strict i mean type strict
<canton7> ethicalhack3r, you probably want #scan
<zandt> :D well, I think I would struggle with java or C++ without learning ruby, too
<WhereIsMySpoon> but java isnt all that complicated anyway
<WhereIsMySpoon> c++ is hard D:
<scalebyte> does anybody know a lil bit of rails out here ?
<WhereIsMySpoon> scalebyte, #rubyonrails
<ethicalhack3r> canton7, thanks, I'll have a look
<scalebyte> WhereIsMySpoon: I told you the reason in afternoon
rippa has joined #ruby
<WhereIsMySpoon> oh sorry that was you
<WhereIsMySpoon> scalebyte, try a different server and #rubyonrails?
<WhereIsMySpoon> maybe there'll be one on one of the other big ones
<scalebyte> WhereIsMySpoon: IP is shared.. or else I will have to go home :(
<scalebyte> WhereIsMySpoon: you found your spoon ?
<WhereIsMySpoon> scalebyte, imean try a different irc server
<WhereIsMySpoon> like coldfront
<WhereIsMySpoon> or whatever
<WhereIsMySpoon> and no
<WhereIsMySpoon> D:
<scalebyte> WhereIsMySpoon: how do i do that ?
<WhereIsMySpoon> ./server irc.coldfront.net
Gesh has joined #ruby
<scalebyte> ./server irc.coldfront.net
<WhereIsMySpoon> or whatever you wnat
<WhereIsMySpoon> without the dot
<WhereIsMySpoon> :p
<scalebyte> WhereIsMySpoon: :)
<scalebyte> WhereIsMySpoon: i ran the command
<scalebyte> nothing happened
<WhereIsMySpoon> o.o
<zandt> fortunately scalebyte wasn't asking how to identify their nick
<WhereIsMySpoon> rofl
<zandt> scalebyte, do it without the dot
<zandt> /server irc.coldfront.net
<scalebyte> zandt: ya i ran it
<zandt> what irc client are you using ?
WhereIsMySpoon has joined #ruby
<zandt> or are you using a browser ?
<scalebyte> zandt: I am via web
<zandt> ahh
<scalebyte> zandt: yes
<zandt> there's your problem
<WhereIsMySpoon> ah
<WhereIsMySpoon> use a client
<zandt> freenode web chat doesn't let you switch servers
<WhereIsMySpoon> like everyone else :P
<WhereIsMySpoon> xchat or mirc are good
<scalebyte> WhereIsMySpoon: a good client for ubuntu
<WhereIsMySpoon> xchat
<zandt> xchat for ubuntu
<WhereIsMySpoon> is what im using
<scalebyte> WhereIsMySpoon: ok
<WhereIsMySpoon> irssi is what some people will tell you
<WhereIsMySpoon> dont listen to them
<zandt> very simple to use
<scalebyte> sudo apt-get install xchat will do ?
<WhereIsMySpoon> er
<canton7> I used weechat-curses when I'm on linux
<WhereIsMySpoon> yes scalebyte
<scalebyte> WhereIsMySpoon: thanks spoon
<zandt> irssi is simple to use, after you learn to use it.... xchat is probably going to be easier to navigate out the box
<WhereIsMySpoon> ye
<zandt> canton7, never heard of that
<scalebyte> WhereIsMySpoon: i got it installed spoon and in the UI i have networks to choose from which one to chose ?
<WhereIsMySpoon> freenode is this network
mikepack has joined #ruby
<WhereIsMySpoon> the one you're on right now
CannedCorn has joined #ruby
<zandt> scalebyte, where are you trying to go ?
<scalebyte> zandt: #rubyonrails
axl_ has joined #ruby
<WhereIsMySpoon> he wants a ror channel he isnt banned on
<WhereIsMySpoon> :P
abstrakt has joined #ruby
wmoxam has joined #ruby
<scalebyte> WhereIsMySpoon: not me the ip isnt banned on :)
<WhereIsMySpoon> well, not him, but his work's ip
<zandt> ah
<WhereIsMySpoon> so scalebyte, press the xchat menu option a tthe top
<WhereIsMySpoon> new
<WhereIsMySpoon> server window
<WhereIsMySpoon> click the new one and type ./server irc.coldfront.net
<WhereIsMySpoon> without the dot
<WhereIsMySpoon> otherwise you'll disconnect from here
<WhereIsMySpoon> like i did
Rezwan has joined #ruby
<WhereIsMySpoon> er scalebyte sorry
<WhereIsMySpoon> there isnt a #rubyonrails channel there
<WhereIsMySpoon> D:
<WhereIsMySpoon> er
Indian has joined #ruby
<scalebyte> WhereIsMySpoon: i chose the freenode network
<WhereIsMySpoon> freenode is this one
<scalebyte> WhereIsMySpoon: now its showing the message
polarist has joined #ruby
<scalebyte> WhereIsMySpoon: * Looking up irc.freenode.net * Connecting to chat.freenode.net (213.179.58.83) port 8001...
<scalebyte> WhereIsMySpoon: but not connecting
iocor has joined #ruby
<WhereIsMySpoon> it should take a few seconds
cha1tanya has joined #ruby
<scalebyte> WhereIsMySpoon: then which network to choose spoon ?
<WhereIsMySpoon> scalebyte, whatever one you want to try
<WhereIsMySpoon> scalebyte, try googling for #rubyonrails channels
<WhereIsMySpoon> that arent on freenode
<scalebyte> WhereIsMySpoon: my system is through proxy.. is that a concern ?
<zandt> yeah, you need to set up the connection options to connect
<zandt> however, I am not the man to help with that
<zandt> as I've never done it
<scalebyte> zandt: hmmm... it better asking it on SO till I get home
<WhereIsMySpoon> scalebyte, SO is a good place to ask
<scalebyte> WhereIsMySpoon: where u from spoon ?
<WhereIsMySpoon> secret
sacarlson has joined #ruby
<zandt> gotta run, take care everyone
InBar has joined #ruby
Targen has joined #ruby
<scalebyte> WhereIsMySpoon: why is it a secret ?
nemesit|osx has joined #ruby
nemesit has joined #ruby
lockweel has joined #ruby
nemesit has joined #ruby
<lockweel> hello, I'm searching for any starting script or gem to do data mining. Does anyone knows?
allaire has quit [#ruby]
crankycoder has joined #ruby
<WhereIsMySpoon> scalebyte, because
<WhereIsMySpoon> canton7, if i say a="asd" and then b=a, if i then do b << "dsa" why does a become "asddsa"?
<heftig> because it doesn't make a copy
<WhereIsMySpoon> ><
<heftig> if you want a copy, do b = a.dup
<WhereIsMySpoon> ruby is like
<WhereIsMySpoon> if there was ever an opposite to java
<WhereIsMySpoon> in everything
<WhereIsMySpoon> ruby would be it
<WhereIsMySpoon> thanks hef
<heftig> no, java is the same way
<heftig> you just don't notice it with strings because you can't mutate strings in java
<WhereIsMySpoon> so if i did in java
<spox> you could just use += in place of the << to get an implicit dup
<WhereIsMySpoon> char[] a = ['a', 'b', 'c']
<canton7> WhereIsMySpoon, also, bear in mind that << (on strings) mutates the original string. If you want to create a new copy, try b += "dsa"
ohdae has joined #ruby
<WhereIsMySpoon> then char[] b = a
<WhereIsMySpoon> and did b[3] = 'd'
sarguru__ has joined #ruby
<ohdae> Whats up guys, got a quick question (hopefully quick :p )
<WhereIsMySpoon> a[3] == 'd'?
caiges has joined #ruby
<ohdae> How do I add a string as an item in an array?
<WhereIsMySpoon> im sure that isnt right
<WhereIsMySpoon> ohdae, array << mystring
<ohdae> I have an array and I iterate through the array and perform a function on each item. I want to take the output of that function and add it to a new array
<scalebyte> WhereIsMySpoon: I am confused spooon :p
<ohdae> WhereIsMySpoon: great, ty
<ohdae> i tried array += output
<ohdae> but no go heh
Barakas has joined #ruby
<rippa> you can sum arrays
<spox> array += [string]
<rippa> array += other_array
<ohdae> I am just learning Ruby now, i'm a python guy so its alittle tricky for some things
<ohdae> hmm
Barakas has joined #ruby
<ohdae> and could I add each item from the new array to correspond with the original arrays position?
ckrailo has joined #ruby
<heftig> WhereIsMySpoon: indeed that happens in java.
<WhereIsMySpoon> hm
pdtpatr1ck has joined #ruby
<WhereIsMySpoon> im obviously an idiot :p
<ohdae> like array1 = [ "a", "b", c"] array2 = [ "yes","maybe",no"] array1 += array2 output being something like a : yes b: maybe c: no
Barakas has joined #ruby
<WhereIsMySpoon> you want a hash
<WhereIsMySpoon> if you want to link keys and values
<canton7> ohdae, are you after #zip ?
<ohdae> yeah exactly
<ohdae> but only after i get the output from my iteration of the first array
<ohdae> #zip?
<canton7> Hash[arr1.zip(arr2)]
<WhereIsMySpoon> ooh
Ammar01 has joined #ruby
<WhereIsMySpoon> thats awesome
<ohdae> damn ruby confuses the hell out of me sometimes lol
<WhereIsMySpoon> er except
<ohdae> all the 'end's drive me crazy :p
<WhereIsMySpoon> no thats fine
<WhereIsMySpoon> thats a pretty cool function
yeggeps has joined #ruby
<ekaleido> sh mac address-table | i 0025.b544.012f
<canton7> ohdae, zip works exactly as it does in python
<WhereIsMySpoon> ohdae, that will do exactly what you want
<ekaleido> oops
<WhereIsMySpoon> :p
<ohdae> WhereIsMySpoon: canton7: great thank you :D
<ohdae> i wrote my first ever succesful ruby script yesterday..well two of them actually
<ohdae> and now im on a roll heh
<canton7> good feeling, huh? :)
<WhereIsMySpoon> im bored of writing games
<ohdae> There are so many functions I want to convert from a project I have in python but i just dont know how heh
<ohdae> im getting there
<WhereIsMySpoon> anyone got a good idea for a ruby script or two to write?
<canton7> WhereIsMySpoon, IRC bots are immensely popular
<lockweel> yes data mining one :P
<WhereIsMySpoon> canton7, thats a little advanced
<WhereIsMySpoon> id have to do network stuff
<canton7> WhereIsMySpoon, not really. The basics are trivial
<WhereIsMySpoon> canton7, i only started ruby last week
<WhereIsMySpoon> o.o
<WhereIsMySpoon> and network stuff is never trivial
<WhereIsMySpoon> :L
<lockweel> the world is full of
<lockweel> data
<lockweel> out there
<WhereIsMySpoon> look mr lockweel
krz has joined #ruby
<WhereIsMySpoon> *shiv*
<WhereIsMySpoon> stop your data nonsense :p
<lockweel> data - information - knowledge sir MySpoon
<lockweel> bs Business Admin
<WhereIsMySpoon> im not writing a datamining program for you
<WhereIsMySpoon> :p
<canton7> WhereIsMySpoon, untested, but this is the basics: http://pastie.org/3594157
<WhereIsMySpoon> are you serious
<WhereIsMySpoon> o.o
<WhereIsMySpoon> what does select do
ruby_user has joined #ruby
<lockweel> is it summer time script?
<canton7> i'm trying to remember -- that's from my bot, a while back
albemuth has joined #ruby
Morkel has joined #ruby
<lockweel> i can do it myself
<lockweel> canton7 this reminds me the summertime gem
<ruby_user> Is there a regex/statement to reduce the following code: "if RUBY_PLATFORM =~ /win/ || RUBY_PLATFORM =~/mingw32/ then" ?
cloke has joined #ruby
<heftig> =~ /win|mingw32/
<canton7> WhereIsMySpoon, freezes until there's some activity irrc. You might need another nil parameter
nachtwandler has joined #ruby
<canton7> WhereIsMySpoon, you can also make it wait for input from $stdin or @irc
<ruby_user> can I use this this in a case statement? like "when /win|mingw/" ?
<ruby_user> thanks
<WhereIsMySpoon> canton7, what port do i use?
<WhereIsMySpoon> to connect to freenode for example
jasond has joined #ruby
<canton7> WhereIsMySpoon, 6667
<rippa> 6667 works almost everywhere
InBar has joined #ruby
<WhereIsMySpoon> canton7, it doesnt work :(
<canton7> WhereIsMySpoon, ang on, as I said, it's untested
A_D has joined #ruby
<WhereIsMySpoon> :P
<WhereIsMySpoon> kk
<ohdae> oh man im getting closer atleast
iocor has joined #ruby
<ohdae> so now i have my 'output' array and my starting 'apps' array. I iterate through apps and perform a function I wrote 'whereis' on each
<ohdae> giving me output += [whereis(items)]
<ohdae> so then output gets filled with the results from whereis(items) items being each item in the 'apps' array
<ohdae> if i do location = Hash[apps.zip(output)] unless output == nil
jgrevich has joined #ruby
<canton7> WhereIsMySpoon, change that @irc.send(line) to just a 'puts line' -- it will confuse the irc server as is
<ohdae> I get one huge array. Can I separate each line somehow?
<canton7> WhereIsMySpoon, when you do want to send stuff, you'll need @irc.send(data, 0)
<ohdae> Like output += [which(items)] + "\n\/"
<lockweel> :P intresting work here
InBar_^ has joined #ruby
drake10 has joined #ruby
<lockweel> may I ?
<canton7> as long as it's not illegally or morally wrong
blueadept has joined #ruby
<canton7> (what was the question? :P)
<ohdae> heh
<canton7> *illegal
<lockweel> you may need threading for any gui support i suppose
LMolr has joined #ruby
kenperkins has joined #ruby
centipedefarmer has joined #ruby
<lockweel> consider that for the future
<WhereIsMySpoon> canton7, all that happens when i run the script is it just executes as if nothing printed out, and isnt in a loop
<WhereIsMySpoon> user~$ ./ircBot.rb irc.freenode.net 6667
<WhereIsMySpoon> user~$
<WhereIsMySpoon> thats it
MasterIdler has joined #ruby
<WhereIsMySpoon> and yes i have a shebang
serban has joined #ruby
asteve has joined #ruby
serban has quit [#ruby]
Synthead has joined #ruby
<asteve> i want to use options for a ruby script but i don't want to require an argv; example: "jump.rb --how-high 20" but "jump.rb" will automatically jump 10
<wubino> I am doing the edge_case koans and I do not understand the utility in this one http://paste.ubuntu.com/883432/
<wubino> I just put 'true'
<asteve> i'm using optparse now
<WhereIsMySpoon> wubino, the idea is that everythin gin ruby is an object
<WhereIsMySpoon> even "null"
<wubino> ok
<wubino> Thanks
neurodrone has joined #ruby
neurodrone has joined #ruby
kenyabob has joined #ruby
<WhereIsMySpoon> canton7?
<lockweel> where is the code?
bwlang has joined #ruby
<WhereIsMySpoon> lockweel, <canton7> WhereIsMySpoon, untested, but this is the basics: http://pastie.org/3594157
<drake10> Is there a unix command to include only lines with a certain pattern?
<WhereIsMySpoon> drake10, grep?
rowanu has joined #ruby
<WhereIsMySpoon> cat myfile.txt | grep "pattern"
<WhereIsMySpoon> eh but that wont get the whole line
<WhereIsMySpoon> just the pattern
<drake10> whereIsmyspoon: I want to scan thru a file and find the lines that have a particular string, how to use it
<kenyabob> Is there a way create an archive of an existing url into a single file/
<WhereIsMySpoon> drake10, easier in python
<drake10> WhereIsMySpoon: can I redirect the whole lines to another file?
ed_hz_ has joined #ruby
ChampS666 has joined #ruby
<WhereIsMySpoon> file = open(myfile.txt, 'r')
<WhereIsMySpoon> for line in file:
<lockweel> i think is good placing '#!/usr/bin/env ruby'
<lockweel> at start of the script
<WhereIsMySpoon> if line.contains("pattern"):
<WhereIsMySpoon> blah
<lockweel> to run automatic
<WhereIsMySpoon> or something like that
<WhereIsMySpoon> ah
InBar has joined #ruby
<WhereIsMySpoon> i can see the errors now lockweel
asteve has quit [#ruby]
<rippa> damn
<rippa> Grep searches the named input FILEs (or standard input if no files are
<rippa> named, or the file name - is given) for lines containing a match to the
<rippa> given PATTERN. By default, grep prints the matching lines.
<rippa> wring buffer
<WhereIsMySpoon> hm wait no
<rippa> *o
<rippa> grep prints whole lines
<rippa> not pattern
wyhaines has joined #ruby
<WhereIsMySpoon> actually lockweel doesnt make any difference
<drake10> Ok got it: grep "pattern" filename.txt > newfile.txt
n3m has joined #ruby
<WhereIsMySpoon> i thought that would only print out the actual pattern
<WhereIsMySpoon> not th ewhole line
<WhereIsMySpoon> eh im stupid, that would be a bit of a useless tool if it did that i guess :P
<lockweel> it's good practice in order to source it immediately and not type ruby blahblah.rb
<WhereIsMySpoon> lockweel, i wasnt doing that anyway
DrShoggoth has joined #ruby
<WhereIsMySpoon> lockweel, im still just getting nothing when i run it
<lockweel> yes I think ubuntu source any script in abundance
<WhereIsMySpoon> what
davidpk has joined #ruby
sroy2 has joined #ruby
oooPaul has joined #ruby
daniel_hinojosa has joined #ruby
mafolz has joined #ruby
shell0x_ has joined #ruby
KL-7 has joined #ruby
ascarter has joined #ruby
<ohdae> Okay time to get back to work =\
<WhereIsMySpoon> what the hell
<ohdae> later guys, thanks for the help
<WhereIsMySpoon> a="asdsa"
ohdae has quit [#ruby]
<WhereIsMySpoon> a[1] = somerandomnumber?
<WhereIsMySpoon> wtf
<WhereIsMySpoon> why isnt a[1] == 's'?
<oooPaul> You're getting back the ASCII value of the character. That was changed in Ruby 1.9.2, I think, so I'm betting you're on 1.8.7.
<oooPaul> a[1].chr will get you back the character string.
<WhereIsMySpoon> im not on 1.8.7
<WhereIsMySpoon> im on 1.9.2
<WhereIsMySpoon> hm
<WhereIsMySpoon> well
<WhereIsMySpoon> i thought i was
<oooPaul> :)
<lockweel> WhereISMySpoon you need somehow to place @irc.put "USER"
<lockweel> @irc.puts "NICK"
<WhereIsMySpoon> lockweel, after the TCPSocket.open?
<lockweel> yes after, I guess before loop.. I don't undertand the select( ) method still
<WhereIsMySpoon> :(
Ammar01 has joined #ruby
sterNiX has joined #ruby
<rippa> with gems making bot is trivial
Karmaon has joined #ruby
<ethicalhack3r> Hi, how would I express in regex that this whole string may or not be there, but it it is, capture its value? product="([a-zA-Z|\s]+)"
<rippa> but it's not really learning anything
canton7 has joined #ruby
<canton7> WhereIsMySpoon, http://pastie.org/3594491 was the full source
<rippa> ethicalhack3r: /([a-zA-Z|\s]+)?/
Jake232 has joined #ruby
<canton7> WhereIsMySpoon, I did write that ages ago, so there's probably some horrific practices in there
<WhereIsMySpoon> canton7, it doesnt even run :P
<canton7> WhereIsMySpoon, runs fine for me
<WhereIsMySpoon> canton7, you on 1.9.2
<WhereIsMySpoon> ?
<canton7> 1.9.3
lkba has joined #ruby
phantomfakeBNC has joined #ruby
<WhereIsMySpoon> ah im on 1.8.7
<canton7> probably it
eywu has joined #ruby
<WhereIsMySpoon> how do i upgrade
maletor has joined #ruby
<WhereIsMySpoon> i seem to have a load of folders in my /usr/share/ruby-rvm/patches/ruby folder
<lockweel> WhereIsMySpoon: use rvm
<WhereIsMySpoon> 1.8.4, 1.8.5, up to 1.9.2
<lockweel> haah
Dreamer3 has joined #ruby
<WhereIsMySpoon> lockweel, if i type "rvm" into the console it says "cat: /usr/share/ruby-rvm/README: No such file or directory"
<WhereIsMySpoon> :L
<lockweel> LOL
<WhereIsMySpoon> thats useful thanks
<lockweel> try ping rvm :P
<WhereIsMySpoon> ?
<WhereIsMySpoon> rvm isnt a hostname
pu22l3r_ has joined #ruby
<lockweel> shit happens I no
<WhereIsMySpoon> what
<lockweel> it could
<WhereIsMySpoon> on earth
superguenter has joined #ruby
<WhereIsMySpoon> are yuo talking about
lateau has joined #ruby
<lockweel> though
<lockweel> which rvm better
alex__c2022 has joined #ruby
tayy has joined #ruby
SegFaultAX|work has joined #ruby
<robacarp> you guys. enter and space are not equivalent punctuation.
deryl has joined #ruby
<oooPaul> There's a shift key, too. :P
<oooPaul> Y'know, if you're gonna get picky. ;)
bwlang_ has joined #ruby
<WhereIsMySpoon> robacarp, at least im making sense
<WhereIsMySpoon> :p
klaas has joined #ruby
<robacarp> oooPaul: Fair enough.
<wmoxam> WhereIsMySpoon: that's arguable ;)
<WhereIsMySpoon> :p
adeponte has joined #ruby
<WhereIsMySpoon> does ruby compile to bytecode
<WhereIsMySpoon> or C
<WhereIsMySpoon> er
<WhereIsMySpoon> i meant bytecode or machine code
<WhereIsMySpoon> not or C
<oooPaul> No.
<WhereIsMySpoon> derp
<WhereIsMySpoon> No?
<oooPaul> Although people have tried to get it to compile to Java bytecode.
<WhereIsMySpoon> whats it compiel to
<WhereIsMySpoon> compile*
<wmoxam> WhereIsMySpoon: depends on the interpreter although none compile to machine code
<oooPaul> Nothing. It's a scripted language.
<oooPaul> Interpreted at runtime.
<WhereIsMySpoon> i meant whats underneath it
pastjean has joined #ruby
<wmoxam> oooPaul: YARV and rubinius compile to bytecode
confounds has joined #ruby
<oooPaul> Yeah.
<wmoxam> WhereIsMySpoon: and interpreter
<wmoxam> *an
<oooPaul> With various degrees of success. :)
<wmoxam> oooPaul: um, with complete success
<wmoxam> their interpreters only interpret bytecode
<oooPaul> I don't believe your claim of "complete" success. :)
demian`_ has joined #ruby
<wmoxam> oooPaul: you must have a weird definition of what is a complete success then
waxjar has joined #ruby
<wmoxam> they run bytecode. It works.
<wmoxam> :p
t0mmyvyo has joined #ruby
sawgij has joined #ruby
<oooPaul> I'm sure I can write some Ruby that runs great and correct in the interpreter, but fails miserably once compiled to bytecode.
<WhereIsMySpoon> wmoxam, oooPaul i just did rvm install 1.9.3 but it says its already installed
<WhereIsMySpoon> but when i do ruby --version it says 1.8.7
kremiak has joined #ruby
<wmoxam> oooPaul: ok. Go for it
<WhereIsMySpoon> i know its a .bashrc setting
<WhereIsMySpoon> but what do i need to do
<wmoxam> WhereIsMySpoon: rvm use 1.9.3
<WhereIsMySpoon> aha
<WhereIsMySpoon> :D
<oooPaul> WhereIsMySpoon, are you sure you're using it? "rvm info" will tell you which is being used *right now*
<WhereIsMySpoon> u da man
<WhereIsMySpoon> works now oooPaul
<oooPaul> Yeah, what wmoxam said. :)
<WhereIsMySpoon> er well
<WhereIsMySpoon> no
<WhereIsMySpoon> it doesnt
<WhereIsMySpoon> only for that console session
<deryl> because you didn't --default
<WhereIsMySpoon> i guess i need to put rvm use 1.9.3 in my .bashrc or smth
<deryl> rvm use 1.9.3-p290@mygemset --default
<deryl> close the session and reopen it
<oooPaul> Does your code have a .rvmrc in it that isn't pointed at the same place?
<deryl> rvm info should now show it correctly
matti has joined #ruby
<deryl> and there is that too :)
<WhereIsMySpoon> oooPaul, i dont have any code
<WhereIsMySpoon> im just trying to get the right ruby version running when i do ruby --version
willyum has joined #ruby
<oooPaul> I see, you've got multiple consoles open. RVM only applies to the current session.
<WhereIsMySpoon> deryl, whats mygemset
theRoUS has joined #ruby
theRoUS has joined #ruby
<oooPaul> So either you need to do 'rvm use ruby-1.9.3' in all the windows you're planning to work in, or set it up as a default in your .bashrc.
<WhereIsMySpoon> yea
<WhereIsMySpoon> ok
<deryl> if you use gemsets you can select a gemset to be used by default
<deryl> see rvm.beginrescueend.com under Gemsets
<deryl> no you don't use the bashrc
<WhereIsMySpoon> i dont know what a gemset is
<deryl> nor the bash_profile
<WhereIsMySpoon> using the bashrc works
<deryl> you rvm use 1.9.3 --default
<deryl> you're not reading directions
symb0l has joined #ruby
<WhereIsMySpoon> deryl, that still doesnt work for a new console session
<deryl> --default does
<WhereIsMySpoon> no it doesnt
<WhereIsMySpoon> i jsut tried it
<deryl> rvm use 1.9.3 --default then close the session and reopen it
<deryl> type rvm | head -n1
<deryl> thats the command 'type' not an instruction to do so
<WhereIsMySpoon> oh
<WhereIsMySpoon> "rvm is a function"
<deryl> ok
<WhereIsMySpoon> ...
<WhereIsMySpoon> soo
<deryl> ok so rvm is correctly set up. now remove ANY rvm use x.x.x lines from your .bashrc and .bash_profile. leave the rvm source lines that actually load rvm as per instructions page
<deryl> then log out then back in then rvm use 1.9.3 --default
<WhereIsMySpoon> why would i need to log out
<deryl> also try switching to a diff ruby with the --default, close the sessions ALL OF THEM
<deryl> because you need to reinitialize the environment
<deryl> close the terminal session
<WhereIsMySpoon> logout != close the terminal
<WhereIsMySpoon> o.o
<WhereIsMySpoon> but ok
wyhaines has joined #ruby
<deryl> WhereIsMySpoon: you wanna get pedantic with me? how do *I* know if you're running a terminal or a console session?
<WhereIsMySpoon> user:~$ rvm use 1.9.3 --default
<WhereIsMySpoon> Using /usr/share/ruby-rvm/gems/ruby-1.9.3-p125
<WhereIsMySpoon> sorry :)
<WhereIsMySpoon> ok so
<WhereIsMySpoon> now i just open a new console session and it should work?
<deryl> did you close ALL the terminal sessions?
<deryl> terminal console whatever you're using
ringotwo has joined #ruby
<deryl> reinit everything totally
<WhereIsMySpoon> all the ones that i'd put ruby commadns in
<lockweel> where on earth you found p125
<deryl> dude, just play along. close all your terminals. every one that you've launched since starting this
audy has quit ["Textual IRC Client: http://www.textualapp.com/"]
<WhereIsMySpoon> ok
<oooPaul> p290 is for 1.9.2; not sure what patchlevel 1.9.3 is at
<WhereIsMySpoon> so again
<deryl> i don't have the time nor the patience to play 20 20 with environments. reinit the whole stack - its just a simple terminal (gnome-terminal, konsole whathaveyour, right?)
<deryl> not that hard
<WhereIsMySpoon> yes ive done that
<deryl> oooPaul: i wa just throwing out an example
<WhereIsMySpoon> and run the rvm use command
<deryl> p125 is latest 1.9.3 to be exact
<oooPaul> deryl, was talking to lockweel
<deryl> ah
<deryl> WhereIsMySpoon: ok, you did rvm use 1.9.3 --default right?
<deryl> open a new term
<WhereIsMySpoon> yes
<WhereIsMySpoon> k
<deryl> rvm info
<WhereIsMySpoon> ok
<WhereIsMySpoon> do you want a copy of it?
<deryl> is it still defaulting elsewhere?
<lockweel> rvm list know shows -p0 to me
<WhereIsMySpoon> rvm info doesnt say anything about the ruby version
<deryl> umm yes it does
<deryl> or it should
<WhereIsMySpoon> nope
<deryl> 3rd section down
<deryl> gist it
<deryl> is this a per user or a multi-tenency install? (homedir vs /usr/local)
<deryl> tenancy even
<WhereIsMySpoon> there is one user on this pc
<WhereIsMySpoon> and user info is in /home
gianlucadv has joined #ruby
<deryl> but is that were you installed it?
<WhereIsMySpoon> whereis ruby
<WhereIsMySpoon> ruby: /usr/bin/ruby /usr/bin/ruby1.8 /usr/lib/ruby /usr/share/man/man1/ruby.1.gz
<deryl> in $HOME or did you install it under /usr/local which requires sudo command?
<deryl> nope can't rely on whereis
<WhereIsMySpoon> MY_RUBY_HOME is blank
<deryl> whereis is updatedb backed and thats only done like once a week
<deryl> which ruby
<WhereIsMySpoon> rvm list shows ruby-1.9.3-p125
<deryl> what has the * next to it?
<WhereIsMySpoon> and says default ruby not set
havenn has joined #ruby
<lockweel> where do I find p125
<deryl> rm $HOME/.rvm/environments/default
<lockweel> i use -p0 :(
<deryl> then close the term and reopen it so that rvm sees NO default selection even by file
<WhereIsMySpoon> deryl, there is nothing in .rvm/environments
<deryl> then rvm use 1.9.3-p125 --default
<deryl> what??
<deryl> your rvm setup is crewy
<deryl> err screwy
<WhereIsMySpoon> lol ok
abalos has joined #ruby
<deryl> blow that whole tree away and reinstall it. something is seriously gak'd. https://rvm.beginrescueend.com/support/troubleshooting/
<deryl> go to the bottom and see my script for removing rvm completely
<deryl> then close ALL terminal sessions. every stinkin one
<deryl> then open it fresh and redo the install (per-user with no sudo)
technel has joined #ruby
artOfWar has joined #ruby
<deryl> the script i'm referring to is the 2nd from the bottom entry
<deryl> that removes RVM everywhere on the system that we touch
<WhereIsMySpoon> that is the output of rvm info
schovi has joined #ruby
Jay_Levitt has joined #ruby
<deryl> the closing of all the terminals ensures that the entire environment is completely reset. you should actually get an error about not being able to find the rvm file for sourcing after that because you haven't reinstalled
<deryl> and please tell me you're not using that blasted ruby-rvm package for debian and ubuntu
<deryl> if you are RIP IT OUT
nikhgupta has joined #ruby
<deryl> completely and utterly NOT supported by us
<WhereIsMySpoon> er
<WhereIsMySpoon> i did do a sudo apt-get install ruby
<WhereIsMySpoon> at some point
<deryl> thats just the system ruby.
<deryl> dpkg -l | grep ruby-rvm
mengu has joined #ruby
<deryl> if that is in, apt-get --purge remove ruby-rvm
<WhereIsMySpoon> rc ruby-rvm 1.6.9-0ubuntu2 easily install, manage and work with multiple ruby environments
<deryl> ok whew
<deryl> such an utter peice of shit
pu22l3r has joined #ruby
<WhereIsMySpoon> lol
<WhereIsMySpoon> ok so
<deryl> they screw up the packaging so bad and it breaks other rvm installs for users.
bwlang_ has joined #ruby
<WhereIsMySpoon> shall we start over?
<WhereIsMySpoon> deryl? :)
pu22l3r__ has joined #ruby
<deryl> yes, run that script i pointed you at, close ALL terminals, reopen one, run the PER-USER install from the rvm install page (the one without the sudo), close the terminal *again* and reopen it and now the rvm sourcing line should work again
<deryl> then rvm --intall --create use 1.9.3-p125 --default
<deryl> s/intall/install/
<deryl> then close the terminal and reopen it so that it reinits fresh, and ruby --version
<WhereIsMySpoon> deryl, is the per-user install the one thats under the header "ruby-debug and ruby 1.9" on the beginrescueend page?
<deryl> and GIST me the details of rvm info when thats done. I hate pastebin and refuse to use it
schovi has joined #ruby
waxjar has joined #ruby
<deryl> no its the one under rvm.beginrescueend.com/rvm/install and is the first one listed
alx- has joined #ruby
waxjar has joined #ruby
waxjar has joined #ruby
<WhereIsMySpoon> er
<WhereIsMySpoon> why do i no longer have a .bash_profile
badabim has joined #ruby
Teddy2steper has joined #ruby
<deryl> idk, as you can see we don't delete that
<deryl> we do /usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm
fowl has joined #ruby
<deryl> the only physical words for the bash stuff are in an echo: /bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete or comment out if this was a Per-User installation."
<deryl> and you can even not run that becaue we want the .bash_profile
<deryl> i want it to actually error because its proof that rvm isn't found (thus why you get the error about not being able to load)
kng has quit [#ruby]
<WhereIsMySpoon> right well im installing 1.9.3
<WhereIsMySpoon> on #configuring atm
<WhereIsMySpoon> and now compiling
bigkm has joined #ruby
flak has joined #ruby
ethd has joined #ruby
ethd has joined #ruby
rramsden has joined #ruby
waxjar_ has joined #ruby
<deryl> also i tell people to use the patchlevel when they set their default ruby so that you don't potentially break other projects if you rvm upgrade the major version
<deryl> so make sure to use the patchlevel when you set your default
<WhereIsMySpoon> thats the -p<blah>
<deryl> yep
<WhereIsMySpoon> kk
Spaceghostc2c has joined #ruby
<WhereIsMySpoon> compiled fine, just retreiving default gemsets
<deryl> *I* dont because its SUPPOSED to break for me, I'm one of the RVM developers. *I* need to know when that upgrade process breaks :)
<Spaceghostc2c> oooPaul: lol
<deryl> but general users .. not so much
<WhereIsMySpoon> ok done
rmaceissoft has joined #ruby
<deryl> give me the commandline you ran for the 1.9.3 install
<deryl> so i know exactly what you did
<WhereIsMySpoon> rvm install 1.9.3
rippa has joined #ruby
<Spaceghostc2c> deryl: When I upgraded my system to Windows 7, rvm broke. Plz fix soon.
<WhereIsMySpoon> lol
<deryl> Spaceghostc2c: piss off ;)
<WhereIsMySpoon> haha
<Spaceghostc2c> <3
<WhereIsMySpoon> deryl, rvm info shows nothing about the ruby version
<deryl> ok, now do this. rvm --install --create 1.9.3-p125@user --default
<WhereIsMySpoon> only the rvm version
<WhereIsMySpoon> ah was it too early for an rvm info ^^
<deryl> (I want it to make the gemseet so i can test that and so i can seee that it set the default TO using a gemset as well so i know the whole chain is working)
<deryl> yeah way too early
<WhereIsMySpoon> ok done
<deryl> none was selected so it will be empty
<deryl> ok so are you showing you in ruby-1.9.3-p125@user then?
<WhereIsMySpoon> what
<WhereIsMySpoon> am i showing me?
<deryl> are you showing that yoou are in that?
<deryl> come on, grey matter man, grey matter
<WhereIsMySpoon> i dont actually understand your sentence, am i showing that i am in that? is it a folder?
<WhereIsMySpoon> is it a package?
<deryl> did you do the rvm --install --create 1.9.3-p125@user --default
<WhereIsMySpoon> yes
<deryl> ook, rvm info
<WhereIsMySpoon> i changed user for my username
<deryl> thats fine
<WhereIsMySpoon> new console?
<deryl> same
bwlang_ has joined #ruby
<WhereIsMySpoon> ok
<deryl> new con is nect
<deryl> err next
<WhereIsMySpoon> all of these things at the bottom have been set
<WhereIsMySpoon> like GEM_HOME
<WhereIsMySpoon> MY_RUBY_HOME
<deryl> just making sure that the current session actually changed
<WhereIsMySpoon> gemset
<deryl> ok and they show the right ruby in them right?
<WhereIsMySpoon> etc
<WhereIsMySpoon> yes
<WhereIsMySpoon> ruby-1.9.3-p125
<WhereIsMySpoon> ah and now it has some ruby info at the top
<deryl> ok, and you have the rvm load line in your $HOME/.bash_profile correct?
<WhereIsMySpoon> i still dont actually have a .bash_profile
<WhereIsMySpoon> i have a .bashrc
<deryl> per users need that to load. we handle it in /etc/profile.d/rvm.sh for multi
<deryl> ok then add this to your .bash_profile
<deryl> make one
<WhereIsMySpoon> k
ed_hz_ has joined #ruby
<deryl> put that in there
<WhereIsMySpoon> oh
stkowski has joined #ruby
<WhereIsMySpoon> gist is a pastebin service
<deryl> .bashrc doesn't get loaded generally by interactive shells
<deryl> yes
<WhereIsMySpoon> i thought you meant like give me the gist
<deryl> its github's
<WhereIsMySpoon> summarise it
<WhereIsMySpoon> not put it on gist
<deryl> ahhhh
<WhereIsMySpoon> ive never used github
<deryl> heheh. words, they're so easily confusing
apok has joined #ruby
<WhereIsMySpoon> and i need the shebang at the start of the bash_profile right
<deryl> you can make a gist anonymously so thats fine
<WhereIsMySpoon> #!/bin/bash
<deryl> no
<WhereIsMySpoon> oki
<deryl> bash handles all that
eldariof has joined #ruby
<deryl> also are you using gnome-terminal?
<WhereIsMySpoon> yes
<deryl> sec
io_syl has joined #ruby
<WhereIsMySpoon> k added that in
io_syl has joined #ruby
<WhereIsMySpoon> this is a lot of effort o.o
<deryl> gnome-terminal does not default to a login sessions o your .bash_profile is never read, nor does it honor the .bashrc
<deryl> se sec
<deryl> well somehow you got screwed up over there
<deryl> gimme a sec to find this friggin link
<WhereIsMySpoon> :p
<deryl> there
<deryl> do that
christopherl has joined #ruby
<deryl> and it does not always execute the .bashrc as it should
<deryl> prob with gnome-terminal
<deryl> err problem even
<deryl> once you set that option completely kill gnome-terminal and open it again
* WhereIsMySpoon goes off to find the gnome-terminal settings
<deryl> it tells you
<WhereIsMySpoon> er
<WhereIsMySpoon> For rvm to work properly, you have to set 'Run command as login shell' checkbox on Title and Command tab inside of gnome-terminal settings.
<WhereIsMySpoon> i need to find where these settings are
<deryl> ahhh
<deryl> i dont use it myself as I'm on a Mac, but it should be under the preferences somewhere
<deryl> think mpapis said the last tab
<deryl> thats totally from memory so if i'm wrong i apologize
<robacarp> deryl: osx uses .bashrc_profile I think...checking
<robacarp> .bash_profile
<deryl> no no
<deryl> i meant for where the gnome-terminal settings are
<deryl> and yeah it uses .bash_profile by default
<WhereIsMySpoon> dsakldsadlkasdksada;
<WhereIsMySpoon> sigh
danishkhan has joined #ruby
<WhereIsMySpoon> 11.10
<WhereIsMySpoon> so #$*(
<deryl> some of these linux distros use .profile but .profile is for sh-compat mode. bash defaults to using .bash_profile and using .profile disables some features of bash as a result
<deryl> and that breaks some of what we do too because we use some of bash's extended capabilities not available when it switches to compat mode
<deryl> which is fine. the future is forwards, not back ;)
ringotwo has joined #ruby
<WhereIsMySpoon> oh here it is
<deryl> anyways, go through doing all that. I gotta disappear for awhile. IRL stuff that HAS to be done now
nfluxx has joined #ruby
<WhereIsMySpoon> deryl, found it :)
<WhereIsMySpoon> ah ok
<deryl> ok then set all that uyp and go through
<deryl> i gotta split. late as it is
<WhereIsMySpoon> sure
<WhereIsMySpoon> thanks
<deryl> np &
<WhereIsMySpoon> oooo
<WhereIsMySpoon> *wooo
<WhereIsMySpoon> ruby --version reports 1.9.3
<WhereIsMySpoon> rvm info works
<WhereIsMySpoon> <3
<WhereIsMySpoon> in a new terminal that is
<WhereIsMySpoon> so its all good
<WhereIsMySpoon> :D
cha1tanya has joined #ruby
<WhereIsMySpoon> bye #ruby :)
luckyruby has joined #ruby
<A124> Hell yeah! [BUG] Segmentation fault ruby 1.8.7 (2011-12-28 patchlevel 357) [x86_64-linux]
ascarter has joined #ruby
<A124> Anyone here experienced with Hyrda?
<A124> *Hydra
adamkittelson has joined #ruby
theRoUS has joined #ruby
bwlang_ has joined #ruby
<lockweel> yea me too
<A124> lockweel: hydra or segfault?
<lockweel> A124 not for you, sorry..
<lockweel> it was going to bye..
lie2815 has joined #ruby
<lie2815> hello folks. how can i determine which user is running my ruby app?
<robacarp> lie2815: hello. That isn't really enough information to go on...
geekbri has joined #ruby
<Afal> ps?
<lie2815> it's a rails app run with passenger
<robacarp> lie2815: #rubyonrails
<lie2815> ugh, user "nobody" is running it
<lie2815> sorry about that. thx for your help
statix has joined #ruby
<rmaceissoft> Hi guys, I need to enable debug on Aptana IDE for Ruby 1.9.3, but I'm getting strange error
nfluxx_ has joined #ruby
cal has joined #ruby
<rmaceissoft> I'm using windows...
ph^ has joined #ruby
hydrozen has joined #ruby
yeggeps has joined #ruby
stefanp has joined #ruby
stefanp has joined #ruby
rramsden has joined #ruby
Synthead has joined #ruby
<geekbri> Can you use #{} in ruby regular expressions?
<oooPaul> Actually, I think you can.
cmasseraf has joined #ruby
v0n has joined #ruby
<oooPaul> x = "foo"; "foobar" =~ /#{x}/ => 0
n1x has joined #ruby
<oooPaul> "biff" =~ /#{x}/ => nil
pzol has joined #ruby
<oooPaul> It's even interpreted -- x = "[abc]", "foobar" =~ /#{x}/ => 3
pzol has quit ["Sayonara!"]
yrrep has joined #ruby
<geekbri> hrm, excellent!
cbuxton has joined #ruby
ivanoats has joined #ruby
crankycoder has joined #ruby
bwlang_ has joined #ruby
ivanoats has joined #ruby
nemesit has joined #ruby
mikespokefire has joined #ruby
moemen has joined #ruby
Vert has joined #ruby
workmad3 has joined #ruby
mneorr has joined #ruby
atmosx has joined #ruby
mneorr has joined #ruby
kf8a has joined #ruby
drake10 has joined #ruby
polarist has joined #ruby
jason_rad has joined #ruby
Avanine has joined #ruby
havenn has joined #ruby
bwlang_ has joined #ruby
<jason_rad> I'm trying to use ActiveSupport::SecureRandom.base64(10) in my app.. I did require 'active_support/secure_random' and I get this upon running the app
<jason_rad> require': cannot load such file -- active_support/secure_random (LoadError)
<jason_rad> any ideas
ascarter has joined #ruby
cal has joined #ruby
<jason_rad> active support 3.2.1 is also installed as a gem
alienvenom has joined #ruby
<drake10> If I have a string like "123-apple-dog-cat" and want to split as "123" , "apple-dog-cat". How would I do that? I tried split('-'), but it would split as "123", "apple", "dog" "cat"
iamjarvo has joined #ruby
albemuth has joined #ruby
<fowl> be lazy
<canton7> drake10, I managed with positive lookahead and lookbehind: "123-apple-dog-cat".split(/(?<=\d)-(?=\D)/) Not sure if there's a cleaner way
<Eiam> split it, pop the first item
<Eiam> rejoin with -
<fowl> ^
A_D has joined #ruby
<Eiam> glad I wasn't alone in that response haha
<shevy> drake10: indeed, if it is that simple use .split and rejoin. if you however want to use a regex, make it match via two ()
<Eiam> to me, what canton7 is less readable
<Eiam> it takes me longer to parse & understand what he wants
<shevy> yeah
<drake10> canton7: Thanks, was wondering if there was a function
<Eiam> but I recognize that I'm terrible with regex.
<canton7> yeah, mine's very much unreadable and emrely an exercise in regex :P
<shevy> regexes are harder to understand at a first glance
<canton7> *merely
<shevy> they are always harder Eiam
pzol has joined #ruby
pzol has quit ["Sayonara!"]
<epitron> drake10: what are you doing? are you extacting the ID from an URL slug?
dekroning has joined #ruby
<epitron> or is that a customer's address?
iamjarvo1 has joined #ruby
<ccapndave> drake10: How about "123-apple-dog-cat".partition("-").delete_if { |b| b == "-" }
<Eiam> I need to do a bunch of shell commands through rake, stuff like making directories if they don't already exist, copying files, archving files, and loading stuff into launchctl. is rake + fileutils the most suited tool for that job, or should I just shell out directly from rake?
pastjean has joined #ruby
mikepack has joined #ruby
<drake10> epitron: I need to pass, object id along with object name via files and later split id and names
<epitron> via filenames?
jason_rad has quit [#ruby]
Helius has joined #ruby
KL-7_ has joined #ruby
<epitron> because there are better ways to encode ids and names inside files :)
<epitron> also, better ways to encode an id via a filename
<drake10> ccapndave: that is neat, thanks
<epitron> "10. Apple Cat Dog.dat"
bwlang_ has joined #ruby
<epitron> or, ideally, zero-padded, so they sort properly
<ccapndave> drake10: There might be a more elegant way still
<epitron> "0010. Apple Cat Dog.dat"
<drake10> epitron: not via file names. Its each record within a file
<epitron> ah
<epitron> if you want to store records, there are lots of things out there for that
<epitron> yaml for example :)
<epitron> or json
<epitron> or a small database
<epitron> (eg: tokyo cabinet)
<drake10> epitron: I know, trying to fix a bug in an existing system, cant change a whole lot
<epitron> ah
<epitron> migration :\
<drake10> epitron: what is tokyo cabinet?
bean_dharma has joined #ruby
<epitron> it's like mysql without the sql
<epitron> you can store data in little hashtables or btrees on disk
<drake10> something like key-value? mongodb?
<epitron> it's not like mongodb
<epitron> it's just a little library
<epitron> there's no server
<epitron> it just lets you open/read/write cabinet files
carlyle has joined #ruby
carlyle has joined #ruby
ChampS666 has joined #ruby
<Pwdrkeg> Hello, I'm interested in writing a program in ruby that will be sort of a command line menu driven interface for running various Windows commands/scripts. I've never written in Ruby before though, could anyone suggest a place to start? Specifically, with interfacing with Windows.
flagg0204 has joined #ruby
shadoi has joined #ruby
fmcgeough_ has joined #ruby
<bean_dharma> I'm trying to subtract two DateTime objects by "DateTime.now - DateTime.parse('2012-03-10 21:29:46 UTC')", but this returns (55659343181/14400000000). How do I make this readable?
mneorr has joined #ruby
<Pwdrkeg> thanks rippa, does that include win 7?
<rippa> Pwdrkeg: seems so
<rippa> bean_dharma: it's a rational
<rippa> you can call to_f on it
beha has joined #ruby
<matled> bean_dharma: I found Date and DateTime most of the time quite confusing and found Time much more convenient to use.
<rippa> though I'm not sure why it would return a rational
Hydroxide has quit [#ruby]
<bean_dharma> call to_f on the end result? That returns 3.8694378109953704 =\
evilgeenius has joined #ruby
releod has joined #ruby
<evilgeenius> Does anyone know the file name format of photos taken on the iPad? is the timestamp in the filename?
jwang has joined #ruby
<matled> bean_dharma: it seems to return the number of days between two DateTime objects
<shadoi> bean_dharma: try chronic.
ephemerian has quit [#ruby]
<bean_dharma> ohhh okay thatnks, I'll try formatting it from there
mneorr has joined #ruby
yoklov has joined #ruby
jameshyde has joined #ruby
<shevy> Eiam why shell out? Plain ruby can do all of that. I myself dont use rake though, it annoys me too much
<shevy> Pwdrkeg: writing ruby on and for windows is not that different than writing ruby on and for linux
mocker has joined #ruby
<shevy> what for
artm has joined #ruby
<Pwdrkeg> shevy: I see. For me, one example might be, a menu option to run a powershell script.
stephenjudkins has joined #ruby
ruby_fun has joined #ruby
<ruby_fun> I am creating a new browser session using Watir::Browser.new :firefox and am trying to use a variable instead of ":firefox" anyone know if this is possible?
<oooPaul> mocker, I think our sysadmin here did. :)
<oooPaul> ruby_fun, of course.
<mocker> oooPaul: Just picked up the ebook, gonna check it out tonight.
<oooPaul> :firefox is just a symbol. Put a variable there instead, and set the variable to :firefox. :)
<ruby_fun> that doesn't work
<oooPaul> mocker, I haven't often been disappointed by PragProg books (except for that first book on git, what a useless pile of words that was)
<oooPaul> foo = :firefox; Watir::Browser.new(foo)
luke--_ has joined #ruby
hobodave has joined #ruby
hukl has joined #ruby
Progster has joined #ruby
<shevy> I dunno. the pickaxe before the current one was very good, but other than that I have been too disappointed by the prag prog books
<shevy> metaprogramming ruby was a waste of time and resources for me
<oooPaul> Really? That's one of my faves.
<oooPaul> There was a lot in there I already knew, for sure, but there was a lot of good description of some nuances that had passed me by.
<ruby_fun> whats the ( ) do
<oooPaul> Seven Languages in Seven Weeks was good.
<oooPaul> ruby_fun, it bounds your parameter list.
schovi has joined #ruby
zul has joined #ruby
kremiak has joined #ruby
williamcotton has joined #ruby
<oooPaul> Parens on function arguments are optional in Ruby. Foo.new "biff" is the same as Foo.new("biff").
<shevy> yeah oooPaul 80% I knew what was in that book, and the rest does not seem to be overly useful to me either. there is too much metaprogramming magic in ruby, it is becoming cargo cult building when in ancient times, the kool aid was simple solid and concise design, without any magic in it
chendry has joined #ruby
_bob has joined #ruby
<oooPaul> shevy, the big win for me in that book was the concise explanation of the whole Eigenclass inheritance thing... Which doesn't come up often, but when it does, I'm glad it let me figure it out. :)
<oooPaul> But yeah, magic is a double-edged sword.
<chendry> hi everybody! This has been bugging me. I want a method on Enumerable that takes a block, iterates through the Enumerable's objects, and calls the block passing the object. The first time the block returns a "true" value, I want that value to be returned by the method. Does such a method exist?
<oooPaul> I do like the magic in some cases, though. I had to put together code to interface with a SOAP API, and used a lot of the tricks in that book so that the code actually builds ActiveRecord-like objects from the WSDL, rather than me having to build all those objects manually.
<oooPaul> chendry: "find".
<Eiam> shevy: plain ruby can do all of that?
<Eiam> shevy: howso?
<Eiam> I'm not familiar with this portion of ruby I suppose
<oooPaul> chendry: ["a", "b", "c"].find{|x| x == "b" } => "b"
<chendry> ooPaul: find is _close_ to what I need -- except I want it to return what my block returns. (instead of returning the object that was passed to my block when my block returned true)
<Eiam> shevy: you mean use require 'fileutils'
<Eiam> shevy: FileUtils.mv('my/files/,'/new/path') ?
<oooPaul> Oh, I see...
<shevy> Eiam well, I mean to use fileutils, yes
<shevy> but not like that
<Eiam> like how?
crankycoder has joined #ruby
<shevy> first, you can use include FileUtils and then omit all FileUtils. prefixes
<chendry> ooPaul: like this: %w[a b c].find { |x| x == "b" ? "Found it!" : nil }.should == "Found it!"
<shevy> second, when you have something like mv, omit the ()
<shevy> third and most importantly, I write methods that do the task at hand
<shevy> for instance, I tend to do:
<shevy> def move_file(from, to)
<shevy> and inside there do some checking
<shevy> and usualliy also do: alias mv move_file
simao has joined #ruby
<shevy> *usually
panpainter has joined #ruby
<axl_> heres a question: I have a class that uses an instance variable, that does not have a setter. can i force set it from console?
<shevy> it then becomes much closer to how you do it in shell scripts too
birkoff has joined #ruby
<shevy> (minus the '')
<oooPaul> chendry: In that case I don't think so.
<shevy> I'd love to be able to omit the '' though :(
sgmac has joined #ruby
sgmac has quit [#ruby]
Magik_n has joined #ruby
<Magik_n> hi all :)
c0rn has joined #ruby
<chendry> oooPaul: well crap. I've needed it twice in the past two days :) Which book were you talking about, btw?
_bob has joined #ruby
<oooPaul> chendry: Metaprogramming Ruby from PragProg. I liked it. shevy didn't.
simao has joined #ruby
shevy_ has joined #ruby
mrsolo has joined #ruby
Jay_Levitt has joined #ruby
havenn has joined #ruby
<shevy_> hmm question
<shevy_> I often do:
<chendry> oooPaul: aye, yes, I recall liking that one. I think my favorite by far until now has been _The Ruby Programming Language_ -- that's super concise
<shevy_> begin
<shevy_> code_that_may_fail_here
<shevy_> rescue Exception => error
<shevy_> pp error
<shevy_> end
trivol has joined #ruby
senj has joined #ruby
<shevy_> is there any way to cut down on the amount of lines here? Especially the rescue part is redundant when I use that like 20 times in a project
<shevy_> I'd like to have something like...
<shevy_> rescue_everything
<shevy_> end
<shevy_> instead of:
<shevy_> rescue Exception => error
<shevy_> pp error
<shevy_> hmmmmm
<oooPaul> shevy: you can toss rescue on the end of a single line...
_bob_ has joined #ruby
<oooPaul> my_call rescue puts "error"
<oooPaul> Although I think you'd still have to put Exception => e there to capture it...
<shevy_> hmm
cal has joined #ruby
<shevy_> do you know what "rescue" is? is that a method somewhere like in Kernel ?
<shevy_> or is it a keyword
<shevy_> :(
<oooPaul> I've seen, for example: foo = something_that_might_fail rescue nil
<shevy_> I guess it is ...
<oooPaul> Which sets foo to nil if that something failed.
kenichi has joined #ruby
<oooPaul> Keyword, almost positive.
bwlang_ has joined #ruby
<rippa> keyword
<oooPaul> Has to be -- how would you rescue the rescue method? ;)
<shevy_> yeah hmmm
<shevy_> I just dont like the rescue Exception => error; pp error part all over my code :(
bbttxu has joined #ruby
<A124> Um.. I got a "little" problem parsing ULRs. Can anyone gime a hint please? URI.parse('http://sss.some.com/h[je]') URI::InvalidURIError: bad URI(is not URI?): http://sss.some.com/h[je]
<shevy_> I am sure that could be done better somehow...
<oooPaul> Put the handler way at the top.
<oooPaul> Unless you're planning on continuing code execution after it.
arvidkahl has joined #ruby
Vert has joined #ruby
<oooPaul> A124: The square brackets are illegal characters in the URI.
looopy has joined #ruby
<shevy_> ah no, they just should show some error messages. for instance, some of my yaml files can sometimes be invalid, and it is often easier to continue just showing the error
<oooPaul> shevy_, Ah, gotcha. Yeah, just kinda need to litter them. :
<oooPaul> :P
pastjean has joined #ruby
<A124> oooPaul: Interesting. Someone said exact oposite of that today. .. URI.escape does not escape that.
<shevy_> hehe
Foxandxss has joined #ruby
<oooPaul> You can put a rescue in a method, though, without a begin/end -- def foo; blah; rescue Exception => e; pp e; end
francisfish has joined #ruby
<oooPaul> A124: Escaping is for parameters; those square brackets are in the URI path.
virunga has joined #ruby
<A124> oooPaul: Ah. ok. How can I fix that please?
<oooPaul> URI.parse("http://sss.some.com/hkj?foo[bar]=biff") works fine, for example.
sacarlson has joined #ruby
<oooPaul> A124: I don't know where your URL is coming from, so I couldn't tell you how to fix it. :)
jchauncey has joined #ruby
sungji has joined #ruby
kpshek has joined #ruby
<oooPaul> Okay, need to run... Catch y'all later....
nobitanobi has joined #ruby
<nobitanobi> Given a Date object, how can I get a string representation in the format YYYY-MM-DD?
<nobitanobi> *a string object
<A124> Ah. Dang.
albemuth has joined #ruby
<A124> nobitanobi: or Date._strptime('2001-02-03', '%Y-%m-%d')
<A124> nobitanobi: No. that one not. That was my fail. *facepalm* sorry
<nobitanobi> mmm ok
<A124> nobitanobi: You want this I guess: Time.now.strftime('%F')
n3m has joined #ruby
<A124> nobitanobi: Am I right?
bbttxu has joined #ruby
bwlang_ has joined #ruby
khammett has joined #ruby
greenarrow has joined #ruby
<nobitanobi> I have a Date object
<khammett> hey
<nobitanobi> not a Time object
<khammett> strange thing
<khammett> why in Ruby
<khammett> 3 * 0.8 = 2.4000000000000004
<khammett> strangeeeee
zul has joined #ruby
<Synthead> I'm looking to read an XML-based template (open to ideas), add a few elements based on some variables, and write it to a file. how can I do this?
<shevy_> khammett: not with syntax like that
<khammett> shevy_: ???
<shevy_> 3 * 0.8 surely does not return 2.40004 for you right?
<rippa> shevy_: returns for me
yoklov has joined #ruby
<rippa> khammett: because it's a float
zommi has joined #ruby
<shevy_> oh
<shevy_> that changed in 1.9.x?
<rippa> maybe
<khammett> shevy_: please try to do so in IRB
<nobitanobi> How can I get a Date object like this: YYYY-MM-01 --> Where YYYY is actual year, and MM is actual month?
<shevy_> I see it does in 1.9.x
<shevy_> another example how ruby evolves :(
<khammett> rippa: i wonder why there is a '4' at the end
ghanima has joined #ruby
<rippa> khammett: because 0.8 != 8/10
<rippa> it's only an approximation
<rippa> because floats are binary
<shevy_> hmm but in 1.8.x it works without requiring anything else
yekta has joined #ruby
<ekaleido> nobi: strftime?
fjfish has joined #ruby
<Synthead> can I read an .rhtml file into a var as if I ran eruby on it?
<khammett> rippa: so, what's the rule here? the result is too long for me
<shevy_> nobitanobi: perhaps via .parse
<rippa> khammett: what do you want?
<shevy_> Date.parse '1999-01-01' # => #<Date: 4902359/2,0,2299161
<shevy_> rippa I think he wants the rounded result
<khammett> rippa: i pass the amount of $ to paypal, and the amount = 3 * 0.8, which causes paypal error (The link you have used to enter the PayPal system contains an incorrectly formatted item amount - from Paypal)
<rippa> khammett: format it then
<rippa> also, don't use floats for money
<khammett> rippa: what do you recommend how to format it? As this is money, so I don't want to round it
<nobitanobi> shevy_: but how would you get the actual year? using Time?
<canton7> "%.2f" % (3 * 0.8). This is why you don't use floats for currency
<rippa> you could use BigDecimal
<nobitanobi> same for month
<Synthead> nobody has any ideas? :s
<shevy_> nobitanobi: dunno, there are surely methods on date
<canton7> http://money.rubyforge.org/ is pretty good
<shevy_> intuitively I would go with .month and .day (or plural)
<shevy_> Synthead: no idea, I gave up on .rhtml many years ago
BRMatt has joined #ruby
nikhgupta has quit [#ruby]
pastjean_ has joined #ruby
simao has joined #ruby
<khammett> rippa: thanks for your suggestion. i use this in a Rails app, how do I use bigdecimal, sorry i dont know how to decalre
<khammett> *declare
trend has joined #ruby
mklappstuhl has joined #ruby
bwlang_ has joined #ruby
maddog_ has joined #ruby
<ekaleido> if i have a process spewing something to my screen every second, what class/method could i call to capture that?
pastjean has joined #ruby
rburton- has joined #ruby
<ekaleido> or call the process and then capture its output in the background
<Eiam> shevy_: omit all fileutils prefixes? you mean by wrapping them in methods.. if you don't call FileUtils.mv its not gonna know what to do..
bingomanatee__ has joined #ruby
<Eiam> as for calling methods without enclosing () ruby allows either
<Eiam> and since every other language i use requires () for methods, I use () in ruby too.
banister_ has joined #ruby
ephemerian has joined #ruby
nobitanobi has joined #ruby
Faris has joined #ruby
scientes has joined #ruby
KL-7 has joined #ruby
<shevy_> Eiam I am not reasoning for YOUR decisions, use whatever works for you :)
kpshek has joined #ruby
mneorr_ has joined #ruby
<shevy_> nobitanobi: Date has some fancy methods... for instance, year -> Date.today.year # => 2012
<shevy_> Date.today.month # => 3
kpshek has joined #ruby
<shevy_> btw I hate that there are so many different time related classes
hashpuppy has joined #ruby
shruggar has joined #ruby
<shevy_> we have... Time ... Date ... and DateTime at least
<hashpuppy> why when i comment line 35, line 44 executes. if i uncomment it, line 44 does not execute: http://paste.pocoo.org/show/AGgXa6JdKOmWlYHApk3b/
<shevy_> not sure if I forgot one
<shevy_> hashpuppy: quite ugly code. Anyway I think it is called because it is called after "require"
<shevy_> oops
<shevy_> I mean "rescue"
<hashpuppy> shevy_: ugly because that's the only way i could reproduce it
<hashpuppy> which isn't saying much actually
<shevy_> ugly because I'd never layout like that in a mixed begin/rescue/else/end
<Faris> Hello
<shevy_> hi Faris
<Faris> Are ruby threads still "emulated threads" or has it been upgraded to kernel threads ?
cjlicata has joined #ruby
<hashpuppy> i don't understand why uncommenting line 35 somehow doesn't execute the rescue
<hashpuppy> shevy_:
berkes has joined #ruby
<shevy_> I cant reproduce from this script anyway
<hashpuppy> seriuosly?
<shevy_> it is usually better to isolate the core of it into a standalone .rb file
sawgij has joined #ruby
<shevy_> the code you pasted there does not even run as-is for me, there is no output
<hashpuppy> ok, call create
<shevy_> wrong number of arguments (1 for 0) An unxpected error has occured. We have logged this error
<hashpuppy> i added create at the end: http://paste.pocoo.org/show/VNzsTfMB7cKHYz2p15rN/. i copy that whole file into an irb session and it works
<shevy_> cool
<hashpuppy> yeah, not sure what your'e doing worng
kirun has joined #ruby
<shevy_> I am calling create
<hashpuppy> ok, let me redo it
<shevy_> you could try one thing though
<shevy_> set a flag variable
<shevy_> and act on that after the begin rescue block
<shevy_> that may be "dumber", but it will surely work
<shevy_> any_errors = false
<shevy_> within rescue, you could do:
<shevy_> any_errors = true
<shevy_> oh actually
<shevy_> you could use a flag anyway and then do this:
<shevy_> return error_status
<shevy_> (if the variable name is error_status)
<shevy_> ohhhhhhh
<shevy_> you dont return anything man
<shevy_> puts e
<shevy_> you do a puts here!
<shevy_> not a return e
<shevy_> so I think this will always return nil or something, test in irb, any method that puts something
shruggar has joined #ruby
<hashpuppy> puts doesn't return Unit?
<hashpuppy> or void?
pxjorge has joined #ruby
<hashpuppy> everything should return something, right?
shruggar has joined #ruby
<hashpuppy> i'm new to ruby
sacarlson has joined #ruby
<Synthead> shevy_: s/\n/. /g
<shevy_> what Synthead
<shevy_> hashpuppy: yeah but lets see
iamjarvo has joined #ruby
<shevy_> hashpuppy: http://pastie.org/3595985
mmokrysz has joined #ruby
<shevy_> if you change the method to use return rather than puts, you get another result
<shevy_> you understand that in the code above?
Targen has joined #ruby
aibo_ has joined #ruby
KL-7 has joined #ruby
deluminathor has joined #ruby
mikeycgto has joined #ruby
mikeycgto has joined #ruby
mmokrysz has quit [#ruby]
rburton- has joined #ruby
sacarlson has joined #ruby
<deluminathor> hi, I have a problem with running inline ruby script from bash env variable
<deluminathor> APP_PATH_CMD="ruby -r yaml -e '$(echo puts 555)'" && echo $APP_PATH_CMD && echo "$($APP_PATH_CMD)"
albemuth has joined #ruby
<deluminathor> i get:
<deluminathor> ruby -r yaml -e 'puts 555'
<deluminathor> -e:1: unterminated string meets end of file
<deluminathor> does someone know how to solve it?
colinwd has joined #ruby
bwlang_ has joined #ruby
<A124> nobitanobi: Um.. sorry, it not my name in chat I don't see. It's coincidence I saw it "now".
poincare101 has joined #ruby
sroy2 has joined #ruby
S1kx has joined #ruby
S1kx has joined #ruby
deluminathor has joined #ruby
poincare101 has quit [#ruby]
DrShoggoth has joined #ruby
bwlang_ has joined #ruby
davidcelis has joined #ruby
deluminathor has quit [#ruby]
<A124> Solved that mine uri barackets '[]' problem with module, class << self, monkey patch, if anyone curious.
eko has joined #ruby
eko has joined #ruby
cal has joined #ruby
shruggar has joined #ruby
c0rn has joined #ruby
darthdeus has joined #ruby
kpshek has joined #ruby
bwlang_ has joined #ruby
christopherl has quit [#ruby]
apok_ has joined #ruby
Indian has joined #ruby
jamescotterill has joined #ruby
trivol has joined #ruby
mythmon has joined #ruby
dekroning has joined #ruby
dubios has joined #ruby
axl_ has joined #ruby
doublethink has joined #ruby
Mac_ has joined #ruby
banisterfiend has joined #ruby
stephenjudkins has joined #ruby
Helius has joined #ruby
dekroning has joined #ruby
friskd has joined #ruby
havenn has joined #ruby
<shevy_> hmmm
<shevy_> I really need to write a RubyOS
<shevy_> even linux is going on my nerves lately
shyam has joined #ruby
CombatWombat has joined #ruby
CombatWombat has joined #ruby
CombatWombat has joined #ruby
<A124> LoL
superguenter has joined #ruby
cbuxton has joined #ruby
c0rn has joined #ruby
yellow5 has joined #ruby
asobrasil has joined #ruby
etehtsea has joined #ruby
samuelkadolph has joined #ruby
yairgo has joined #ruby
cbuxton has joined #ruby
superguenter has joined #ruby
c0rn has joined #ruby
<yairgo> what's the best way to create standalone ruby applications?
kstephens has joined #ruby
samuelkadolph has joined #ruby
cbuxton has joined #ruby
superguenter has joined #ruby
<shevy_> yairgo: depends on what requirements you have, what target platform you aim for etc..
etehtsea has joined #ruby
c0rn has joined #ruby
nobitanobi has joined #ruby
asobrasil has joined #ruby
<yairgo> shevy_ some form of debian
superguenter has joined #ruby
cbuxton has joined #ruby
<shevy_> best ways are to: write everything in classes. if it belongs to one project, let them reside in the same namespace for that project
yellow5 has joined #ruby
<shevy_> ok so you target linux only (debian)?
samuelkadolph has joined #ruby
kstephens has joined #ruby
etehtsea has joined #ruby
c0rn has joined #ruby
superguenter has joined #ruby
cbuxton has joined #ruby
msch has joined #ruby
asobrasil has joined #ruby
samuelkadolph has joined #ruby
kstephens has joined #ruby
superguenter has joined #ruby
cbuxton has joined #ruby
<yairgo> shevy_ yes we will be only targeting debian, I meant how do I turn it into a standalone app that I can give to someone without ruby installed and they can run it
c0rn has joined #ruby
<A124> Excess flood? Really? or it's just a white lie?
<shevy_> use something like OptionParse to parse the commandline or slopt https://github.com/injekt/slop
yellow5 has joined #ruby
etehtsea has joined #ruby
<yairgo> I understand that there may be other dependencies that the person is required to install
<shevy_> yairgo: that does not work
cbuxton has joined #ruby
superguenter has joined #ruby
asobrasil has joined #ruby
<shevy_> the target machine needs to have ruby installed
c0rn has joined #ruby
yellow5 has joined #ruby
etehtsea has joined #ruby
kstephens has joined #ruby
superguenter has joined #ruby
cbuxton has joined #ruby
samuelkadolph has joined #ruby
<shevy_> as ruby is not compiled but interpreted
c0rn has joined #ruby
friskd has joined #ruby
<shevy_> you can try to bundle everything into one thing, including ruby
<shevy_> like to use OCRA
cbuxton has joined #ruby
superguenter has joined #ruby
asobrasil has joined #ruby
etehtsea has joined #ruby
yellow5 has joined #ruby
cbuxton has joined #ruby
<shevy_> but that works only on windows it seems http://ocra.rubyforge.org/
<shadoi> yairgo: create a deb package
c0rn has joined #ruby
cbuxton has joined #ruby
<shadoi> yairgo: https://github.com/jordansissel/fpm, simplest way to do it.
<yairgo> shevy_ yeah everything I've found has been for windows
c0rn has joined #ruby
<yairgo> shadoi thanks
virunga has joined #ruby
<A124> shevy_: shadoi: yairgo: There is a ruby2exe
ascarter has joined #ruby
cbuxton has joined #ruby
asobrasil has joined #ruby
kstephens has joined #ruby
c0rn has joined #ruby
cbuxton has joined #ruby
yellow5 has joined #ruby
<yairgo> A124 isn't ruby2exe for windows as well though?
cbuxton has joined #ruby
c0rn has joined #ruby
<shadoi> A124: it's ancient, and has all kinds of issues.
asobrasil has joined #ruby
kstephens has joined #ruby
<shevy_> http://www.erikveen.dds.nl/rubyscript2exe/ it should work on linux too
<A124> shevy_: shadoi: yairgo: ok, then AllInOneRUby
<shevy_> it is no longer actively maintained though
cbuxton has joined #ruby
c0rn has joined #ruby
<shadoi> last updated 2007
<shevy_> and you are in in illusion yairgo :) I dont think it will work to bundle everything together
kstephens has joined #ruby
asobrasil has joined #ruby
<shevy_> use C or C++
<A124> 1) it worked
yellow5 has joined #ruby
<A124> 2) you could change the script.. it's in ruby + decompiler.. opensource
<yairgo> shevy_ you have no idea how big of an illusion(not my choice though).. we are exploring options for what language to use
gen0cide_ has joined #ruby
<shevy_> well ruby is the coolest language by far
samuelk|away has joined #ruby
<yairgo> I love ruby and I don't know that I would go THAT far, but I do enjoy ruby
<shevy_> I dont think it fullfils your criteria though. especially on debian, debian is so annoying
<shadoi> yairgo: if you're targeting debian there's no reason not to use debs, let the package dependencies pull in everything required on install.
<shevy_> hehe
<shevy_> The Path to Great Pain.
<mklappstuhl> self.member = Array.new
<shadoi> I think it's easy. *shrug*
<mklappstuhl> self.member.push "a"
devinus has joined #ruby
<shevy_> shadoi: you are an old optimist ;)
<mklappstuhl> you tried to execute nil.push > method_error
<devinus> is there a way to get an instance variable on a class given only the key as a string?
<shadoi> shevy_: I was also a debian package maintainer for 6 years. :)
<mklappstuhl> any idea why this is happening?
<yairgo> ruby is easy for the most part, but it is also fun
<devinus> e.g.: class Foo; @a = 1; end; f = Foo.new; f['a'] ?
<shadoi> devinus: what do you mean?
<A124> yairgo: rubyscript2exe just works, and can be rewritten if needed. It's beautiful peace of work.. I've been through source codes
<shadoi> you have to define a [] method
<devinus> right
<devinus> but how would i defined that [] method?
<devinus> like...
<shevy_> mklappstuhl: what are you trying to do? .member seems to be nil. you cant push things into nil
<devinus> how do you get the var given a key?
<yairgo> def []
<shevy_> def [](input)
hydrozen has joined #ruby
<shadoi> devinus: def [](key); self.send(key.to_sym); end
<devinus> ok that's what i was asking
<mklappstuhl> shevy_: but I defined member before ... self.member = Array.new
gytis_z has joined #ruby
<shevy_> mklappstuhl: yeah I kinda doubt that ;)
<devinus> so the correct way to get it is send(key) ?
<shadoi> mklappstuhl: is self in the same context?
<mklappstuhl> shevy_: I'll do a gist
<shevy_> mklappstuhl: if it were to work, no nil would appear. but since a nil appears something is definitely wrong in the code you use
tommyvyo has joined #ruby
denysonique__ has joined #ruby
<shadoi> devinus: technically __send__
brianosborne has joined #ruby
<shadoi> to avoid collisions
etehtsea has joined #ruby
<shevy_> I swear .send will lead to brittle code
<shadoi> shevy_: how?
<shevy_> the ultimate combination is to use .send together with .method_missing
<shadoi> Every method call does the equivalent thing.
<shadoi> You send messages.
<shadoi> Welcome to ruby.
<yairgo> devinus what are you trying to implement?
<shevy_> shadoi: I have not seen people NEED to use .send ever as there are usually real methods existing (except for the method_missing magic)
ChampS666 has joined #ruby
<mklappstuhl> shevy_: https://gist.github.com/2039587
dkannan has joined #ruby
<shadoi> shevy_: It's a very simple, clean way to do meta-programming without resorting to method_missing magic.
<shevy_> shadoi: and that is no different than to use normal methods too. .send is not normally called when a message sends a message
<shadoi> shevy_: yes, but you need to check if the object responds to those methods before executing them. how do you propose to do that without using send?
CombatWombat has joined #ruby
<mklappstuhl> shevy_: I know that it's wierd but I have no explantation at hand thats why I am asking
<shevy_> mklappstuhl: that is no useful at all
<brianosborne> Hey all, I'm trying to write some code that will keep track of instances of a class using Class Instance Variables, but I'm getting a NoMethodError on << when trying to push an instance… http://pastebin.com/fzzhG5hN
CombatWombat has joined #ruby
CombatWombat has joined #ruby
<brianosborne> Not sure what I'm missing here
<shevy_> I mean, that is like two lines there you show mklappstuhl, how should anyone make sense of that
<shevy_> shadoi: I dont reason *for* using .send, I am reasoning to not use it
<devinus> yairgo: i'm trying to take an object's instance variables and turn some of the ones i want off the object into a hash, e.g.; class Foo; @a = 1; @b = 2; @c = 3; end; obj = Foo.new; @w(a b c).map { |k| obj.send(k) }
<shadoi> mklappstuhl: what is self?
<devinus> er
<shadoi> shevy_: I'm asking how you solve the problem without using send.
<devinus> or something like that
<shevy_> method_missing is a giant pile of hack
<shevy_> shadoi: use the method that exists on the object of course. that is the only proper way to use objects and messages
<robert_> blah.. I'm trying to regex match a file extension in a .each{} block. :/
<shadoi> shevy_: and how do you check if the method exists before calling it?
<robert_> haiii shevy_ :D
<shevy_> you can, if you must to, via .respond_to?
<shevy_> but really if I were in charge of such projects, I'd not rely on method_missing and send. they are hacks to me
msch has joined #ruby
<shevy_> hai robert_ :D
<shadoi> shevy_: and how do you pass a method name to respond_to, and then call it? write some code to show how you'd do it.
<mklappstuhl> shevy_: shadoi: I added the original file https://gist.github.com/2039587
<shevy_> why would I write it when I do not USE it and do not WANT to use it?!?
<shevy_> shadoi: if you are happy using send, use it. I think it sucks but its alas not my code
<yairgo> devinus sounds fun
<shadoi> shevy_: I'm asking you if you know of an alternative to providing the same functionality.
<A124> shadoi: RubyDocs?
<shevy_> mklappstuhl: that is highly specialized code there
<shevy_> it smells like rails
<shevy_> if you want to debug that, split it out to use a variable for User.find(uid).dn and check what it returns
<shevy_> I guess it will return nil
<yairgo> mklappstuhl what problem are you having?
shruggar has joined #ruby
anderse_ has joined #ruby
<mklappstuhl> yairgo: It's described in the gist. I want to empty the self.member array and then add a bunch of items to it
<yairgo> mklappstuhl you have self.member, shouldn't it be self.members?
<yairgo> I'm fairly certain that the ldap attribute for a group is members but I could be wrong
<mklappstuhl> yairgo: it is actually really member in this case
`brendan has joined #ruby
artm has joined #ruby
<yairgo> mklappstuhl put in `puts "#{self.member.class}"
<yairgo> and see what comes out of that
<shevy_> gotta reboot soon
<shevy_> kde konsole is no longer working and mrxvt does not look as nice :(
<mklappstuhl> shevy_: but the method is mostly plain ruby
<robert_> how goes, shevy_? :D
<mklappstuhl> yairgo: Array
<nate_h> hey i have my own gem repo set in /etc/gemrc
bwlang_ has joined #ruby
<nate_h> but now all install and query commands for remote gems just hang
<shevy_> robert_: still rewriting my main project! made some progress today
<nate_h> any idea how to debug it?
<yairgo> mklappstuhl is that before or after you do self.member = Array.new or self.member = []?
<nate_h> not seeing any requests in the apache log
<shevy_> ok... be back in half an hour or sth like that
<yairgo> wait
<robert_> shevy_: ewww. D:
<yairgo> do this
<yairgo> new_member = memberUid.collect{|uid| User.find(uid).dn}
<yairgo> self.member = new_member
kenneth has joined #ruby
<kenneth> hey i'm having some gsub problems
<yairgo> mklappstuhl did you get that?
<kenneth> running this: irb(main):020:0> "hi 'boom'".gsub(/['"\\\x0]/,'\\\0')
<kenneth> => "hi \\0boom\\0"
<robert_> couldn't you just do, self.member = memberUid.collect{|uid| User.find(uid).dn }, yairgo? :p
<kenneth> not quite sure why i'm getting \\0 in the output
<yairgo> robert_ of course,
<robert_> why the extra assignment, then?
<kenneth> when what i'm expecting is \'
<nobitanobi> I am doing this: d = Date.new(2012,12,1) -- But I would like to change 2012 for the actual year and 12 for the actual month. I want to keep the 1 though. What-s the best way of doing so?
<mklappstuhl> yairgo: interesting: https://gist.github.com/2039587
<yairgo> robert_ because I was typing it into the chat channel and wasn't thinking
startling has joined #ruby
<mklappstuhl> yairgo: before its Array and after = [] its nilClass
startling has quit [#ruby]
<A124> kenneth: "hi 'boom'".gsub(/['"\\\x0]/,'\\')
<yairgo> mklappstuhl yeah, ldap attributes are goofy, sometimes clearing them sets them to nil, did you try what I typed out, self.member = memberUid.collect{|x| User.find(x).dn}
<robert_> yairgo: ah. :D
jbw_ has joined #ruby
dbgster has joined #ruby
<mklappstuhl> yairgo: no not yet, seeing it for the first time right now
<mklappstuhl> (ah I see.. missed it above...
<yairgo> robert_ that was better than what I first though, @new_member = []; memberUid.each{|uid| @new_member << User.find(uid).dn}; self.member = @new_member; lol
<yairgo> *thought
<robert_> yeah. :D
<A124> kenneth: Tell me what you want to do.. you did not provided the desired output
<kenneth> trying to properly escape a string which might contain all kinds of random crap, to put it in a SQL query
<robert_> aha.
<kenneth> can't use prepared statements because that feature is broken :p
luke--_ has joined #ruby
<yairgo> mklappstuhl good luck, ActiveLdap wasn't in the best shape last time I tried to use it.
<yairgo> exit
<A124> kenneth: Ok. Give me what should escape to what and I can write you the regexp
cal has joined #ruby
ephemerian has joined #ruby
<havenn> nobitanobi: One way to do it: require 'date'; Date.strptime('01', '%d') ##<Date: 2012-03-01 ...
<nobitanobi> I did it like this.. : a = Date.new(Time.now.year,Time.now.month,1)
fcoury has joined #ruby
gianlucadv has joined #ruby
<kenneth> A124: by regexp is failing on this line: https://gist.github.com/7f40e9f6bc0c2d4cb274
apucacao has joined #ruby
cespare has joined #ruby
cal has joined #ruby
<shadoi> ah, shevy_ left, oh well.
doublethink has joined #ruby
Evixion has joined #ruby
si14 has joined #ruby
davidpk has joined #ruby
samsonjs has joined #ruby
<mklappstuhl> Is there some bot in this channel that allows me to leave a message for someone?
<A124> mklappstuhl: I think there is a server wide feature for this
willyum has joined #ruby
<robacarp> shadoi: what are you trying to do here
martinciu has joined #ruby
<shadoi> robacarp: it's pretty obvious from the code and comment no?
<robacarp> I'm pretty sure it would break if you sent it a hash {'blah='=>'test'}
<robacarp> and, I'm also pretty sure you can use .call instead of .__send__ but that might not be true for setters
<shadoi> no because 'blah=' isn't a valid method
Dr4g_ has joined #ruby
<robacarp> uhm
<robacarp> attr_accessor defines it...
<shadoi> yeah it adds an = to it
<shadoi> so it bails
MetaCosm has joined #ruby
<A124> Just for curiosity: Is there anyone expecianced in downloading large volumes of pages?
<A124> *Without the "curiosity" thing.
burgestrand has joined #ruby
<shadoi> A124: like a crawler? I wrote one with scrubyt a while ago
<robacarp> A124: I have
<robacarp> I did a few in mechanize
<A124> shadoi: Yes. Just like that. But my current job is without crawling.
<A124> robacarp: Few? .. I'm talking in millions now.
<robacarp> no, I did a few websites.
ph^ has joined #ruby
<A124> robacarp: Ah.
<robacarp> I scraped down geocaching.org as one of them, as i recall...I wonder if I still have that database...
<A124> robacarp: shadoi: Can you give me any hints, tips or an ado please?
<shadoi> robacarp: I guess I'll just count on users of the classes where I do this to not be idiots. :)
MetaCosm has joined #ruby
<shadoi> A124: basically just wrap everything in a timeout, and use the a back-off for retries.
<robacarp> shadoi: you shouldn't be doing that in libraries. It leaves you open to vulnerabilities akin to mass_assignment attacks
<A124> I'd like to make it happen the "best" way possible. Substitute best for your personal preference.
shaatar has joined #ruby
<robacarp> A124: scraping is a finicky thing...whatever works for you is good enough.
dotemacs has joined #ruby
<robacarp> A124: I used http://mechanize.rubyforge.org/ and got along just fine with it...scrubyt wasn't doing what I wanted. In other cases I've found the opposite to be true.
<shadoi> robacarp: I do input validation on all attributes, I'm fairly confident you can't inject malicious data.
moeSeth has joined #ruby
<A124> shadoi: Thank you. robacarp: I'm not talking about scraping. But the donwloading mostly. When it comes to millions, numbers does matter.
<shadoi> robacarp: the reason I do it, is all objects are serialized JSON, so I can deserialize, validate the JSON against a schema, and count on it being valid when I pull it back in.
<robacarp> shadoi: sure, okay. But when you add a method to your class it can be called implicitly via the hash on the init function. surely you don't want that.
bigkm has joined #ruby
arnihermann has joined #ruby
<robacarp> A124: yea, okay, I see what you mean. if you have a list of all the urls then just use Net::HTTP or something
skipper has joined #ruby
avandendorpe has joined #ruby
<A124> robacarp: Too slow. And also there is the storage, reliability, etc. part. That why I was asking.
Squarepy has joined #ruby
<shadoi> robacarp: right, I actually use "public_send" in my code, and all my non-accessible methods are private.
<robacarp> well, what do you mean storage?
<A124> robacarp: Where the pages / scraped data goes.
<A124> robacarp: I'm not only in scraping. So storing whole pages is relevant.
<shadoi> robacarp: and only accessors have setters anyway.
<robacarp> shadoi: if thats what you want to do, then do it...when it comes back to bite you in the ass later because you forgot to privatize a method or something
pkondzior has joined #ruby
TheDeadSerious has joined #ruby
pvh has joined #ruby
relix has joined #ruby
<robacarp> A124: okay, if you're just going to download a crap ton of pages it doesn't matter how you do it, its going to take the same amount of space.
fcoury has joined #ruby
<robacarp> if you're going to scrape some data out of it you'll probably want to store it in a database and the data is the size of the data
<shadoi> robacarp: what's a more secure way to do it for data that can contain arbitrary keys?
<robacarp> about speed though, parallelism is your friend here, because your process is network bound.
VictorMartins has joined #ruby
si14 has joined #ruby
<A124> robacarp: The thing is. I would like to do both. The storage for one entry is about 12-25kB + tenst to hunder kbB of raw.
kaichanvong has joined #ruby
<robacarp> well, you can gzip it I suppose, too.
technel has joined #ruby
<robacarp> shadoi: well. I sppose there really isn't, but I would be really curious as to why you need to write generic meta-code that must work across all possible values of keys.
bwlang has joined #ruby
<robacarp> that said, if its what you need to do, its what you need to do.
ethicalhack3r has quit ["Leaving"]
<shadoi> robacarp: I've implemented a base class for all my models, it uses this, and they are all subclasses.
<robacarp> and if it comes back to bite you, thats just teh consequences of life.
<shadoi> I guess I'll just be super anal about security in my base class. :)
<shadoi> like always.
srid has joined #ruby
srid has joined #ruby
srid has joined #ruby
<robacarp> yea, I think you're seeing the juxtaposition of security and convenience here
<shadoi> For sure.
moemen has joined #ruby
<A124> robacarp: The statement about size is not true.
<robacarp> ...okay...
<A124> robacarp: Yes. Thanks for gzip tip. It saves space. Though not optimal in all cases :)
dnyy has joined #ruby
nebiros has joined #ruby
esmaxwill has joined #ruby
nebiros has joined #ruby
lectrick has joined #ruby
<workmad3> shadoi: out of curiosity... is your code much different from the mass-assignment capabilities of https://github.com/cgriego/active_attr?
iocor has joined #ruby
hackeron has joined #ruby
<A124> robacarp: (about the sizes againg) To be exact, not as with storing the data in non-raw format. Nor even classic compression methods.
MoMo has joined #ruby
patricksroberts has joined #ruby
SeanTAllen has joined #ruby
jrgifford has joined #ruby
<workmad3> shadoi: and I think robacarp's original point about sending {'blah=' => 'foo'} to the method breaking things is valid tbh... your code would test if the object responded to 'blah=' (which it would) and would then attempt to send 'blah==' which would raise a NoMethodError
<robacarp> workmad3: yea, the odd thing is that it doesn't raise an error
<robacarp> it doesn't set the attribute either...but it doesn't raise an error
<workmad3> robacarp: hmm... interesting
<robacarp> oh, wait, my test case was different from the example
<workmad3> robacarp: heh :) I just tried in irb and got a NoMethodError
<A124> workmad3: Hey. Just reading again your advices :)
<workmad3> A124: still having fun with your distributed crawler? :)
dkannan has joined #ruby
<robacarp> now you've made me want to make a crawler.
<A124> workmad3: Yeah. I had to overcome some nasty things like transition to 1.9, URI parsing problems and such
<workmad3> robacarp: a sandcrawler? :D
randym has joined #ruby
<workmad3> robacarp: oh crap, thinking about that made me think about a crawler filled with java jawas...
<workmad3> that's an image that's gonna hang around for a while
polarist has joined #ruby
xrl has joined #ruby
<nobitanobi> what would be the best way of doing this: Given an array [1,2,3,4], just get [1,4] -- so, first and last element.
<A124> workmad3: java jawas? Coffee?
<robacarp> nobitanobi: [array.first, array.last]
ziyadb has joined #ruby
<robacarp> okay, my coworkers are flying helicopters around the office now.
Dr4g_ has joined #ruby
shruggar has joined #ruby
<nobitanobi> robacarp: thanks
saidin has joined #ruby
<robacarp> nobitanobi: np
<shadoi> robacarp: sure it does, it raises a NoMethodError for 'blah=='
svnlto has joined #ruby
DrShoggoth has joined #ruby
<robacarp> I wonder how many website url's I could catalog in a sqlite database < 1G
kf8a has joined #ruby
<shadoi> oh, nm, didn't read far enough
<shadoi> workmad3: having something like 'blah=' in my case it would never surface because it wouldn't pass the JSON schema validation, so it would never get to instantiation.
havenn has joined #ruby
trend has joined #ruby
jleitgeb has joined #ruby
kenneth has joined #ruby
ZenoArrow has joined #ruby
zulax has joined #ruby
denysonique__ has joined #ruby
stringoO has joined #ruby
<workmad3> shadoi: ah, fair enough :)
<ZenoArrow> Hi, I'm doing my nut in trying to understand access control in Ruby. Hope someone here can help me. I think I'm most confused about 'protected'.
<ZenoArrow> See pastie here... http://pastie.org/3596982
<workmad3> ZenoArrow: protected is... confusing
<ZenoArrow> workmad3, you're not kidding! ; )
davidboy has joined #ruby
<workmad3> ZenoArrow: basically, private means you can't have an explicit receiver for the method (so it's an error if you do obj.private_method, even if obj is 'self')
BrianE has joined #ruby
<workmad3> ZenoArrow: protected, you can call the method with an explicit receiver, but only from within an instance of the class (or an instance of a subclass)
<ZenoArrow> My own understanding of protected is that instances of a class are allowed to call protected methods, so why does the call 'ca.m2' in the code I linked to fail, as ca is an instance of the ClassAccess class?
<workmad3> ZenoArrow: because you're doing it from outside the class
<ZenoArrow> robacarp, thanks I'll have a look at that.
<workmad3> ZenoArrow: if you could do it like that, protected would be identical to public ;)
<ZenoArrow> workmad3, so protected methods are only available in the class they're defined in, and sub-classes of that class?
<workmad3> ZenoArrow: and only from within the class, yes
<ZenoArrow> So only public methods are accessible outside a class?
hukl has joined #ruby
kapowaz has joined #ruby
<ZenoArrow> I think it's this wording that is confusing me: 'only from within an instance of the class'. To me, an instance of a class is an object defined using the class as a blueprint.
<workmad3> ZenoArrow: https://gist.github.com/2040138
<ZenoArrow> I understand in Ruby that 'Class' is a type of object as well, but instance of a class seems rather vague to me now!
pastjean has joined #ruby
<ZenoArrow> Thanks workmad3, I'll look at that now. BRB.
__main__ has joined #ruby
robcthegeek has joined #ruby
<nobitanobi> Is there a ruby way to get the middle element of an array?
<workmad3> nobitanobi: define 'middle'
<nobitanobi> yes.. if the array size is odd [1,2,3] --> middle would be 2
<nobitanobi> if array size is even [1,2,3,4] , I would choose between 2 or 3, rounding up or down.
<A124> nobitanobi: The thing is if array is [1,2,3,4], what is middle?
<workmad3> nobitanobi: which one would you pick in the even case though?
<ZenoArrow> nobitanobi, you could divide array length by 2, and if you got a remainder from the division, either round up or round down (depending on your own preference).
<workmad3> nobitanobi: because chances are, whichever you pick, plenty of people will disagree ;)
<nobitanobi> I was just wondering if there was any ruby magic way of doing so
<workmad3> nobitanobi: (which is an explanation as to why ruby doesn't have a .middle method)
<nobitanobi> correct, makes sense
<A124> nobitanobi: No, there is not. As workmad said. It's a thing to dispute and not oftenly use anyway.
<workmad3> nobitanobi: you could just do ary[ary.size/2] though
<ZenoArrow> nobitanobi, it logically can't be done, it's not Ruby's fault!
<gogiel> nobitanobi: class Array; def middle; [size/2+1]; end; end
<ZenoArrow> The closest you can get is an approximation.
<nobitanobi> heeeey I am not blaming Ruby!
<nobitanobi> I love Ruby!
<workmad3> ZenoArrow: at least until ruby defines what ary[2.5] means, anyway :)
<nobitanobi> but thanks for the suggestions
kstephens has joined #ruby
<workmad3> gogiel: your middle method would be incorrect in the case of an array of size 1 btw...
<workmad3> hmm, and of size 2...
<gogiel> workmad3: no, it will work
<workmad3> gogiel: 2/2 + 1 = 2, which is the third element... I know ruby would probably let it pass, but it's still wrong ;)
<gogiel> oops, i made a mistke
<gogiel> workmad3: becasue i was testing it quickly on [1,2,3] arrya ;)
<workmad3> gogiel: wouldn't it have returned '3' in that case too?
nobitanobi has joined #ruby
<gogiel> class Array; def middle; self[size/2]; end; end
<ZenoArrow> workmad3, thank you so much for that gist, I understand most of it now! The only line I don't quite grok yet is this one, I understand what you're doing (calling a protected method from within the class), but I'm not familiar with all the syntax...
<ZenoArrow> other ? other.protected_foo : self.protected_foo
<workmad3> ZenoArrow: oh, sorry, that's just the ternary operator
<ZenoArrow> What do the ? and : symbols do in this example?
<ZenoArrow> The ternary operator?
<workmad3> ZenoArrow: it's equivalent to if other; other.protected_foo; else; self.protected_foo
shadykhan has joined #ruby
n3m has joined #ruby
<shadykhan> best ruby online learning source?
<ZenoArrow> Ah, I'm starting to see. Thanks workmad3.
<A124> I love ternary.. saves a ton of code.
tobym has joined #ruby
<workmad3> A124: as long as you don't abuse it ;)
nobitanobi1 has joined #ruby
<ZenoArrow> shadykhan, I've been using rubylearning.com. It's been pretty good to me so far, sometimes I'll get stuck but that just forces me to broaden my knowledge about the language.
colinwd has joined #ruby
<A124> workmad3: Yeah. Sometimes I do it on purpose though xD
<shadykhan> thanks ZenoArrow ill look into it
<ZenoArrow> You're welcome shadykhan.
martinciu has joined #ruby
<ZenoArrow> workmad3, two final questions about that gist. What happens when other is set to nil (i.e. the default behaviour) and self.protected_foo is called? How does other.protected_foo differ from self.protected_foo in terms of the program output?
stephenjudkins has joined #ruby
nari has joined #ruby
<workmad3> ZenoArrow: other.protected_foo calls protected_foo on the object you pass in (which in the example is a different instance of the same class)
<A124> I wonder.. if I shouldgo through some tutorial also, if I started earlier, when there was no known tutorial?
<workmad3> ZenoArrow: basically, it demonstrates that you can call protected_foo on other instances of the same class inside an instance method
<workmad3> ZenoArrow: however, because protected_foo just prints out the same line, no visible difference occurs ;)
<workmad3> ZenoArrow: however, if other is nil, then the method falls back on calling protected_foo on itself
<workmad3> ZenoArrow: so if you did 'a.call_protected_foo' it would call protected_foo on a, but when you do 'a.protected_foo(b)' it calls b.protected_foo
bwlang has joined #ruby
<ZenoArrow> Ah, so because you're passing in the object 'b' which is an object of the same class as 'a' then the call is made to b.protected_foo, rather than a.protected_foo?
cloke_ has joined #ruby
<workmad3> ZenoArrow: yeah
<ZenoArrow> Sorry, it seems I had another 'final question', must feel like an episode of Columbo to you! ; )
<workmad3> ZenoArrow: if you tried the same thing with a private method, you'd get an error ;)
<ZenoArrow> Thanks workmad3, you're a diamond, I understand it now!
<workmad3> lmi2
<workmad3> oops, that wasn't right :/
mneorr has joined #ruby
ChampS666 has joined #ruby
<ZenoArrow> You should really put that gist out there for more people to learn from, if you haven't already, as it really helps!
<ZenoArrow> As did your explanation of course!
<A124> workmad3: Just to clarify. You can call proteted methods only on other instances of self.class, right?
fr0gprince_ has joined #ruby
<workmad3> A124: pretty sure you can call protected methods on instances of subclasses too
phantasm66 has joined #ruby
<workmad3> ZenoArrow: I wrote that gist from scratch for you just now ;)
<ZenoArrow> That's freaking amazing dude, you're the bomb, seriously. I just copied the whole of this chat transcript and saved it in a text file called 'Understanding Ruby Access Control', I'm sure it'll come in handy should I ever need a refresher! :-)
artOfWar_ has joined #ruby
<workmad3> ZenoArrow: do you want to know the kicker? I don't think I've ever actually used 'protected' in ruby ;)
<workmad3> other than when learning the language
<A124> workmad3: Ah. And subclasses too, thanks.
polarist has quit [#ruby]
<ZenoArrow> Ha! Well you clearly understand it good enough to teach it, which is a very good indicator that you've absorbed the knowledge needed to use it, if you ever choose to. :-)
<ZenoArrow> Okay, I'm off. Cheerio peeps!
<workmad3> ZenoArrow: I was more indicating how 'useful' the knowledge is likely to be :)
swarley has joined #ruby
samsonjs has joined #ruby
<ZenoArrow> workmad3; I understand, but I like to learn as much as I can about programming, even if I'll probably not use it. :-)
<ZenoArrow> Thanks again workmad3. Bye for now.
ZenoArrow has quit [#ruby]
Araxia has joined #ruby
alup_ has joined #ruby
iocor has joined #ruby
artm has joined #ruby