ChanServ changed the topic of #ruby-lang to: Ruby 1.9.3-p125: http://ruby-lang.org | Paste >3 lines of text on http://pastie.org or use a gist
<imperator> happy thoughts
<erikh> all the love things
tjadc has joined #ruby-lang
Mchl has joined #ruby-lang
pabloh has joined #ruby-lang
Radium has joined #ruby-lang
pavan has joined #ruby-lang
shevy has joined #ruby-lang
datanoise has joined #ruby-lang
surfprimal has joined #ruby-lang
matti has joined #ruby-lang
<rue> Wee love
nif has joined #ruby-lang
fayimora has joined #ruby-lang
savage- has joined #ruby-lang
gsav has joined #ruby-lang
apeiros_ has joined #ruby-lang
nif has joined #ruby-lang
nif has joined #ruby-lang
neoesque has joined #ruby-lang
RORgasm has joined #ruby-lang
fayimora_ has joined #ruby-lang
tomzx has joined #ruby-lang
shtirlic has joined #ruby-lang
mistym has joined #ruby-lang
Sailias has joined #ruby-lang
guns has joined #ruby-lang
t has joined #ruby-lang
Teddy2steper has joined #ruby-lang
lsegal has joined #ruby-lang
Jade has joined #ruby-lang
dr0id has joined #ruby-lang
jxie has joined #ruby-lang
gix has joined #ruby-lang
savage- has joined #ruby-lang
Teddy2steper has joined #ruby-lang
wallerdev has joined #ruby-lang
seanstickle has joined #ruby-lang
Teddy2steper has joined #ruby-lang
mistym has joined #ruby-lang
savage- has joined #ruby-lang
cirwin has joined #ruby-lang
<cirwin> how do I convert a ptrdiff_t into a ruby number through the C api?
<rue> You'll have to cast
andrewhl has joined #ruby-lang
<cirwin> will casting it to long long always just work? (I know little C)
RORgasm has joined #ruby-lang
<shachaf> cirwin: ptrdiff_t is just a typedef integer type.
<cirwin> sure — but I don't know how wide it is?/
<cirwin> so presumably I can cast it to long long (the widest) safely always?
<shachaf> How do you convert a normal integer type into a Ruby number?
<shachaf> cirwin: I'm not sure whether the standard says that, but in practice probably. :-)
<shachaf> You can always check it with sizeof.
<cirwin> INT2FIX or LONG2FIX or LL2NUM
<cirwin> if sizeof(ptr_diff_t) > sizeof(long long); rb_raise("ZOMG")
<shachaf> I think you usually use "assert" or something for that. :-)
ryanf_ has joined #ruby-lang
mistym has joined #ruby-lang
Teddy2steper has joined #ruby-lang
loh has joined #ruby-lang
mikeric has joined #ruby-lang
tomzx_ has joined #ruby-lang
Teddy2steper has joined #ruby-lang
imperator has quit ["Leaving"]
daystrom has joined #ruby-lang
rippa has joined #ruby-lang
wallerdev has joined #ruby-lang
<nif> HELP
<nif> --HELP
<mistym> help, man! man help
<nif> --help
<nif> srry :( mistake
Teddy2steper has joined #ruby-lang
Teddy2steper has joined #ruby-lang
mikeric has joined #ruby-lang
jfelchner has joined #ruby-lang
jfelchner has joined #ruby-lang
Teddy2steper has joined #ruby-lang
jfelchner has joined #ruby-lang
Jade has joined #ruby-lang
kiddorails has joined #ruby-lang
fgomez has joined #ruby-lang
RORgasm has joined #ruby-lang
Karmaon has joined #ruby-lang
x0F_ has joined #ruby-lang
Radium has joined #ruby-lang
jfelchner has joined #ruby-lang
mrsrikanth has joined #ruby-lang
yxhuvud has joined #ruby-lang
Teddy2steper has joined #ruby-lang
mikeric has joined #ruby-lang
Teddy2steper has joined #ruby-lang
vesan has joined #ruby-lang
zmack has joined #ruby-lang
surfprimal has joined #ruby-lang
Teddy2steper has joined #ruby-lang
publicvoid_ has joined #ruby-lang
WiiW has joined #ruby-lang
<rue> cirwin: It's a result of pointer subtraction, so it needs to be big enough to accommodate the largest possible pointer for the platform
<cirwin> rue: yeah
<cirwin> it warns me about substracting void * pointers too
<cirwin> is there an abstract function pointer?
<cirwin> (void)(*)(void) I guess
thrcka has joined #ruby-lang
<rue> Correct
Indian has joined #ruby-lang
RORgasm has joined #ruby-lang
burgestrand has joined #ruby-lang
<WiiW> file.c(9) : error C2065: 'INVALID_FILE_ATTRIBUTES' : undeclared identifier
<WiiW> NMAKE : fatal error U1077: 'cl' : return code '0x2'
<WiiW> on winxp , git clone git://github ' s ruby
Zolrath has joined #ruby-lang
andkerosine has joined #ruby-lang
JohnBat26 has joined #ruby-lang
uniqanomaly_ has joined #ruby-lang
<WiiW> #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)  
senthil has joined #ruby-lang
ridders24 has joined #ruby-lang
srbartlett has joined #ruby-lang
<WiiW> compiling ./../gc.c
<WiiW> gc.c
<WiiW> ./../gc.c(1099) : warning C4047: '=' : 'void *' differs in levels of indirection from 'i
<WiiW> nt '
andkerosine has quit [#ruby-lang]
d3vic3 has joined #ruby-lang
Fullmoon has joined #ruby-lang
Indian has joined #ruby-lang
sandbags has joined #ruby-lang
bjensen has joined #ruby-lang
rushed has joined #ruby-lang
mikeric has joined #ruby-lang
kain has joined #ruby-lang
vesan has joined #ruby-lang
benanne has joined #ruby-lang
Indian has joined #ruby-lang
dous has joined #ruby-lang
hackeron has joined #ruby-lang
srbartle_ has joined #ruby-lang
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
RORgasm has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
bjensen_ has joined #ruby-lang
francisfish has joined #ruby-lang
ridders24 has joined #ruby-lang
apeiros_ has joined #ruby-lang
baniseterfiend` has joined #ruby-lang
ridders24 has joined #ruby-lang
dragonkh has joined #ruby-lang
<dragonkh> hi
<dragonkh> anyone around?
<baniseterfiend`> dragonkh: yep
<dragonkh> cool !!
<dragonkh> I'm having a small rack issue - file_server = Rack::File.new(path_to_root_dir) <--- when I do file_server.call(env) I get a file not found - how can I get Rack to show my file - my_file.html which is in that directory? and also be able to link to another file my_file2.html from my_file.html ?
FiXato has joined #ruby-lang
uniqanomaly has joined #ruby-lang
dhoss has joined #ruby-lang
<rue> Permissions?
fgomez has joined #ruby-lang
kiddorails has joined #ruby-lang
mrsrikanth has joined #ruby-lang
retro|cz has joined #ruby-lang
retro|cz has joined #ruby-lang
datanoise has joined #ruby-lang
vesan has joined #ruby-lang
vesan_ has joined #ruby-lang
takaokouji has joined #ruby-lang
Jade- has joined #ruby-lang
Jade- has joined #ruby-lang
irmbrady has joined #ruby-lang
Faris has joined #ruby-lang
dr0id has joined #ruby-lang
mikeric has joined #ruby-lang
bjensen has joined #ruby-lang
elalande has joined #ruby-lang
irmbrady has joined #ruby-lang
d3vic3 has joined #ruby-lang
ridders24 has joined #ruby-lang
m3nd3s has joined #ruby-lang
codewrangler has joined #ruby-lang
futurechimp has joined #ruby-lang
indeterminate has joined #ruby-lang
dagelf has joined #ruby-lang
uniqanomaly has joined #ruby-lang
RORgasm has joined #ruby-lang
vesan has joined #ruby-lang
Nasha has joined #ruby-lang
<Nasha> Hi all, i require some assistance writing a "sleep timer" for my HTPC, that i can increment with a remote keypress, and it will execute a script when the timer reaches 0. Can anyone help?
<rue> What've you got so far?
<Nasha> An idea :) I've merely played around with ruby, and gained an interest, so i thought i would come here and see if someone could help me with my problem, and at the same time further my knowledge of the langugae
virunga has joined #ruby-lang
vesan_ has joined #ruby-lang
Sailias has joined #ruby-lang
esad has joined #ruby-lang
thone_ has joined #ruby-lang
<ridders24> Hey guys, why does output.txt not contain any data once the script is finished? http://pastie.org/3750114
kvirani has joined #ruby-lang
<shevy> perhaps because output is an array
<shevy> tried output.join("\n") yet?
<shevy> hmmm also
<shevy> are you sure that output is not nil?
<robgleeson|mba> puts also returns nil :p
<shevy> ridders24, do a puts output or puts output.class, or even better ... require 'pp' then pp output, before you call to File.open
<shevy> I suppose output is nil
<ridders24> why would output be nil?
<robgleeson|mba> you can return nil from find.
<shevy> who knows, it is your code man
<shevy> I am just trying to help find errors
<robgleeson|mba> -can
<bnagy> ridders24: what are you trying to do? Find .txt files? That's a hideous way of doing it
<ridders24> the script gives me the data i want in console but doesnt output that data into the txt file
<shevy> the code you used to write into a file would work correctly. so something is wrong with the variable output. it is logical.
<bnagy> just use globbing
<ridders24> bnagy: i was using glob but mistym suggested to use find.find as i have more to add to the script regarding an expression I will be looking for
hexo has joined #ruby-lang
<robgleeson|mba> ridders24: check the documentation for Find.find(…), it doesn't return anything worthwhile.
<shevy> fixed the script yet? ;)
<robgleeson|mba> it always returns 'nil'.
<robgleeson|mba> if you want to use find you might want to keep a open File object around, and insert when you find something.
<robgleeson|mba> then close.
<bnagy> anyway, it's broken because you aren't saving your find stuff, you're just doing pts in the block
<bnagy> open the file handle, then do f.puts path ... inside your Find block
<robgleeson|mba> bnagy: did you see what I wrote? lol
<bnagy> no, I can't read or write
<robgleeson|mba> you repeated everything I said before you, seems kinda redundant but ok :p
<bnagy> yeah but more clearly :)
<ridders24> could you give an example so i know what you mean, sorry really struggling with that...
<robgleeson|mba> you forgot to tell him to close bnagy, tut tut!
<robgleeson|mba> j/k
<bnagy> yeah in a 4 line script I think we can skip close :>
<bnagy> ok, not clearly enough, it seems
<bnagy> f=File.open('output.txt','w');Find.find("C:/") {||p| f.puts p if File.extname( p )=='.txt'}
<robgleeson|mba> or that ^, handles closure for you.
<robgleeson|mba> (which you really do btw, throw-away script or not)
* bnagy rolls eyes
<ridders24> thanks guys
<robgleeson|mba> welcome!
* shevy rolls bnagy
<robgleeson|mba> bnagy: stop teaching crappy programming!
* shevy rolls robgleeson|mba onto bnagy and watches what happens next
<shevy> ridders24 does it work finally? :P
<robgleeson|mba> it doesn't matter if a finalizer does it for you or not, good practice is to close when you don't need it no more, and who knows the larger context he is writing this in.
<bnagy> 2 line scripts aren't programming.. wait 3 lines because of the random use of Find
<ridders24> shevy: does testing it now
<erikh> moo
<bnagy> anyway, the broken code already had the close, so I don't think I'm leading them astray with my evil 'files get closed on exit' ways
<ridders24> shevy: it works :)
<ridders24> sorry im really slow with this guys
<shevy> finally!
<ridders24> thanks for the help
<shevy> one problem solved, one hundred more to go!
<erikh> yeah but then things like File.open('foo', 'w') << text don't work
<Nasha> Anyone want to give me 10min of their Ruby brain time, and write a script for me for $$'s?
<shevy> the script to replace RoR!!!
<bnagy> in 10 minutes?
<Nasha> In 10minutes, thats a big ask!
<bnagy> I guess 'A' << 'A'*10000 while true simulates the performance
seanstickle has joined #ruby-lang
<shevy> 10 minutes, man
<shevy> that's like half a beer I drink in that time
<erikh> $2000
<robgleeson|mba> per minute.
kish has joined #ruby-lang
nif has joined #ruby-lang
bawerd has joined #ruby-lang
Jade- has joined #ruby-lang
Teddy2steper has joined #ruby-lang
<bawerd> anyone tried to build ruby 1.9.3-p125 on smartos (opensolaris derived) ?
<bawerd> I get this when doing 'make test': http://pastie.org/3750306
<Nasha> No realistic offers? lol
<ridders24> how do i link "line" and "path" with the txt extention together so that output gives the result of the two combined? http://pastie.org/3750114
<ridders24> I assumed i need to do a "then"? wasnt sure how I would continue it otherwise
<shevy> Nasha I guess in 100% of these situations it is significantly more work than ... 10 minutes
<Nasha> Ok :/ Let me describe the solution i require:
<Nasha> Imagine your TV at home, i need to replicate it's sleep timer on my HTPC
<burgestrand> 10 minutes is half the time it takes to understand what you really want
<Nasha> Is further understanding required as per my requirements above?
<shevy> I dont think you need further explanation
<shevy> in theory the requirement you explained would be one class, and threads and probably sleep. but I am sure it cant be that easy.
andrewhl has joined #ruby-lang
wallerdev has joined #ruby-lang
mistym has joined #ruby-lang
<Nasha> shevy: ok, thanks anyway
Sailias has joined #ruby-lang
<andrewvos> Happy Easter ruby-lang
jbird has joined #ruby-lang
jbird has quit [#ruby-lang]
j-bird has joined #ruby-lang
j-bird has quit [#ruby-lang]
jlaster has joined #ruby-lang
<bnagy> I'm greek orthodox, you insensitive clod!
<jlaster> Is there an easy way to see an object's klass?
<andrewvos> jlaster: object.class
<andrewvos> jlaster: Also, I think you mean "class"
<jlaster> class skips over eigenclasses
<jlaster> nope :) this is purely theoretical
<andrewvos> jlaster: Ok well I don't know anything then.
<andrewvos> (not being sarcastic either)
<jlaster> no worries
wallerdev has joined #ruby-lang
gnufied has joined #ruby-lang
RORgasm has joined #ruby-lang
<bnagy> weird
<bnagy> I mean you can always get it from inside, like class << 'foo'; p self; end
<bnagy> but I can't seem to find a way to keep a reference to it
<matled> bnagy: foo = class << obj; self; end?
<chris2> apeiros_: ping
<jlaster> hmm true: class Object; def klass self; end; end;
<bnagy> matled: ha. I thought I tried that and it didn't work, but I must have usedstupid syntax
<bnagy> ahh yeah, forget to evaluate self in the metaclass context
InfiniteJest has joined #ruby-lang
<jlaster> hmm
gouthamvel has joined #ruby-lang
<jlaster> class Object; def singleton; class << self; self; end; end; end; will return an element's singleton
<jlaster> but if the object doesnt already have a singleton, then I want to go directly to the class
future_chimp has joined #ruby-lang
<yxhuvud> sounds a bit heisenbergy.
savage- has joined #ruby-lang
<ridders24> how do i link "line" and "path" with the txt extention together so that output gives the result of the two combined? http://pastie.org/3750114
<jlaster> is there any way to introspect on the fields of a ruby object? (klass, iv_table, flags, m_table)
<dragonkh> hell
<dragonkh> o
<dragonkh> I'm having a small rack issue - file_server = Rack::File.new(path_to_root_dir) <--- when I do file_server.call(env) I get a file not found - how can I get Rack to show my file - my_file.html which is in that directory? and also be able to link to another file my_file2.html from my_file.html ?
datanoise has joined #ruby-lang
dous_ has joined #ruby-lang
mistym has joined #ruby-lang
<ridders24> hi mistym
<mistym> Morning ridders24
<dragonkh> anyone good with Rack ?
rippa has joined #ruby-lang
thrcka has joined #ruby-lang
apeiros_ has joined #ruby-lang
<apeiros_> chris2: pong
<dragonkh> chris2 - he wrote rack didn't he
<ridders24> mistym: http://pastie.org/3750114 I don't know how to link line with path to get the output i need
<apeiros_> dragonkh: yes
io_syl has joined #ruby-lang
io_syl has joined #ruby-lang
<dragonkh> I remember when he wrote it - we met in a pub in Germany - I didn't realise he was only about 15 at the time
<dragonkh> or some young age like that
<dragonkh> damn time flies so fast and the older I get the more technology changes and advances
<dragonkh> um reading that back - it sounds a bit dody !! crap - it was nothing like that !
<apeiros_> dragonkh: you're plenking
<dragonkh> whats plenking?
<shevy> isn't that when you lie on a table?
<apeiros_> putting whitespace in front of punctuation
<apeiros_> shevy: no, that's planking
<dragonkh> what white space?
<dragonkh> well I do at least know what planking is !!
<shevy> you killed the white space!
<shevy> ah it is back again
uniqanomaly has joined #ruby-lang
<mistym> ridders24: What are you trying to do with the lines?
<apeiros_> that space in front of your !'s
<dragonkh> whats wrong with space in front of the !!! ?
<apeiros_> it's wrong
<apeiros_> in almost every western language
<apeiros_> (though, e.g. the french use a 1/4th space if they want to do it typographically correct)
<dragonkh> well it's as wrong as txt/lol speek or 3l1t3 then !
ridders24 has joined #ruby-lang
<apeiros_> *shrug* your decision. it makes you look just as stupid
loh has joined #ruby-lang
<ridders24> mistym: sorry got disconnected
<mistym> ridders24: No worries, did you see the last message I sent?
<dragonkh> apeiros_ are you saying my use of white space before punctuation negatively impacts the content of my sentence so much that it makes me look stupid ?
<ridders24> mistym: I need the expression found on each line to be searched for in the path and end with a txt extention. So output should contain a list of files / filepaths that match the expression
<chris2> apeiros_: how long do you stay in amsterdam?
<corsican> maybe he's practicing for writing python
<corsican> (pointless whitespace everywhere)
<corsican> (zing)
<chris2> dragonkh: i remember well
<dragonkh> hey chris2
<chris2> hey
<dragonkh> hehe
<robgleeson|mba> except in python it has a lot of importance :P
<corsican> no I know :)
<chris2> all whitespace is pointless :P
<robgleeson|mba> iknowright
<dragonkh> chris2 - I'm trying to hack some code which isn't mine and I am fishing in the dark - maybe you can help with my issue?
<dragonkh> I'm having a small rack issue - file_server = Rack::File.new(path_to_root_dir) <--- when I do file_server.call(env) I get a file not found - how can I get Rack to show my file - my_file.html which is in that directory? and also be able to link to another file my_file2.html from my_file.html ?
<chris2> Frank Harary and Ronald Read wrote a 1974 paper entitled "Is the null graph a pointless concept?"
<apeiros_> chris2: 5 days
<chris2> dragonkh: it should log which file was not found
<chris2> apeiros_: so you leave monday?
<apeiros_> dragonkh: yes, I do. also computers fail at wrapping your punctuation properly.
<apeiros_> chris2: yes, monday evening
<chris2> ok, me too
<apeiros_> cool
mikeric has joined #ruby-lang
<chris2> i'll need to find a place to crash sunday evening
<robgleeson|mba> what's happening in amsterdam?
<chris2> euruko2012.org
<robgleeson|mba> ah, right, so soon :D
<yxhuvud> chris2: sometimes, whitespace is simply wrong. Like in % foo .to_s
<chris2> yxhuvud: hehe
<dragonkh> ooo haven't been to euruko since 2009
<chris2> dragonkh: not sure if there still are tickets
<dragonkh> but I did go 2001 --> 2009
<dragonkh> I can't make it at the moment
<robgleeson|mba> chris2: are you speaking or any other notable speakers?
JohnBat26 has joined #ruby-lang
<chris2> robgleeson|mba: i dont, but the program is not up yet i think
<apeiros_> I replaced railsconf by railsberry & euruko this year. stupid TSA and travel regulations.
<chris2> hehe
<ridders24> mistym: you know what i mean?
<chris2> ok, i'm booking
<andrewvos> Hey does anyone else here map C-S in command-t to something else? You know, the command to open in a horizontal split.
<dragonkh> I'm a bit dissapointed with ruby jobs at the moment - I waited 10 years so far for ruby to become mainstream enough to take a job where I can use it everyday - but even now its way more popular - I can earn 3 times the day rate doing java - one day maybe..... sigh
<mistym> ridders24: OK, so it needs to match your expression and match .txt?
<chris2> wait
<chris2> shit
<ridders24> mistym: yh
toretore has joined #ruby-lang
<chris2> the boat party is thu
<dragonkh> apeiros_ have you seen the second definition of plenk hahah !! http://www.urbandictionary.com/define.php?term=plenk <-- ooer
<dragonkh> oops I mean hahah!!!!
<dragonkh> apeiros_ are you German?
<apeiros_> ss
<apeiros_> swiss
<dragonkh> cool - have we met?
lsegal has joined #ruby-lang
<dragonkh> apeiros_ for some reason I think you have a beard
<robgleeson|mba> andrewvos: <leader>f = file browser, <leader>b = buffer browser for me.
sandbags has joined #ruby-lang
<mistym> ridders24: Can you give me some examples of file patterns in that .txt it should be matching?
<ridders24> mistym: yh sure. One colum will contain say 1234, then next to it in another colum it could contain 1234-11-ABC-1-2 or just ABC-1-2
<ridders24> mistym: or 4567 then FD-01
mikeric has joined #ruby-lang
<apeiros_> dragonkh: I don't htink we've met. and no, even if I'd let it grow, it'd take aeons for me to get an actual bear :(
<mistym> ridders24: So are you looking for a file named, e.g., ABC-1-2.txt?
<ridders24> mistym: yh. or the file could be 1234-1-2.txt. However if the file is just ABC-1-2 it needs to make sure its contained in a dir that is say 1234, so the first colum
<dragonkh> apeiros_ ah ok - well maybe we will meet one day at a conference - I have had my head down earning the cash for the last 7 years - but I'm finally freeing up some time to attend / speak at more conferences and workshops this year onwards - and I plan on meeting lots of interesting people !
<ridders24> mistym: does that make sence?
<ridders24> mistym: the reason I say about the dir, is because there could be a file with the same name but under a different dir
jaimef has joined #ruby-lang
<apeiros_> dragonkh: sure, maybe
tomzx has joined #ruby-lang
* apeiros_ got guests, therefore off
kiddorails has joined #ruby-lang
Tukeke has joined #ruby-lang
<mistym> ridders24: OK. So, I'm not seeing you fetching columns yet. How are the columns delineated? Is it csv?
<ridders24> i havent, as I saved the spreadsheet as a txt, and the 1234 is the on the same line as the 1234-ABC-1-2. theres just divided by a space.
<ridders24> mistym: so it probably works out better that there on the same line?
<mistym> ridders24: OK. And I assume filenames and directories can't have spaces here ;)
<ridders24> yh, in theory they wont have spaces, it should only be a 4 digit number if its a dir and its a file then it could be spaced with "-" so ABC-12-3
<andrewvos> robgleeson|mba: hmm
<andrewvos> robgleeson|mba: Trying to map something that opens a horizontal split
<andrewvos> robgleeson|mba: Not sure how though
<mistym> OK! So, in that case, you can get the two columns by splitting the line, right?
Teddy2steper has joined #ruby-lang
kyrylo has joined #ruby-lang
<robgleeson|mba> andrewvos: map <leader>X :SomeFunction is the normal way.
<mistym> ridders24: As it happens, String has a method exactly for that. str.split(separator)
Tukeke has quit ["Hackers and Proletarians of the World! Unite!"]
<andrewvos> robgleeson|mba: There doesn't seem to be a function for it though
<robgleeson|mba> andrewvos: what keys do you use to do it?
<andrewvos> robgleeson|mba: Trying this but no luck. let g:CommandTAcceptSelectionSplitMap="D-v"
<ridders24> mistym: ok so what does that mean?
<andrewvos> robgleeson|mba: Well, C-s is mapped to open a split, but doesn't work in my terminal because c-s is for something else.
<andrewvos> Flow control or whatever
<mistym> ridders24: It splits the string using the separator you specify, returning an array of the entries between splits.
<mistym> ridders24: For example: "foo,bar".split(",") ==> ["foo","bar"]
morozovm has joined #ruby-lang
<ridders24> mistym: would it upset it, if say for example the 4 digit is 1234 and the file is 1234-ABC-1-2? would it still find the file? or would it look for 12341234-ABC-1-2
morozovm has quit [#ruby-lang]
<mistym> ridders24: Well, you're going to be treating the two columns separately from each other, right? That's why you're splitting the line.
<mistym> ridders24: Have you seen multiple assignment in Ruby yet?
<ridders24> mistym: I havent no. and yes we treating to two columns seperatly
<mistym> ridders24: Multiple assignment's a lovely bit of magic that lets you assign the values of multiple variables at the same time, when a method is returning multiple values
<mistym> For example:
ridders24 has joined #ruby-lang
<ridders24> mistym: sorry got disconnected again. Xchat is unhappy
<mistym> foo, bar = "foo,bar".split(",") ==> foo will equal "foo", bar will equal "bar"
<mistym> ridders24: No problem.
<mistym> ridders24: Multiple assignment's a lovely bit of magic that lets you assign the values of multiple variables at the same time, when a method is returning multiple values. I pasted an example just as you came back in
mssola has joined #ruby-lang
<ridders24> mistym: cheers :). How will it know to treat the two values seperate when there on the same line?
<robgleeson|mba> andrewvos: map <leader>x <C-s> ?
benanne has joined #ruby-lang
<mistym> ridders24: Well, you're going to be splitting the line so it turns into two values.
<ridders24> mistym: ok. Lets see if I can put this to practical use. So is any of the top part of my code any good? apart from the expression
<shevy> hehe
<shevy> mistym is the code qualifier :)
stanis has joined #ruby-lang
mattyoho has joined #ruby-lang
dous has joined #ruby-lang
Indian has joined #ruby-lang
taf2_ has joined #ruby-lang
<mistym> youngin: :D
<mistym> ridders24: A few questions from the top. Why are you using #each_with_index on your file?
<ridders24> mistym: was just the example I had that worked
jondot has joined #ruby-lang
<ridders24> mistym: should it be File.foreach(from_file).strip.each(' ')
fgomez has joined #ruby-lang
<mistym> ridders24: You only have one file here. Since you're trying to read lines, you probably want to use File.readlines(from_file)!
kiddorails1 has joined #ruby-lang
<mistym> File.readlines(from_file).each do |line|
<ridders24> mistym: then #line.strip.each(' ') ? actually maybe i dont need the #
<mistym> #each_with_index is a special form of each which adds a new variable to the loop, which gives you the number of the iteration. e.g. the first time the index will be 0, then 1, etc.
<mistym> If you're not using the index, you should just use each.
<mistym> ridders24: The hash symbol (#) just means that the method is an instance method. It's not Ruby syntax, just a convenient way to talk about method names.
<ridders24> mistym: oops sorry
<mistym> ridders24: Close! Rather than line.strip.each(" ") you want line.strip.split(" "). And you should make sure you assign the values of that to something.
<ridders24> mistym: you mean like strip = line.strip.split(" ")
<ridders24> mistym: whats the difference between (' ') and (" ")?
<mistym> ridders24: Yes, if you want strip to equal an array. If you want separate values for the two items in it, you probably instead want something like column1, column2 = line.strip.split(" ")
elalande1 has joined #ruby-lang
<mistym> ridders24: In this case, nothing. The difference between '' and "" has to do with the treatment of certain special characters in strings.
<ridders24> mistym: oo i didnt know you could give more than one value to somthing
<mistym> ridders24: An array is a set of multiple values!
<mistym> Let's say that your line is 'foo bar'. If you do strip = 'foo bar'.strip.split(" "), then strip will equal ["foo", "bar
<mistym> "]
<mistym> If you do column1, column2 = 'foo bar'.strip.split(" "), then column1 will equal "foo" and column2 will equal "bar"
Clordio has joined #ruby-lang
<ridders24> mistym: i know an array is multiply values but I didnt know you could assign it with more values, just used to doing a single value to represent it
Swimming_Bird has joined #ruby-lang
<mistym> ridders24: Multiple assignment will split up the array among the variable names you use! It's very handy.
<ridders24> mistym: yh thats great to know
<mistym> Oh man, it is so hard to work when the roomba is cleaning. Watching it is hypnotizing.
<ridders24> roomba?
<mistym> Robot vacuum cleaner.
<ridders24> thank god for google
<ridders24> mistym: line should now contain the split value, so i need to add line to the expression?
<mistym> ridders24: Mind updating the paste with what you have so far?
<ridders24> mistym: http://pastie.org/3750114 sorry about that
<mistym> ridders24: OK! So now you want to use your columns in the Find.find block, right?
<mistym> (ps - you might want to name the variables something that makes it clear what their purpose is. It's good habit so your code remains readable. For example, dirname and filename, or something like that.)
<ridders24> mistym: that makes sence
<bawerd> anyone in this channel that runs ruby on OpenSolaris/NetBSD/Illumos?
<mistym> ridders24: You still need to check that the line matches your naming pattern, right?
<ridders24> mistym: yh
<mistym> Are you familiar with "next" in blocks?
<ridders24> mistym: no is it similar to "then"
<mistym> ridders24: Nope! next is for use in blocks that are iterating over multiple values.
<ridders24> mistym: oh ok
<mistym> If "next" is sent, the block will skip any of the other commands in the block and start from the next iteration.
<mistym> For example: Find.find('/') {|file| next if file == "somefileidontwant.txt"; puts file}
<ridders24> mistym: ahh i see, so if it finds a match it puts it, then moves on
<mistym> ridders24: Opposite in this case! If it sees that the file matches the condition it will skip that file, then go on to the next.
<ridders24> mistym: becuase next is before the if statement?
<mistym> ridders24: Yeah.
<mistym> ridders24: Thought that would be helpful here, since you said you wanted to skip some lines in your input file - right?
<ridders24> mistym: i would like to skip any files that dont match the expression and values. so I have a list of files it locates
<mistym> ridders24: At any rate - it looks like you're close now. You just need to check your file in the Find.find block, right?
ericmuyser has joined #ruby-lang
<ridders24> mistym: how do you mean check it? i need to add the values of dirname and filename to find.find ? to allow it to search for those right?
<mistym> ridders24: Yes! You just need to check the file against those values.
<mistym> ridders24: File.dirname and File.basename will probably be helpful here.
stanis has joined #ruby-lang
takaokouji has joined #ruby-lang
<ridders24> mistym: what is file.dirname and file.basename?
<ridders24> mistym: or is dirname and basename my values?
toretore has joined #ruby-lang
<mistym> ridders24: Capital File! Those are methods in the standard Ruby library for querying the properties of files.
<mistym> File.dirname returns the name of the directory of a file. For example, File.dirname("/Volumes/foo/bar.txt") ==> "/Volumes/foo"
<ridders24> mistym: ok, and the other returns just the filename im guessing
<mistym> Exactly.
rolfb has joined #ruby-lang
<ridders24> mistym: so Filedirname.(dirname)
<mistym> File.dirname(file) will return the directory name of file.
imperator has joined #ruby-lang
<ridders24> mistym: so File.dirname.(filename) should find the dir of the value in from_file?
<ridders24> ignoring the . before (
<ridders24> File.dirname(filename) ?
<mistym> ridders24: Well, if you want it to be in your Find.find block, you probably want to apply it to the path variable you defined there, right?
<ridders24> mistym: yh
<mistym> And you have a value to compare against too, right?
cirwin has joined #ruby-lang
<ridders24> mistym: as in the file its looking for?
<mistym> ridders24: Well, if I'm understanding right, you obtained from the file a directory name you want to match, and a filename you want to match. Right?
<ridders24> mistym: thats right
<ridders24> mistym: I'll be back in a while, just getting dinner. Thanks for all the help so far :)
<mistym> ridders24: No problem :D
jarred has joined #ruby-lang
datanoise has joined #ruby-lang
rdeshpande has joined #ruby-lang
Sailias has joined #ruby-lang
mssola has joined #ruby-lang
srbaker has joined #ruby-lang
havenn has joined #ruby-lang
dous has joined #ruby-lang
Rizzle has joined #ruby-lang
loh has joined #ruby-lang
Rizzle has quit [#ruby-lang]
ViperMaul has joined #ruby-lang
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
Teddy2steper has joined #ruby-lang
jesly has joined #ruby-lang
<jesly> in eventmachine does the call to an external function via ffi happens in a non-blocking manner??
uniqanomaly has joined #ruby-lang
t has joined #ruby-lang
cirwin has joined #ruby-lang
<ridders24> mistym: im back
<mistym> ridders24: Welcome back!
<ridders24> mistym: ty
<ridders24> mistym: where were we?
burgestrand has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
<mistym> You tell me! Where are you, what sticking points are there still?
frangiz has joined #ruby-lang
<ridders24> mistym: I need to check the values against the file and then search for those values
<tobiasvl> ridders24: and where are you stuck? :)
Tearan has joined #ruby-lang
<ridders24> mistym: http://pastie.org/3750114
<ridders24> im was trying to get my head round File.dirname and File.basename
<tobiasvl> (psst, i think you're missing an "end" after the first block there)
<ridders24> oops
<ridders24> try that :p
francisfish has joined #ruby-lang
<imperator> /usr/local/bin/ruby => dirname is '/usr/local/bin', basename is 'ruby'
ridders24 has joined #ruby-lang
<mistym> ridders24: I think you put the end in the wrong place ;)
<ridders24> mistym: sorry once again i got disconnected.... i put end in the wrong place? should it be under the other end?
<mistym> ridders24: Well, think about it logically - end signals the end of a block. So, it's the end of where that iterating section of code is. Do you want to end the File.readlines(foo).each block there? Is there a reason that's not a good idea?
<ridders24> mistym: well it wont continue to the next block, so it needs to go under the other end XD
<mistym> Yes, exactly!
jxie has joined #ruby-lang
Fullmoon_ has joined #ruby-lang
<ridders24> mistym: we were talking about File.dirname(filename) early. I wasnt sure what i needed to do with it
<mistym> ridders24: File.dirname(filename) will tell you what the dirname of a filename is. Now, you already have something you know you want, right? So how about comparing them?
m3nd3s has joined #ruby-lang
<whitequark> is it impolite to put expletives in your code?
<whitequark> say, if you're writing a wrapper to work around a REALLY BRAINDEAD external something
<shevy> sounds as if you need beer
<whitequark> just when you know that you've finally found THE worst example of human stupidity
<whitequark> well
<whitequark> I'm writing a decompiler for Flash ActionScript 3 bytecode
<mistym> whitequark: Depends on where you work ;)
<whitequark> THEY HAVE OPCODES FOR XML.
<shevy> I'd put the expletives still in ways that they are ok to read for others
<whitequark> I repeat
<whitequark> OPCODES. FOR. XML.
<shevy> "What a really stupid solution here."
<mistym> whitequark: "Adobe"
<shevy> "Did I already say that I hate XML?"
<ridders24> mistym: path being the other thing i want to compare?
<whitequark> and they have a spec which is wrong on numerous times
<whitequark> blargh
<mistym> ridders24: You saved your own dirname variable before, right?
<whitequark> they can't tell the difference between int8 and uint8 in their own code
<whitequark> and I already found a significant number of bugs in the compiler
* whitequark ragequits
<ridders24> mistym: ohhhhhh the var dirname
<mistym> File.dirname the file method, and dirname, your variable
<whitequark> mistym: oh, you're suggesting to use "Adobe" as an expletive
<whitequark> "this is a very adobe compiler"
<mistym> whitequark: lol
<mistym> Not what I intended but appopriate.
<mistym> I say we make "Adobe" a new expletive.
<whitequark> "go away and adobe yourself several times with an adobe adobe"
<shevy> mistym what do you do when you have code that is just terrible
<mistym> shevy: That's when I go and get a coffee and hope it goes away
zetradr has joined #ruby-lang
<mistym> ridders24: I probably confused things by suggesting you name a variable "dirname", since that's also a class method from File. You can rename the variable if that helps clarify things.
<ridders24> mistym: yh i may go back to column 1 and 2
<mistym> ridders24: Whatever's most readable. The important thing with variable names is that it should be clear what the variables hold and what they're for from how you name and use them!
<ridders24> mistym: File.dirname(column2)
robbyoconnor has joined #ruby-lang
<mistym> ridders24: No, column2 is already your filename, right?
<mistym> And file 1 is the directory name the file you're looking for should be in.
<ridders24> mistym: yh, i thought i was checking what dir it was in?
<ridders24> mistym: or am i checking if the dir exists?
Teddy2steper has joined #ruby-lang
<mistym> ridders24: Well, what are you doing with the columns? What are the files you're looking for and what are the conditions for when you keep them?
<ridders24> mistym: the file name could be 1234-abc-1-2 which is fine as the filename identifies where it is. but the file could be just abc-1-2, and so the second column would confirm where it is as it would say 1234
<mistym> ridders24: Is the first column the filename, and the second the directory?
<ridders24> mistym: other way roud
<ridders24> round
<mistym> ridders24: OK.
surfprimal has joined #ruby-lang
<mistym> So let's think of this in terms of tasks. You have the columns that give you informations on files, and in the Find.find block you have a set of arbitrary files that may or may not be how you're looking for.
<mistym> What do you need to do to the arbitrary file (let's call it "path") to figure out if it's the one you want?
<ridders24> mistym: ok
<ridders24> mistym: i need path to match column1 and column2 and /\.txt$/ that in theory would be an exact match
z3r00ld has joined #ruby-lang
z3r00ld has quit [#ruby-lang]
senthil has joined #ruby-lang
<mistym> ridders24: So this is where the File class methods come into handy. They let you look at the properties of a file.
<ridders24> mistym: Okay
<ridders24> mistym: do i need to do File.basename(column2) as well?
<mistym> ridders24: column2 is already a filename, right? File.basename returns the filename of a file, given a string that could contain both the directory and filename together.
RORgasm has joined #ruby-lang
<ridders24> mistym: not sure i need that then as if the filename contains the dir i dont need to worry about there being more that 1 file with the same name
<ridders24> so its just the file.dirname i need to be interested in i guess
<ridders24> mistym: do i need to give File.dirname(column1) a value, so that i can call it in find.find ?
<mistym> ridders24: column1 is already a directory name! You don't need to use File.dirname on it, right?
<ridders24> mistym: yh but i wasnt sure what I was ment to do with File.dirname then
<mistym> ridders24: It's the path in Find.find whose properties you need to check.
<mistym> Because you want to know what directory is's in, right?
<ridders24> mistym: yh
<ridders24> Filename.dirname(path)
<mistym> Right. So you need to do a comparison with the result of that, right?
<ridders24> mistym: path needs to include column1 and column2 with the .txt extenion to search for
<mistym> ridders24: Right. So File.dirname(path) should match column1; File.basename(path) should match column2; and the path should have a .txt extension. Something like that?
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
<ridders24> mistym: yh that sounds right
<mistym> Little trick, by the way - if you want to get a string for a filename without its extension, do this: File.basename(path, File.extname(path))
<ridders24> does * represent any filename? so (path, *txt(path))
<ridders24> (path, *.txt(path))
rdeshpande has joined #ruby-lang
RomyRomy has joined #ruby-lang
<mistym> ridders24: What do you mean? In terms of the File.basename code I was mentioning?
<ridders24> mistym: yh
<mistym> ridders24: Don't worry about specifying an extension. File.extname(path) returns whatever the extension is.
<mistym> The optional second argument to File.basename just returns the filename minus that extension. So File.basename("f:\foo.txt",".txt") will return "foo".
<mistym> File.extname("foo.txt") returns ".txt"
<ridders24> as much as i trust the script it doesnt harm to see the extention lol
<ridders24> for my own sake
<mistym> ridders24: Right, but if you're comparing filenames and one has the extension and the other doesn't, then they won't be equal. You're trying to find out if they're the same!
<ridders24> oh i see, so even though from_file contains just the filenames and no extentions, but path contains both, File.basename will ignore them as from_file doesnt contain the extention?
elalande has joined #ruby-lang
<mistym> File.basename just returns a string. It doesn't do a comparison.
<mistym> You can compare, e.g., str1 == str2
<mistym> And if str1 is "foo" and str2 is "foo.txt", then it will return false for "foo" == "foo.txt"
<mistym> That's why you want to try to chomp off the extension before comparing!
nif has joined #ruby-lang
ryanf has joined #ruby-lang
<shevy> mistym.chomp!.chomp!.chomp!.chomp!.chomp!.chomp!
<mistym> ==> ":9"
<ridders24> mistym: why is path an unknown var in line 11 when its in line 10?
<ryanf> it's only defined inside the block
<mistym> Yeah, you want to do those checks inside the block.
<ryanf> in the same way that a parameter of a method is only defined inside the method
<ridders24> grrr block!
<mistym> Those methods are invited to the &block party.
<mistym> You don't want them to show up at like 6am when everyone's gone home, do you?
<ridders24> its how i feel about now though lol
<mistym> Are you still confused? Maybe I can clarify.
<ridders24> mistym: i dont know how to run them inside the block
ridders24 has joined #ruby-lang
<ridders24> mistym: back
<mistym> ridders24: Right now Find.find is using the single-line block syntax, whereas you're using the multiline syntax for File.open. So just switch Find.find over to the other syntax, and move those lines in!
voker57_ has joined #ruby-lang
<ridders24> mistym: what other syntax
<mistym> ridders24: Find.find {|path| ...} vs Find.find do |path| ...other lines here... end
srbaker has joined #ruby-lang
frangiz_ has joined #ruby-lang
<tobiasvl> (that's just a coding practice though. no biggie really)
<ridders24> thanks mistym: i didnt know that about the single and multi
<mistym> tobiasvl: Yes, but it's good to start out with orthodox style ;)
<tobiasvl> hehe, sure
<tobiasvl> just make sure you don't add extra snags ;)
<ridders24> the script didnt like f.close so i got rid of it for now and the script it running but seems to just be sitting there and not doing anything
<ridders24> oh hang on
<ridders24> helps if i give it the right drive letter to look at
<ridders24> i think the script works
<mistym> ridders24: f.close isn't necessary since you're using the block form File.open, which autocloses the file when the block completes.
<mistym> (Blocks, much like friendship, are magic.)
<ridders24> mistym: the script puts in output.txt just the filenames. I need the path of where there located too
<ridders24> like what find.find does
<mistym> ridders24: Can you update the script on pastie?
<ridders24> done
<mistym> ridders24: You're not actually comparing anything against the File.dirname and File.basename calls - they're not doing anything.
<mistym> You're doing the f.puts path just after that one single check vs the extension, and not checking what directory it's in, or anything else.
zetradr has joined #ruby-lang
<ridders24> so i need to move the f.puts
frangiz has joined #ruby-lang
<mistym> ridders24: Well, you want to rewrite your if statement.
<mistym> Your if statement should have three conditions.
<ridders24> was just looking at that
<ridders24> Find.find("F:/") do |path| if path =~ /\.txt$/
<mistym> You can add extra conditions onto an if statement by using the && command.
<mistym> For example, if ruby == :awesome && channel == '#ruby-lang'
<tobiasvl> (or just "and")
<ridders24> Find.find("F:/") do |path| if path == column1 && column2 =~ /\.txt$/
<mistym> ridders24: Do you want to compare column2? That comes from your input file, it's not a property of path.
<mistym> tobiasvl: Be careful with that, actually. && and 'and' have different priorities from each other.
<tobiasvl> yep, i am aware
<ridders24> oh i see becuase column2 is just the file name
<tobiasvl> (but as long as ridders24 doesn't even know about either of them, i'd think just teaching the one that's closest to english is straight up)
<ridders24> what are the differences between && and and
nif has joined #ruby-lang
<burgestrand> ridders24: preceedence, or priority if you wish
francisfish has joined #ruby-lang
<mistym> ridders24: You probably want something like this:
<ridders24> Find.find("F:/") do |path| if path == column1 && =~ /\.txt$/ would that work?
<burgestrand> ridders24: http://codepad.org/oaLYEVB0
frangiz has joined #ruby-lang
<mistym> ridders24: Not quite.
<mistym> ridders24: if File.dirname(path) == column1 && File.basename(path,File.extname(path)) && path =~ /\.txt$/
<mistym> You have three conditions, remember! You need to check all of them.
nif has joined #ruby-lang
surfprimal has joined #ruby-lang
jtoy has joined #ruby-lang
<jtoy> is there a safe way to do FileUtils.mv if the file doesn't exist? or is rescue my only option?
t has joined #ruby-lang
<mistym> jtoy: Shouldn't you check if the file exists before you try to move it?
<jtoy> the file is there sometimes, but gets moved before the operation runs, and it errors out because it can't find the file
<jtoy> mistym: yeah, i do
<tobiasvl> race conditions?
<jtoy> tobiasvl: yeah, although I'm not sure why
frangiz_ has joined #ruby-lang
<ridders24> mistym: do i still need line 11 and 12 if there in line 10 now?
<mistym> ridders24: No.
chimkan has joined #ruby-lang
shachaf has quit [#ruby-lang]
bjensen has joined #ruby-lang
tbuehlmann has joined #ruby-lang
ridders24 has joined #ruby-lang
wallerdev has joined #ruby-lang
frangiz has joined #ruby-lang
<ridders24> mistym: i dont understand why after the changes made to find.find, why f.puts path doesnt do anything
<mistym> ridders24: Can you update your paste again?
<ridders24> mistym: http://pastie.org/3750114
Teddy2steper has joined #ruby-lang
<mistym> ridders24: You're not comparing File.basename(etc) to anything, I noticed.
Clordio has joined #ruby-lang
<ridders24> File.basename(path,File.extname(path)) == column2 ?
<mistym> Yep.
<ridders24> have i missed anything else?
ryanf has joined #ruby-lang
nif has joined #ruby-lang
_inc has joined #ruby-lang
Fullmoon has joined #ruby-lang
<ridders24> mistym: that still doesnt tell me where the file is located
frangiz_ has joined #ruby-lang
<mistym> ridders24: I haven't used Find.find on Windows, but it should definitely have the path in the name.
<mistym> ridders24: Is the problem that f.puts path isn't doing anything, or that the list of names you're getting doesn't have the directory?
<ridders24> oh hang on, I might see the problem
cirwin1 has joined #ruby-lang
gnufied has joined #ruby-lang
<ridders24> fixed the issue with the input file, however nothing gets put into the output.txt
mattyoho has joined #ruby-lang
<ridders24> mistym: i know find.find works on windows as it did a great job of showing the full file path earlyer when i had just that block. so its down to the f.puts path perhaps?
Tukeke has joined #ruby-lang
RORgasm has joined #ruby-lang
Tukeke has quit [#ruby-lang]
frangiz has joined #ruby-lang
<ridders24> mistym: why is path not returning anything?
frangiz_ has joined #ruby-lang
postmodern has joined #ruby-lang
ridders24 has joined #ruby-lang
<shevy> ridders24, where do you define "path"
<shevy> I think the problem is that you are writing in a black box without feedback to you
<shevy> you should use debug prints until the script works
<shevy> puts f, puts path etc...
<shevy> or as I told you even better, pp f, pp path
<shevy> and include that output into the script you use at pastie
<mistym> ridders24: Ah, I think I know what's going on here. I bet your files are in directories more than one level deep, right?
<mistym> f:\foo\1234\bar.txt
<mistym> And you're checking with your column1=1234
<ridders24> mistym: yh its a mixture of F:\DATA\1234\1234-11\1234-11-abc-1-1.txt
<ridders24> mistym: or could be F:\DATA\1234\ABC-1-2
<ridders24> mistym: it will vary
<mistym> given the first case, what are column1 and column2?
<ridders24> column1 would be the folder "1234" and column2 would be the filename"abc-1-2"
<mistym> What about the other one?
<ridders24> mistym: same
<mistym> column1 would be "1234-11" and column2 would be "1234-11-abc-1-1.txt"
<mistym> ?
<mistym> Or rather that minus the .txt?
frangiz has joined #ruby-lang
<ridders24> column1 would just be four digits so "1234"
<mistym> Even though that's not the directory name?
<ridders24> well its part of the path to get to "1234-11-abc-1-2"
<mistym> Right, but it's not all of the path! That changes things, since you can't just take a look at the immediate directory `path` is in and see whether it exactly matches column1
<ridders24> mistym: sorry i thought it matched the path
savage- has joined #ruby-lang
frangiz_ has joined #ruby-lang
<ridders24> mistym: not all the folders are like that though, so shouldnt i still have had some results back?
<ridders24> mistym: or is it becuase they all start f:\DATA?
<mistym> ridders24: Yeah, since there's more than one directory - so File.dirname is returning something like "DATA\1234-11". And that, of course, doesn't equal "1234-11".
<ridders24> mistym: what if i did Find.find("F:/DATA/") do |path|
<ridders24> mistym: although i still wont get all results
<mistym> That will help, but of course some of them are still more than one level deep.
<mistym> If you don't care about getting some potential spurious results, you could do File.dirname(path).include? column1
<mistym> include? checks to see whether a string is contained somewhere in another one.
<mistym> For instance, 'foobar'.include?('foo') returns true.
<ridders24> mistym: i changed F: to F:/DATA, to see if i got any results. however nothing is in output.txt
gregf has joined #ruby-lang
<mistym> ridders24: Try using File.dirname(path).include? column1 instead of == column1
workmad3 has joined #ruby-lang
<ridders24> mistym: i get an error of cant convert false to string
<any-key> false.to_s works
<ridders24> still get the error
<mistym> Probably a priority thing - try File.dirname(path).include?(column1)
cirwin has joined #ruby-lang
ridders24 has joined #ruby-lang
retro_ has joined #ruby-lang
<ridders24> mistym: that worked but only returned: F:/DATA/6603/Bulk Floppies/FD-09.txt
<mistym> OK, so that's a start. Let's take a look at some of the other ones that should have worked, and figure out why.
<mistym> Floppies?
<ridders24> mistym: what about it
<workmad3> ridders24: doesn't .find only ever return 1 item, if you want all matches don't you want .find_all ?
<mistym> workmad3: No, Find.find is its own thing. It's not related to the typical enumerator find.
<workmad3> ah, didn't know about that one :)
Muz has joined #ruby-lang
<mistym> Find's a module for recursively examining files, it only has one class method and that's .find
<ridders24> mistym: did you want me to provide ones it should have found?
<burgestrand> mistym: and prune
<workmad3> looking at the Find docs now :)
<mistym> burgestrand: True. Since that's only used within a Find.find block I mentally filtered it out ;)
<burgestrand> :)
<mistym> ridders24: Yeah - both their full path (F:\DATA and all), and the data you have in column1 and column2
<erikh> hallo internets
<mistym> hallo erikh!
<erikh> last day of vacation. so bummed
<mistym> Awr :(
<ridders24> mistym: thats the input http://pastie.org/3752448
<mistym> ridders24: OK, that's good to know. Can you give me a few examples of smth that failed?
<ridders24> mistym: yh just getting those for you now
<ridders24> mistym: F:/DATA/1010/LKRL-24-2/LKRL-24-2.txt
<ridders24> mistym: F:/DATA/1207/1207-12-HR-7/1207-12-HR-7.txt
<mistym> The second one didn't work 'cause it's not in your spreadsheet output!
<ridders24> thats helpful
<ridders24> what about the other though
zetradr has joined #ruby-lang
andrewhl has joined #ruby-lang
<mistym> ridders24: scuse me a few minutes
<ridders24> mistym: ok
wallerdev has joined #ruby-lang
kvirani has joined #ruby-lang
jtbandes has joined #ruby-lang
ridders24 has joined #ruby-lang
<jtbandes> Perhaps I'm going insane, but....
<jtbandes> /1 (.+?) 1d/.match("1 2a 1 2b 1d")[1] # => "2a 1 2b"
<jtbandes> Shouldn't this return just "2b"?
<cirwin> not with that d in the regex
<burgestrand> jtbandes: the match is left to right, which is why that is happening
<burgestrand> jtbandes: it takes the first possible match, which is what you get
<jtbandes> I guess +? is non-greedy, but not non-greedy enough?
<jtbandes> What should I do to get the *smallest* match?
<burgestrand> jtbandes: it’s not the matching group that is the problem, it’s the first 1 as it matches in the start of the string
<burgestrand> only after that does the greedyness come in
<burgestrand> jtbandes: if your regex was only /1/ it would match the first one, same rule here
<jtbandes> I see. so if the string were "1 2a 1 2b 1d 2c 1d" then it might make a difference, but only on the right-hand side
<burgestrand> jtbandes: yes
<jtbandes> Alright
<jtbandes> insanity averted.
<jtbandes> Thanks!
Teddy2steper has joined #ruby-lang
<burgestrand> \o,
<shevy> man
<shevy> something is wrong with your arm
<injekt> looks a little limp
<shevy> yeah it's not matching the other one, I wanna cut off the raised arm
<injekt> .o,
<shevy> yeah
<shevy> next comes the head though :)
<shevy> but I dunno what char could fit
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
kvirani has joined #ruby-lang
<workmad3> <_> <-- a guy trying to find his missing head
ryanf has joined #ruby-lang
jxie has joined #ruby-lang
<shevy> lol
ridders24 has joined #ruby-lang
ridders24 has joined #ruby-lang
burgestrand has joined #ruby-lang
<mistym> ridders24: Sorry, had to get dinner cooking. :9
dous has joined #ruby-lang
jaisoares has quit [#ruby-lang]