#perl
08 November 2007
Total 27 pages. You are browsing page 1/27.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
--- Log opened Thu Nov 08 00:00:07 2007
--- Day changed Thu Nov 08 2007
00:00 <****> filter foo) $ hGetContents fh
00:00 <****> split doesn't make sense
00:00 <****> ah. (and yeah, I wasn't thinking about split, just dumbly sketching)
00:01 <****> bpalmer: or perl6 :)
00:18 <****>[0] ??
00:18 <****> okay say I have some media files.
00:18 <****> and I want to move the ones that are old to an 'old' directory
00:19 <****> but the only way to know they are old is to grep a date from a text file sitting in the media file's dir
00:19 <****> does perl have command to move directories, not jsut move files?
00:19 <****> prakriti: yes
00:19 <****> I did it in bash after much headache
00:19 <****> happy_guy2: on linux? sure!
00:20 <****> happy_guy2: huh? that's the same thing
00:21 <****> I have an old version of pathedit that I use for such tasks.
00:21 <****> by doing a find for all the files with the date, then for each one assigning the path to a variable; then grepping each one for the date assigning this to a variable, and grepping for a name in the same fiel with the date, (also put in a var), the echoing $var2 $var1 $var3 to get each date, fullpath, name on a line; then piped to sort -n, then dumped this into a file
00:22 <****> now I had all the directories by date, I used vi to slice off everything yesterday or older
00:22 <****> then I used cut and a loop to get all the direcftories contaiing the orig date file(this dir is the dir of the media file and its text descriptor files)
00:23 <****> I then looped a mv command to mvoe these to /opt/old
00:23 <****> happy_guy2: I suspect that you are working too hard to do this.
00:23 <****> core: File::Copy
00:23 <****> Khisanth: Added to perl core as of 5.002
00:23 <****> core File::Find
00:23 <****> cfedde: Added to perl core as of 5
00:23 <****> in the end it worked afte rI removed a few directories amrketing had named with sapces in them
00:24 <****> the ahrd part si that the date of the dir had nothing do do wth it being too old for us to be using the file
00:24 <****> the text file determined the end of the legal right to use that media
00:24 <****> thats why I had to sort by the date in the text file
00:24 <****> to pick out which media file dirs had to go
00:24 <****> :)
00:25 <****> so file:find and file::copy allow this kinda thing to be done?
00:25 <****> now which utility actually moves directories
00:25 <****> because it seems tcl only has a utility to move files, not directories
00:25 <****> mv
00:25 <****> or rename
00:25 <****> oh so you call mv from perl?
00:25 <****> bash's mv?
00:25 <****> only if I have to cross partitions
00:25 <****> File::Copy also moves
00:26 <****> or file::copy can move ah
00:26 <****> even directories?
00:26 <****> it is File::Copy not file::copy
00:26 * Khisanth stabs happy_guy2
00:26 <****> ouch
00:36 <****> who is your daddy!
00:38 <****>rows is giving 1 or 2 (depending on the query), but if I run the query directly in mysql, it returns null
00:38 <****> http://xkcd.com/293/
00:38 <****> fireangel: are you sure $sth is not return 1 to indicate failure?
00:39 <****> this writer should replace all the dummies in holywood
00:39 <****> no its returning something like 14912
00:39 <****> depending on the case of course, the number always change
00:39 <****> 14912, the year Columbus discovered the New World.
00:40 <****> My advice is to print your queries in Perl and see if they match what you are using to test in mysql.
00:40 <****> 14912!?
00:40 * shaldannon smacks initself for adding an extra 1
00:40 <****> initself: thats what I did, it returns null
00:40 <****> thats why im puzzled
00:41 <****> yes, why are you so surprised? 14912 is the year Mike Columbus will discover the New World, in the Alpha Centauri system.
00:41 <****> bpalmer++
00:41 <****> heh
00:41 <****> lol
00:41 <****> proxima centari ncie too
00:41 <****> why do vips and laod balancers bug me?
00:41 <****> whhhy
00:42 * CPAN upload: CPAN-FindDependencies-1.1 by DCANTRELL
00:42 <****> fireangel: walk through it step by step, make sure your query is what you think it is. also, (strongly) consider using DBIx::Class rather than handcoding DBI.
00:43 <****> (perl -d)++
00:44 <****> phpmyadmin or clones yet you run queries
00:46 <****> what more could I do more than print $sql, run the query in phpmyadmin, see that it returns no results, run the same in perl, see that it do return results? ill try to pastebin my code, im a php guy, forced to use perl for this one, so maybe I screwed something
00:46 <****> How can I change the format of ($day, $month, $year) = (localtime)[3,4,5]; to end up with 2007-01-01 ?
00:46 <****> Josh43: use strftime
00:46 <****>ymd
00:47 <****> Josh43: DateTime, highly recommended
00:47 <****> ala use POSIX qw(:strftime); strftime(q(%Y-%m-%d),localtime);
00:47 <****> nice, new colloquy looks sexy
00:47 <****> fireangel: I'd make sure that the 'results' you think you are getting, make sure you know what they are.
00:47 <****> strftime++
00:48 <****> s/://
00:48 <****> I switched to DateTime when I started needing to take timezones into account. :)
00:48 <****> %F = %Y-%m-%d
00:48 <****> initself: http://pastebin.org/7372 see the code, according to my perl past, im pretty sure i screwed something by being in 'php mode' of thinking
00:48 <****> timezones-- # also DST. swatch beats, or death
00:48 <****> oo, thanks for the string, dondelelcaro; I was rtfming strftime ;)
00:49 <****> dkr: How much more complicated is datetime? from the examples it looks like a paragraph to set up the right output
00:49 <****>fetchrow_array) { # you are returning an array in scalar context
00:50 <****>ymd
00:50 <****> so that should be @cluster and then I should use @cluster[0] ?
00:50 <****> coding in two languages at the same time leads to that kind of brain malfunction, sorry!
00:50 <****> Sure. And then use Data::Dumper and print Dumper(@cluster) and see what that actually has in it.
00:51 <****> dkr
00:51 <****> dkr; oh
00:51 <****> lol
00:51 <****> thanks for the help initself
00:51 <****> fireangel: not sure if we're out of the woods yet, pls let me know
00:51 <****> Dumper \@cluster
00:52 <****>fetchrow_arrayref
00:52 <****>ymd"; }"
00:52 * Khisanth prefers hashref
00:52 <****>fetchrow_array is evaluating fetchrow_array in list context, not scalar context.
Total 27 pages. You are browsing page 1/27.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
