<erikh>
yeah, just learning it, feels like perl's OOP without all that pesky flexibility
<seanstickle>
And Moose is quite nice !
<erikh>
Moose is killer.
rking has joined #ruby-lang
rohit has joined #ruby-lang
<imperator>
Moose once bit my sister
<erikh>
they need to write a companion module called Squirrel
<erikh>
man, 9pm
<erikh>
where did this day go
<imperator>
perl is pretty squirrly
<imperator>
back in the day, when i was looking to switch from perl to something better i started with....python
<imperator>
and i thought it kinda sucked
<erikh>
yeah, dunno. the more I play with it the less I like it.
<imperator>
then i stumbled across the pickaxe, and that was all she wrote
<erikh>
gonna pick up clojure soon too, I think.
<imperator>
i really don't think there's any real advantage to learning python unless you need it for a job
<erikh>
a modern lisp that doesn't suffer is appealing
<imperator>
yeah, an fp language would be good
<erikh>
well lisp isn't pure fp
<erikh>
but those arguments are for silly ph.d's
<imperator>
doctors of don't do jack shit in the real world
<erikh>
haha
<erikh>
<3
<imperator>
i was in academia before i was a programmer
<erikh>
I respect the degree, but yeah. hard to find post-docs doing anything that affects me directly
<imperator>
which is why i always cringe when the programming community jumps on some paper that comes out
<imperator>
i'm like, you know, publish or perish, right?
<erikh>
ah, yeah. I missed that whole boat, completely disconnected from the whole thing.
<imperator>
the gist of is a lot of academics are pressured to publish something seemlingly interesting/useful/controversial purely for the sake of doing so
ramonmaruko has joined #ruby-lang
<erikh>
ah I see
<imperator>
that's how stay relevant and get tenure
<erikh>
kind of like bloggers!
<imperator>
yup, except there's a paycheck and tenure :)
<erikh>
heh.
<erikh>
I don't know if I'd be comfortable at a job with tenure. I like to move on when I get bored.
<imperator>
so, i always read such papers with a giant grain of salt
<erikh>
I see.
<erikh>
Honestly, one thing I do want to go back to school for is more math
<erikh>
I've got a poor formal education so it's one of those things I struggle with.
<imperator>
i wouldn't mind going back for calc
<erikh>
yeah, calc and high-end linear algebra. figuring the latter would be a lot more useful as a nerd
<imperator>
i was the victim of bad teachers and...beer
<erikh>
haha, s/beer/ganja/ and .. yeah.
<imperator>
c++ too, good god, every time i tried to take it the teacher sucked!
<erikh>
I think the intro programming teachers are a lot worse than the higher end profs, or at least I'm told so
<imperator>
i remember one time, it was some guy the uni hired, he would take cell phone calls in the middle of class!
<erikh>
oh wow
<erikh>
that's pretty bad.
<imperator>
oh, and he required a book that was out of print
<imperator>
i think he got fired, but most of the class had dropped by then
<erikh>
yeah. my problem was mostly with literature classes.
<erikh>
reading 60 pages in 2 days isn't my idea of learning
<erikh>
especially when quizzed upon it.
<imperator>
well, all my literature was classical, and i was often reading it in latin or greek :)
<erikh>
lord.
<erikh>
what school?
<imperator>
"let us start, according to first principals, at the beginning" - won't forget that any time soon
<imperator>
uw-madison for undergrad, florida state for grad school
<imperator>
i kept some of my classical stuff, catullus and so forth
<imperator>
"let us live and let us love"
<erikh>
neat. I still have few bits here and there
<erikh>
dante, arabian nights, so forth.
<imperator>
never read dante; i wanted to take a course on it, but it never worked out
<erikh>
not that I actively read them. my wife is the book nerd
<erikh>
it's good, just not something you want to choke down in a week.
<erikh>
yeah; her idea of fun is reading the odyssey. IDGI
<imperator>
fagles' translation all the way!
<imperator>
lattimore is more literal, but much dryer
<imperator>
see, i can still remember that shit
<erikh>
ha. you nerd.
<imperator>
hell, i've read part of it in greek!
<erikh>
wow.
<erikh>
back in a min.
<imperator>
"rosy fingered dawn", yada yada
rippa has joined #ruby-lang
savage- has joined #ruby-lang
dubellz has joined #ruby-lang
<erikh>
yeah, sorry to burst anything, but none of these references are hitting home with me :)
datanoise has joined #ruby-lang
<imperator>
ever watch "the name of the rose"?
<erikh>
no I have not.
<erikh>
honestly, I'm a poor consumer of media
<erikh>
games, code, occasional light reading
<imperator>
it's a good movie, sean connery, christian slater
<imperator>
based around aristotle's poetics (books on tragedy and comedy)
<erikh>
hmmm
<erikh>
I'll write it down, my wife would probably dig that too.
<imperator>
yes, i think she would, and i think you would too, or at least wouldn't hate it
<seanstickle>
That was a good book
<seanstickle>
Ah, movie was ok.
<erikh>
yeah, I don't mind movies, just never seem to find the time to watch them
<imperator>
seanstickle, never read the book, probably should, but i already know the twist, so
<seanstickle>
The book is so much not about the twist.
<seanstickle>
It's about the mystery of the Word
<imperator>
well, don't give anything away!
<seanstickle>
And semiotics in general, of course, being written by Umberto Eco
<seanstickle>
It's a machine for generating interpretations.
<seanstickle>
I read that book and Foucault's Pendulum about once a year.
<seanstickle>
Delightful work.
<imperator>
i almost never read the same book twice
gouthamvel has joined #ruby-lang
<imperator>
certain movies/series i'll watch each year, though
nofxx has joined #ruby-lang
<imperator>
I, Claudius - watch it every year
<seanstickle>
Some books take multiple readings.
<imperator>
followed by Black Adder's Christmas Special, or something ;)
<seanstickle>
Goodness knows, I didn't absorb the Summa on the first pass.
<imperator>
never read it
<seanstickle>
Or even the Iliad
<imperator>
i've read the illiad more than i care to remember
<imperator>
but....i prefer the movie Troy these days :)
<freedrull>
oh ya, i guess it does mention thats for '2-4 unicorn workers'
<erikh>
so that means a single process is about 250k -- that's really not that bad for a mature rails app
vesan has joined #ruby-lang
<freedrull>
hmm ok
<rohit>
<nitpick> There is a #rubyonrails channel btw :)
<erikh>
yeah, rails generally isn't discussed here.
esad has joined #ruby-lang
gnufied has joined #ruby-lang
<freedrull>
ya i know sorry. i just get much more thoughtful answers here i'm afraid....
<freedrull>
anyway thanks
<erikh>
yeah, #ror is a bit of a cesspool
<rohit>
Most probably because by the time somebody asks a good question, everybody in there have gone through trolls, help vampires and such. :)
<rohit>
And then you get grumpy, passive aggressive responses. :P
<erikh>
the last time I was in there half the suggestions I got were by people who obviously didn't know the host language
<freedrull>
rohit: haha yeah that's exactly what seems to happen :{
dc5ala has joined #ruby-lang
yumike has joined #ruby-lang
thrcka has joined #ruby-lang
pw_ has joined #ruby-lang
nofxx has joined #ruby-lang
pw_ has quit [#ruby-lang]
<shevy>
it attracts only certain people
<shevy>
you know, like how flies are attracted to something ...
<kke>
a colleague of mine, coming from erlang, new to ruby has been using a lot of constants, like in a sinatra api he has made stuff like get '/documents/:id' do { Docid = params[:id]; .... } other than convention, is there some reason not to use local constants?
<rohit>
shevy: n00bs with a zomg this should be easier attitude?
<shevy>
kke local constant? what is that
<kke>
shevy: the kind of thing i demonstrated in the example, i don't know what they should be called then
<kke>
method's internal temporary variables, starting with a capital letter
<shevy>
I dont even know how this works
<shevy>
with that syntax I get an error
Tick-Tock has joined #ruby-lang
<shevy>
Interesting. Seems as if you can indeed define constants within a block.
<shevy>
Now I wonder if this is a feature or a bug. :)
<rohit>
Why would it be a bug?
<shevy>
ah at least you get a warning still if you do
<shevy>
rohit, well. you cant define a constant in a method
<rohit>
Hey you can't! I didn't know :D
<shevy>
to me a block is somewhere in between, not sure
<shevy>
it's like an extra argument to a method or?
<rohit>
Aren't they all Proc's?
<shevy>
did we define them better or fuzzy things up :P
<shevy>
I think I am going to wrap all my constants into a block from now on
<rohit>
Then they will be trapped in the block, no? :)
<shevy>
hah that works too:
<shevy>
foo('two') { Test::Foo = 7 }
<shevy>
now I just need to combine this somehow with ->
<shevy>
rohit I think they seem to be very free
<shevy>
perhaps there would even be a trick to dynamically assign constants
andkerosine has joined #ruby-lang
<andkerosine>
drbrain: Any chance you're up?
JohnBat26 has joined #ruby-lang
dhruvasagar has joined #ruby-lang
jnraine has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
esad has joined #ruby-lang
zmack has joined #ruby-lang
solars has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
futurechimp has joined #ruby-lang
voker57 has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
heftig has joined #ruby-lang
bawer has joined #ruby-lang
advait has joined #ruby-lang
francisfish has joined #ruby-lang
futurechimp has joined #ruby-lang
tekin has joined #ruby-lang
<andkerosine>
What causes implicitly returning a splat to fail?
<rippa>
returning a splat?
<shevy>
andkerosine doesnt this retun an array?
<shevy>
because afaik that's all that * does
<andkerosine>
def foo; bar = 'baz'.bytes; *bar; end
<andkerosine>
Is a syntax error.
<rippa>
yes
<rippa>
that is
<andkerosine>
Why?
<rippa>
because you don't have a method
<andkerosine>
return *bar works?
<rippa>
it does?
<andkerosine>
It does.
<rippa>
good
<rippa>
it's the same as returning an array
<robgleeson|mba>
andkerosine: why do that though?
<robgleeson|mba>
just return baz.
<andkerosine>
?
<andkerosine>
Just gonna disregard.
<rippa>
write 1,2,3 on a line by itself
<robgleeson|mba>
splat calls to_a.
<rippa>
it's a syntax error too
<robgleeson|mba>
you already have an array.
<robgleeson|mba>
ah enumerator.
<robgleeson|mba>
just do to_a.
<shevy>
andkerosine perhaps there is no way for the parser to make sense of this without seeing "return"
<andkerosine>
shevy: Bless you for addressing the actual question.
gouthamvel has joined #ruby-lang
<andkerosine>
I figure that's the case.
<andkerosine>
Just wanted to see if somebody knew of any specifics.
<robgleeson|mba>
andkerosine: well, people just didn't answer you directly because your solution isn't very idiotmatic of ruby.
<shevy>
but I dont know how the parser really works. it may be that it could expect additional information after *bar, whereas with return it knows it is the last thing
<andkerosine>
robgleeson|mba: Sometimes people ask questions out of nothing more than curiosity.
<shevy>
in python we'd always have to be explicit :)
<andkerosine>
Which is gross.
<robgleeson|mba>
oh okay, i thought you just wanted to return array :p
<robgleeson|mba>
the parser doesn't understand your syntax.
<robgleeson|mba>
that's all.
<andkerosine>
No... shit.
<robgleeson|mba>
it doesn't know what you expect it do.
<robgleeson|mba>
to do^
<robgleeson|mba>
it hasn't anticipated what you're doing.
<shevy>
it probably can not even anticipate anything at this point
<andkerosine>
Generalities are grand.
<shevy>
hmm although
<robgleeson|mba>
what kind of answer do you want
<shevy>
with a VM, shouldn't it be able to anticipate?
<shevy>
ah, this is all over my head anyway. I am going to watch TV. :)
<andkerosine>
The fact that explicitly returning works seems to indicate that splatting doesn't evaluate internally to an expression, no?
<robgleeson|mba>
not in the context you're using it in.
<andkerosine>
Shouldn't it?
<rippa>
probably some shortcut in the parser, like that issue with methods and hash parameters
<robgleeson|mba>
andkerosine: the splat operator is special in that it behaves differently in different contexts (method definitions, method calls)
<manveru>
andkerosine: there is no way that can work :)
<andkerosine>
Please do explain?
<manveru>
it's not valid ruby syntax
<andkerosine>
I know... but why?
<manveru>
because the parser doesn't accept it
<manveru>
def foo; 1,2,3; end
<andkerosine>
But... why is that the case?
<manveru>
that doesn't work either
<andkerosine>
Right.
<andkerosine>
The parser splats before doing anything else?
<manveru>
anyway, returning a splat and returning an array are the same
<andkerosine>
It was a syntax curiosity and nothing more.
<manveru>
unless the number of elements is < 2
<manveru>
well, i don't think anybody can explain that
<shevy>
manveru!
<manveru>
shevy: oi
srbartlett has joined #ruby-lang
<Mon_Ouie>
Anyway, there's no reason to use a splat there
<Mon_Ouie>
You can just do bar, it will do the same thing
bawer has joined #ruby-lang
<manveru>
hm, it's actually the same even with < 2 values
<manveru>
i thought *[] would return nil, but it doesn't
<matti>
manveru: :)
Arnvald has joined #ruby-lang
d3vic3 has joined #ruby-lang
Radium has joined #ruby-lang
rushed has joined #ruby-lang
rohit has joined #ruby-lang
Sulfur has joined #ruby-lang
<Defusal>
anyone know which is more efficient for recursively walking a path, Dir[] or Pathname?
<andkerosine>
Anyone know how to benchmark? : P
<Defusal>
andkerosine, i already have to benchmark so many things, so i'd prefer it if someone knew something simple like that, since a reasonable amount of my day is already taken up benchmarking :/
cyndis has joined #ruby-lang
<shevy>
Defusal I always pick Dir because I hate Pathname passionately
<matled>
Defusal: is your directory even large enough to care?
<matled>
shevy: why is that?
<Defusal>
shevy, why is that?
<Defusal>
:P
<shevy>
matled years of using Pathname
<shevy>
it must die
<Defusal>
Pathname seems to provide a lot of data i need
<Defusal>
so it may be more efficient than Dir[] and getting the rest of the data with File.stat, etc
<Defusal>
but i'm not sure
<Defusal>
matled, time is important
<shevy>
ok let's benchmark
<matled>
shevy: I'm using it quite regularly too. it has some things to get used to but I found nothing to drop it
<Defusal>
i have benchmarked and optimized the copying and database queries today
<andkerosine>
Hm... TCP just isn't as simple as HTTP in terms of sending a message, huh?
<Defusal>
so now i just need to implement the filesystem walking as optimally as possible
<Defusal>
im going to check each directories mtime first
<Defusal>
and only go deeper when something has changed
<shevy>
I even forgot how to use pathname
<shevy>
matled, I dunno. I hate it.
<Defusal>
andkerosine, HTTP is over TCP, you'll need a protocol to use TCP
<shevy>
how do you get entries with Pathname again?
<matled>
shevy: #entries or #each_entry on a pathname object (Pathname.new(path))
<Defusal>
andkerosine, you can implement your own simple protocol, but if you want the connection to live for an extended period of time it will need a ping/pong timeout reconnect system at the very least
<shevy>
ah entries ok
<andkerosine>
Mostly just testing purposes at the moment.
<Defusal>
entires?
<shevy>
ack
<matled>
in many cases it's just pathname.method instead of File/Dir.method(path)
<Defusal>
entries*
<shevy>
that gives me a list of Pathname entries
<Defusal>
i was looking at #children
<andkerosine>
For instance, I can't just POST the right data to Tinychat's server, right?
<shevy>
Pathname.new('/tmp').entries
setmeaway has joined #ruby-lang
<Defusal>
andkerosine, i have no idea what Thinchat is, but if it does not have a HTTP interface, you cannot use HTTP
<shevy>
what is the Pathname equivalent to Dir['/tmp/*'] ?
<Defusal>
i assume Pathname lazy loads
<shevy>
awesome
<shevy>
:P
<Defusal>
in which case it wouldn't be much different from using Dir[], File.stat and friends
morozovm has joined #ruby-lang
<Defusal>
so i guess it would just be a little more convenient
futurechimp has joined #ruby-lang
ankurgel has joined #ruby-lang
PhilCK has joined #ruby-lang
morozovm has joined #ruby-lang
dhruvasagar has joined #ruby-lang
postmodern has joined #ruby-lang
andkerosine has quit [#ruby-lang]
futurechimp has joined #ruby-lang
syphar has joined #ruby-lang
esad has joined #ruby-lang
apeiros_ has joined #ruby-lang
Stalkr_ has joined #ruby-lang
jtoy has joined #ruby-lang
pw_ has joined #ruby-lang
srbartlett has joined #ruby-lang
woollyams has joined #ruby-lang
m3nd3s_ has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
rushed_ has joined #ruby-lang
tekin has joined #ruby-lang
morozovm has joined #ruby-lang
chimkan has joined #ruby-lang
rking has joined #ruby-lang
m3nd3s has joined #ruby-lang
pw_ has joined #ruby-lang
lele|w has joined #ruby-lang
lele|2 has joined #ruby-lang
francisfish has joined #ruby-lang
toretore has joined #ruby-lang
Sailias has joined #ruby-lang
morozovm has joined #ruby-lang
mssola has joined #ruby-lang
retro|cz has joined #ruby-lang
m3nd3s has joined #ruby-lang
chimkan has joined #ruby-lang
tommyvyo has joined #ruby-lang
jtoy has joined #ruby-lang
greap has joined #ruby-lang
codewrangler has joined #ruby-lang
morozovm has joined #ruby-lang
bglusman has joined #ruby-lang
yalue has joined #ruby-lang
Joeysomo has joined #ruby-lang
morozovm has joined #ruby-lang
dv310p3r has joined #ruby-lang
Joeysomo has joined #ruby-lang
bradland has joined #ruby-lang
ioga_wrk has joined #ruby-lang
morozovm has joined #ruby-lang
justinxreese has joined #ruby-lang
uniqanomaly__ has joined #ruby-lang
mstratman has joined #ruby-lang
Graag has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
<Graag>
Very naive question.
<shevy>
yay!
<Graag>
I only see benefits using jRuby over standard Ruby implementation
<shevy>
drawback: you require java
<Graag>
Is there actually any drawback ?
<shevy>
I dont have java here working for instance :)
<shevy>
when you can use java though, I think jruby is one of the fastest ruby impl
<Graag>
Yeah, I have to install Java, that's true
<Graag>
and except that ?
<Graag>
Because if it's the only drawback, Ruby should become jRuby :P
<mstratman>
http://ruby.stadik.net/ (from the /topic) is down. Can anyone share a really brief description of what it is?
<shevy>
Graag not sure if there are many other drawbacks
<shevy>
Graag it's a big one though, you would have whole of ruby depend on java suddenly
<Graag>
shevy: on JVM more precisely
<shevy>
JVM requires java or?
<shevy>
at runtime
<Graag>
shevy: Yeah at runtime, true. But that would allow me to use Ruby for embedded robotics..
<shevy>
Graag well you talk about advantages now :)
<shevy>
in my use case it would be a disadvantage (right now) to require java, in order to use ruby
<shevy>
I am using ruby mostly for small .rb files
<shevy>
you know, like you used to use perl or even php (I use ruby for my web stuff too)
<robgleeson|mba>
Graag: it is not the only drawback, JRuby cannot do some things that MRI can.
<Graag>
robgleeson|mba: like... ? :)
<robgleeson|mba>
Graag: Kernel.fork, would be one.
<robgleeson|mba>
Graag: I've also seen a lot of "# JRuby hack" when calling out to the OS.
<robgleeson|mba>
Graag: the other problem is that it is notoriously slow to boot (unless you run a server).
<robgleeson|mba>
Graag: and, finally, CRuby is not that terrible for most workloads.
<Graag>
robgleeson|mba: But jRuby would allow me to do parallel programming, right ?
<robgleeson|mba>
you can do that in CRuby.
<robgleeson|mba>
but sure, jRuby has native threads that run in parallel.
<robgleeson|mba>
CRuby has Kernel.fork, and for IO bound operations there is no GIL.
<Graag>
ok
<robgleeson|mba>
people like to beat on CRuby a lot but I would say for most workloads there is nothing wrong with it.
syphar has quit ["Bye!"]
<robgleeson|mba>
and one downside is another upsides, maybe you want to call out to C, not Java.
<robgleeson|mba>
so it really depends.
<Graag>
Thanks for this information :)
lsegal has joined #ruby-lang
datanoise has joined #ruby-lang
Sailias has joined #ruby-lang
rolfb has joined #ruby-lang
jtoy has joined #ruby-lang
pw__ has joined #ruby-lang
casaram has joined #ruby-lang
frem has joined #ruby-lang
vesan has joined #ruby-lang
outoftime has joined #ruby-lang
dous has joined #ruby-lang
enebo has joined #ruby-lang
JEG2 has joined #ruby-lang
jbwiv has joined #ruby-lang
kith has joined #ruby-lang
morozovm has joined #ruby-lang
jxie has joined #ruby-lang
mistym has joined #ruby-lang
Mchl has joined #ruby-lang
ankurgel has joined #ruby-lang
<shevy>
hmm odd question ...
casaram has joined #ruby-lang
<shevy>
did anyone of you notice that, when you write a project that grows and grows as time passes by
tbuehlmann has joined #ruby-lang
<shevy>
it tends to start to spawn sub-projects, that are usable on their own?
gouthamvel has quit [#ruby-lang]
Mchl has joined #ruby-lang
futurechimp has joined #ruby-lang
Arnvald has joined #ruby-lang
wyhaines has joined #ruby-lang
<mistym>
So what's the preferred ncurses gem?
<mistym>
I was disappointed to see builtin Curses doesn't do colour :(
rking has joined #ruby-lang
quetzal- has joined #ruby-lang
tekin has joined #ruby-lang
<bradland>
shevy: that's a core tenant of many programming philosophies: break tasks down in to small parts, don't repeat yourself, design your API in a way that maximizes utility by callers that have no knowledge of the internals
esad has joined #ruby-lang
msisk has joined #ruby-lang
andrewhl has joined #ruby-lang
Radium has joined #ruby-lang
n9yty has joined #ruby-lang
nofxx has joined #ruby-lang
rking has joined #ruby-lang
n9yty has joined #ruby-lang
chimkan_ has joined #ruby-lang
casaram has joined #ruby-lang
Radium has quit [#ruby-lang]
outoftime has joined #ruby-lang
<mistym>
No curses users around today? :p
<shevy>
mistym I curse too much against it, so I never get to actually use it!
rippa has joined #ruby-lang
jondot has joined #ruby-lang
jtoy has joined #ruby-lang
wmoxam has joined #ruby-lang
chimkan has joined #ruby-lang
<erikh>
hello internet
scampbell has joined #ruby-lang
<shevy>
hello erikh
mztriz has joined #ruby-lang
<shevy>
imperator unfortunately owns the internet but you can become second in command
esad has joined #ruby-lang
Phrogz has joined #ruby-lang
SkramX has joined #ruby-lang
slimfit has joined #ruby-lang
joshkraemer has joined #ruby-lang
joshkraemer has joined #ruby-lang
imperator has joined #ruby-lang
florentg2 has joined #ruby-lang
<erikh>
number 1!
<shevy>
imperator!
<imperator>
hail to the king, baby
chimkan has joined #ruby-lang
heftig has joined #ruby-lang
virunga has joined #ruby-lang
takaokouji has joined #ruby-lang
dejongge has joined #ruby-lang
m3nd3s has joined #ruby-lang
slimfit has joined #ruby-lang
Radium has joined #ruby-lang
laudo has joined #ruby-lang
<laudo>
hy is there a way I can add a distinct or unique to that code http://pastie.org/3715202 so that it only show my output of the class once?
<TTilus>
Harzilein: you essentially need to copy-paste the whole #deliver! to redefine it as slightly different version
<TTilus>
Harzilein: that said, do not do it
uniqanomaly_ has joined #ruby-lang
<TTilus>
Harzilein: introduce a new method if you want to extend the interface
<erikh>
^
<erikh>
or patch sendmail to yield
<erikh>
(alternatively)
<erikh>
but dealing with that much code in a monkeypatch is a recipe for disaster
ridders24 has joined #ruby-lang
<erikh>
very unlikely to work with later versions of the gem.
<ridders24>
hi guys
<ridders24>
I don't understand why im getting the following errors: test.rb:11:in `block in <main>': undefined local variable or method `output_file _contents' for main:Object (NameError) from test.rb:5:in `each' from test.rb:5:in `<main>'. http://pastie.org/3715613
chimkan has joined #ruby-lang
takaokouji has joined #ruby-lang
datanoise has joined #ruby-lang
<Phrogz>
ridders24: Because you are reading the value on line 11 of your paste before you ever set it.
<Phrogz>
Since Ruby does not see an assignment until after a read, it assumes that this is a method and not an undefined local variable.
<Phrogz>
ridders24: What was your intention with line 11?
<ridders24>
to convert "file" from a array to a string. I changed the code abit since and now have a new issue
<Phrogz>
ridders24: Pastie away and ask away. (Assigning to a variable never changes the type of an object; you may have wanted my_array.first.to_s
casaram has joined #ruby-lang
<ridders24>
oh ok. so this is what i did instead http://pastie.org/3715613 and now get: test.rb:11:in `to_s': wrong number of arguments(1 for 0) (ArgumentError) from test.rb:11:in `block in <main>' from test.rb:5:in `each' from test.rb:5:in `<main>'
Radium has joined #ruby-lang
<Phrogz>
First, let's read what that error is saying. It's saying, "The call to to_s on line 11 has one argument passed to it, but I expected 0."
<Phrogz>
Second, you misunderstand what Dir.glob returns, and/or what #each does. Dir.glob returns an array of strings (the paths to files/folders). Array#each yields each value of the array to you in turn.
dv310p3r has joined #ruby-lang
<Phrogz>
Thus, the 'file' local variable is already a string.
<Phrogz>
Third, if you _did_ have an array referenced by the 'file' variable, then you would invoke the Array#to_s method on it by calling indata = file.to_s
<Phrogz>
If you are trying to read the contents of the file, then you want either indata = IO.read(file) or indata = File.open(file,'r'){ |f| f.read }
<ridders24>
ok let me get my head round this. sorry still new to this
<Phrogz>
No problem!
vereteran has joined #ruby-lang
rue has joined #ruby-lang
<ridders24>
im trying to read the contents of a drive or drives but only looking for a particular file type. I discovered today that the list is so huge that cmd wont show me it all. so I wanted to export the puts file to a txt file. Eventually i want to have an input file that contains part of file names that I want thr script to grep and go offf and search the drives for then tell me where they are
jtoy has joined #ruby-lang
<ridders24>
does that make sence?
<Phrogz>
So you want to find all the *.txt files on your drive and create a list of the absolute paths to them, and write it to a file?
<ridders24>
exactly :)
<Phrogz>
Let me show you one simple way to do that.
<ridders24>
Phrogz: Man...less code than my attempt lol
<Phrogz>
I'm not sure if you really need to chdir to c: first, or if you can just Dir['c:/**/*.txt'] ; I'm not on Windows to test.
<Phrogz>
Dir.[] is the same as Dir.glob
<ridders24>
yh I tried both of those before and did notice anything different. why would I use one over the other?
publicvoid has joined #ruby-lang
nofxxx has joined #ruby-lang
achiu has joined #ruby-lang
<ridders24>
If I wanted to introduce an input file, that contained a list of names that would be part of a file name, how would I grep search for each line, then it search the drive as it does now and output into to_file
YOUR_NICK has joined #ruby-lang
sdeobald has joined #ruby-lang
chimkan has joined #ruby-lang
nofxx has joined #ruby-lang
<shevy>
wat
<TTilus>
didnt understand either...
<shevy>
it is too long to understand. I understand he wants to grep something
<shevy>
ridders24, you could use an array and grep on it?
Hakon|mbp has joined #ruby-lang
<shevy>
like all your matches
<shevy>
your_array = Dir['c:/**/*.txt']
<TTilus>
ridders24: why dont u start by describing your actual problem
<shevy>
and then you continue to work on your_array
<TTilus>
ridders24: who will use what you are writing and what he'll use it for?
<shevy>
hehe
butchanton has joined #ruby-lang
slimfit has joined #ruby-lang
rolfb has joined #ruby-lang
m3nd3s has joined #ruby-lang
mrsolo has joined #ruby-lang
<TTilus>
i wouldnt be surprised if the thing ridders24 is after would be essentially shell oneliner
<shevy>
ewwww shell
<shevy>
you evil evil man :<
* any-key
hurls a red shell at shevy
<shevy>
oh no, not again
* shevy
presses any-key
<any-key>
I will replace you with a bash script
<shevy>
WHERE ARE YOU!
<shevy>
I CAN'T FIND THE ANY-KEY
<TTilus>
also it wouldnt surprise if ridders24 just ignored my question and went on asking about Array#grep
<shevy>
TTilus, I think he is just shy now :>
* shevy
presses any-key again
<any-key>
bah
<shevy>
man any-key are you useful for anything!!!
<any-key>
I really don't feel like working on my roomba project anymore
<shevy>
you strike me as worse than caps lock :(
<shevy>
roomba?
<shevy>
is that a hawaian project?
<any-key>
I just realized I have to do serial IO from two separate processes :'(
<shevy>
ewww
<shevy>
sounds like work
<any-key>
to the same device
<any-key>
so I have to figure out some queueueueuing system or stupid IPC
<any-key>
I really don't want to mess with IPC
<TTilus>
named pipes
<any-key>
yeah, I might try that
<any-key>
have each process throw roomba packets at the pipe and have a single process handle the sending and whatnot
<any-key>
I'll need to add support for digital IO to my roomba library as well :P
<any-key>
gonna add sensor support and package it into a gem eventually :D
<shevy>
any-key, it does indeed sound like work
<shevy>
with threads too
<any-key>
agh no
<any-key>
there's two separate programs that receive accelerometer data and convert it into roomba commands
ankurgel has joined #ruby-lang
<any-key>
I just need to make them cooperate
slimfit has joined #ruby-lang
<any-key>
I think TTilus is right, named pipes would be the way to go
butchanton has quit [#ruby-lang]
butchanton has joined #ruby-lang
<any-key>
on the bright side I have code in place to drive a roomba by waving your hands around...it works surprisingly well :D
<TTilus>
any-key: kinect?
<any-key>
TTilus: I wish...we're constrained to using the TI Chronos shitty watches sdk thingy
<any-key>
it's my senior design project, our task was to make a multiplayer game using those watches
<any-key>
after like 3 weeks of brainstorming we realized you can't do SHIT with them on their own and grabbed some roombas from the AI labs :)
<TTilus>
so you decided to go with roomba robot wars?
<any-key>
...now we're building a motion-controlled roomba gladiator arena
<any-key>
with lasers, for real
<TTilus>
\o/
<rue>
The Samsung is a superior design
<ridders24>
I will be using the script, its purpose to find particular files on a server and show me where they are. I have a speadsheet with the file name of each file on each line with other unrelavent information on the same lines. I need a way to just filter out of the spreadsheet the file names and then search the servers for where those files are but end with the file extenion difined in the script
<any-key>
sounds like a shell script to me
<any-key>
find + xargs + grep + other stuffs
<any-key>
if you were using OS X I'd recommend mdfind
<ridders24>
windows im afraid
<any-key>
heh
<TTilus>
doesn't windows have a slocate counterpart?
<any-key>
surely there's some awesome powershell commands for that
<TTilus>
that would do the job
<rue>
Doesn't Find work on Winders?
<TTilus>
rue: slooooooow
<TTilus>
and yes, it works
<any-key>
seriously, look into powershell
<ridders24>
okay
<any-key>
I know next to nothing about it, but it seriously is very powerful
<any-key>
and I'm 100% certain someone has figured out a series of commands to do what you want
<shevy>
ridders24 there is one man to ask when it comes to ruby + windows
<shevy>
imperator here!!!
gouthamvel has joined #ruby-lang
<shevy>
also if you need a deathstar for rent, he is your man
gouthamvel has quit [#ruby-lang]
<shevy>
but don't comment on his heavy breathing, he does not like that
<ridders24>
I will look into it, but on the basis im trying to learn ruby, I kind of wanted to do it in ruby
YOUR_NICK has joined #ruby-lang
<TTilus>
ridders24: ok, now you have a totally different angle
<ridders24>
TTilus: ?
m3nd3s has joined #ruby-lang
<any-key>
ridders24: it's not a very good ruby problem, since a fast search requires indexing and etc, and modern operating systems already do that
<TTilus>
ridders24: 1) build a list of all paths in your system (and optionally save it for further use) 2) grep that list with your patterns, one by one
<TTilus>
any-key: but it is fairly simple task and in that sense a good one for the purpose (if speed is not a highly crucial factor)
<any-key>
I suppose
<any-key>
it's a bit OS-dependent
<TTilus>
most definitely
<ridders24>
speed is not really an issue,
<shevy>
good!
bglusman has joined #ruby-lang
<shevy>
it is still a simple strategy
<ridders24>
its just a task that needs doing and I thought on the basis im learning I thought I would try it with ruby
<shevy>
because (1) you build your path first (and have all the data) and then (2) you check on that data
<ridders24>
when you say slow, is what why the script take a little while to come back with results?
<TTilus>
ridders24: Phrogz already provided you the first part
<ridders24>
yh I know, and thats great, its works perfectly
<shevy>
hehe
<ridders24>
makes me laugh and the attempt I made to get my script to work and how his code is so much neater than mine
<TTilus>
ridders24: the other part would essentially consist of puts paths.grep(your_pattern)
imajes has joined #ruby-lang
<any-key>
you should write an indexer as well :D
<TTilus>
ridders24: where your_pattern is an item in the list of patterns you have extracted from the spreadsheet
byronb has joined #ruby-lang
<ridders24>
was just about to ask that
<TTilus>
any-key: thats definitely the next step
gouthamvel has joined #ruby-lang
<ridders24>
could that all be done in the one script?
<any-key>
there's some neat indexers out there
<any-key>
sure
<ridders24>
I'll have a google for ruby indexer too
<ridders24>
its about 11 20TB servers I need to scan over to find all the data i need
<any-key>
srsly
<any-key>
agh okay you'll want to index.....
<TTilus>
its good to know about the requirements ya know... =D
<ridders24>
yh this is all to learn. Its a task I do already but struggle with. I thought a nice little script like this could really help me out and I can learn at the same time
<any-key>
I cannot stress enough how important it will be to tie into whatever windows uses to index files
<TTilus>
you might want to try something like xapian or ferret
<any-key>
like in OS X you can do mdfind with uses spotlight for full-text search
thrcka has joined #ruby-lang
<ridders24>
okay I'll look into that too
<Phrogz>
Any in Windows… :p
<Phrogz>
s/Any/And/
<any-key>
ruby + windows isn't as much fun as ruby + *nix :P
<TTilus>
ridders24: you might need to call windows api with ffi
francisfish has joined #ruby-lang
<ridders24>
guys, im going afk for a bit, as dinner has arrived, If you have gone when I get back, I would just like to say thank you for all the help you have given me
<any-key>
you are welcome
<TTilus>
np
nofxx has joined #ruby-lang
l0st1 has joined #ruby-lang
apeiros_ has joined #ruby-lang
shtirlic has joined #ruby-lang
JEG2 has joined #ruby-lang
<rue>
Eew Windows servers
joshkraemer has joined #ruby-lang
Boohbah has joined #ruby-lang
ankurgel has quit [#ruby-lang]
curtism has joined #ruby-lang
bglusman has joined #ruby-lang
virunga_ has joined #ruby-lang
sodani has joined #ruby-lang
Austin__ has joined #ruby-lang
<sodani>
is there a one-line if-else conditional expression in ruby? thought there was
<yxhuvud>
? :
<mistym>
sodani: Yeah, the ternary operator yxhuvud tersely showed you ;)
<drbrain>
if x then y else z end or x ? y : z
<mistym>
Same as in C.
<mistym>
I'd prefer the `if x then y else z end` formulation if only it didn't require the "end".
<sodani>
drbrain: thanks. yeah I thought yxhuvud was answering me but I couldn't make out the syntax from the response :-)
<sodani>
mistym: yeah, I agree that that would be more readable
<mstratman>
it's bad practice, imo, the use the ternary operator if you're not collecting the returned value, though.
<drbrain>
mstratman: agreed
<Phrogz>
But but...it's so terse!
nofxx has joined #ruby-lang
virunga has joined #ruby-lang
<shevy>
hmm
<shevy>
omitting end ....
<shevy>
:)
ivanoats has joined #ruby-lang
tonesfrommars has joined #ruby-lang
t has joined #ruby-lang
kyrylo has joined #ruby-lang
erics has joined #ruby-lang
<slyphon>
why is it as soon as i have a problem with warbler, *nobody* is around in #jruby
bawer has joined #ruby-lang
jxie_ has joined #ruby-lang
zmack has joined #ruby-lang
JEG2 has joined #ruby-lang
casaram has joined #ruby-lang
wyhaines has joined #ruby-lang
esad has joined #ruby-lang
rking has joined #ruby-lang
dragonkh has joined #ruby-lang
jacktrik has joined #ruby-lang
benanne has joined #ruby-lang
kvirani has joined #ruby-lang
Skif has joined #ruby-lang
casaram has quit [#ruby-lang]
rushan_ has joined #ruby-lang
rushan_ has quit [#ruby-lang]
crackity_jones_ has joined #ruby-lang
florentg2 has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
enebo has joined #ruby-lang
Keltia_ has joined #ruby-lang
weeb1e_ has joined #ruby-lang
yorickpeterse1 has joined #ruby-lang
yorickpeterse1 has joined #ruby-lang
kalleth_ has joined #ruby-lang
corecode_ has joined #ruby-lang
zerokarm1left has joined #ruby-lang
hachiya_ has joined #ruby-lang
SubSpawnLnx has joined #ruby-lang
nevynxxx_ has joined #ruby-lang
cronin102 has joined #ruby-lang
qz has joined #ruby-lang
mrb_bk_ has joined #ruby-lang
akahn_ has joined #ruby-lang
melter_ has joined #ruby-lang
Guedes0 has joined #ruby-lang
banaan has joined #ruby-lang
lupine_86 has joined #ruby-lang
VladGh has joined #ruby-lang
mfournier1 has joined #ruby-lang
dbussink has joined #ruby-lang
andrewhl has joined #ruby-lang
achiu has joined #ruby-lang
tris has joined #ruby-lang
tallship has joined #ruby-lang
dejongge has joined #ruby-lang
lucas has joined #ruby-lang
Nisstyre has joined #ruby-lang
oddmunds has joined #ruby-lang
mrchrisadams has joined #ruby-lang
imperator has quit ["Leaving"]
lupine_85 has joined #ruby-lang
nazty has joined #ruby-lang
vesan has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
Carnage\ has joined #ruby-lang
bglusman has joined #ruby-lang
fireglow has joined #ruby-lang
retro|cz has joined #ruby-lang
Defusal_ has joined #ruby-lang
Defusal_ has joined #ruby-lang
kvirani has joined #ruby-lang
srbartlett has joined #ruby-lang
postmodern has joined #ruby-lang
<andrewvos>
slyphon: Such is life.
* slyphon
pulls his beard
thone_ has joined #ruby-lang
* andrewvos
pulls his imaginary beard
<slyphon>
haha
<andrewvos>
Beards are overrated
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
futurechimp has joined #ruby-lang
countskm has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
futurechimp has joined #ruby-lang
<andrewvos>
rue: Please adjust your stance and continue with Draw Something. You don't have to use the pay version!
<rue>
No, they're douches.
Phrogz has joined #ruby-lang
<andrewvos>
They are, but you probably still own a Mac right? You're aware that Apple are the biggest douches, like, in the world right?
chimkan_ has joined #ruby-lang
Indian has joined #ruby-lang
<andrewvos>
rue: QED
headius has joined #ruby-lang
dv310p3r has joined #ruby-lang
dragonkh has joined #ruby-lang
<shevy>
hey
<shevy>
dont you use a mac andrewvos ???
<andrewvos>
shevy: Umm. Yes. Yes I do.
<shevy>
:(
<shevy>
linux will die
<countskm>
lol
<shevy>
I blame you mac users
<andrewvos>
shevy: If ubuntu wasn't such a fucking mistake then linux would be ok
<andrewvos>
s/ubuntu/unity/
<shevy>
hey, dont s/ that ... it's still correct :))
<shevy>
unity reminds me of someone looking at things like ipad, and thinking "whoa, we need that as user interface"
<shevy>
that's typical innovation on linux desktop
jarred__ has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
Phrogz has joined #ruby-lang
gregf has joined #ruby-lang
* manveru
uses i3 :)
jarred_ has joined #ruby-lang
Phrogz has joined #ruby-lang
<lordzero>
evening all :)
Hakon|mbp has joined #ruby-lang
<andrewvos>
GOOD EVENING LORD ZERO
<countskm>
buenas tardes
<lordzero>
i feel the love
<lordzero>
and since when did Tampa start speaking spanish?
<lordzero>
:p
<countskm>
yo no se - quizas hace tres meses
<countskm>
ok i have reached the limit of my high school spanish
<countskm>
hehe
<lordzero>
whew
<lordzero>
i was going to have to resort to google translate
<countskm>
actually i took french in hs.. it was drop my ass in puerto rico and survive spanish