@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19



Comments:

<0> no.
<1> i know i'm on the right path someone needs to help move this forward tho
<2> What just files on your file system?
<0> straight text files after decompression
<2> What os? I mean how does this apply to php?
<0> actually, I'm using a function to decompress them: exec("bunzip -c $thisdate.bz2 > $outfile",$retval)
<0> problem is, I need to consecutively decompress a series of files to that $outfile.
<2> Whoa hold on wait...
<1> is there like... and $isdate or something?
<2> So what about consecutively.
<1> yeah
<1> actually
<1> go file by file until you get to the 'end' date
<0> Right. I need to decompress a series of files. $firstdate to $enddate
<1> right
<1> so



<2> Or...there are these little buggers "<" and ">"
<1> decompress $firstdate
<2> Dude isn't this a bunzip question?
<1> then check each filename after that and STOP after decompressing $enddate
<0> the problem is in determining intermediate values BETWEEN $firstdate and $enddate
<0> BillMurray: no.
<0> I'll be checking the file's there anyhow, as part of the decompression: if ($file) { .... } else {next step {
<1> no, retrieve a list of files, order them by filename...
<0> }
<2> Holy **** dude...viking... what goes into $outfile ?
<0> BillMurray: the decompressed contents of files from $startdate to $enddate.
<1> start in that list, from $firstdate
<1> and continue down the list, stopping after $enddate
<2> Yeah or **** what is the format of $startdate
<0> Twyce_Dailey: I know how to start, I know how to end - I *don't* know how to iterate.
<0> format is ddMonyyyy
<1> you dont need to iterate a date, per-se
<2> well uhh..is $outfile an array that you want to iterate through?
<1> create an ordered list of files, in a table
<0> I need to iterate FROM one date TO the end
<1> filenames in one column
<1> sequential numbers in another
<2> column. What is the rdbms?
<0> BillMurray: outfile will end up being a text file to be processed later.
<2> Man I am so lost.
<0> There's no database involved
<1> ok
<1> viking
<1> here's what you do...
<0> *sigh* yes?
<1> forget everything that's been said so far
<0> Good. I figured that.
<1> create an array with 2 columns
<0> <grin> You guys don't know **** </grin>
<0> But anyhow, I'm listening...
<1> wait
<1> i just
<1> forgot everything i know
<2> This bothers me. Viking...when you run that exec() will you tell me what happens?
<2> I mean **** you say we don't know **** but you said you don't know how to iterate...jesus holy christ.
<0> right. The exec actually works (or at leastt the line I've got in the source works).
<0> So I know THAT bit works.
<2> tell me what is in $retval
<2> var_dump() it and post it in a pastebin
<0> now all I need to know is how the hell to count from startdate to date. The retval isn't really relevant.
<2> Well holy **** then what does that exec do!??
<0> just so you know, here's the exact exec line: exec("bunzip2 -c $place/$chan/$date.bz2 | grep \"<\|Action\|---\" >> $outfile", $retvar);
<2> That is nice but is bunzip2 decompressing a bunch of files and sticking them in a dir?
<2> Jesus holy christ...
<0> no.
<2> Ok. Is it creating an array of file data of the decompressed files?
<0> Yes. Basically, it's a text file on the filesystem, which I then process
<2> What is the format of the file? And, if so, how does it pertain to php rather than bunzip itself?
<2> Honestly, if you just show me $outfile's contents...
<0> BillMurray: the format of the contents is irrelevant.
<2> Oh.
<2> But somehow you want to iterate through some files and extract file data from a date to another date.
<0> no.
<0> Hell, I'll bring up pseudocode. Here.
<2> Dude I'm totally drunk.



<2> But still I think I can help you.
<1> **** man i could have had it coded for you by now and i dont even really know PHP
<1> but you had to go and insult us
<0> for ($this=$startdate; $this < $enddate; $this++) { exec("bunzip2 -c $place/$chan/$this.bz2 | grep \"<\|Action\|---\" >> $outfile", $retvar); }
<0> THAT'S what I want to do.
<0> Problem is, "for" expects to count using integers, not strings.
<0> and $startdate and $enddate and $this are all strings (ddMonyyyy formatted date strings)
<0> And that's where my fundamental problem lies.
<1> ok
<1> i'll cave and help you
<0> lol. Thanks. Any help that gets the job done is really honestly appreciated.
<1> create an array
<1> fill it with filenames and sort them by date
<1> i can't code this for you because i really don't know php ;p
<0> ah huh.
<1> but i can tell you how to do it
<0> That's the problem. I don't know how to sort by date.
<0> I'm REALLY new at php.
<1> ahh well then
<0> ... and if you looked at my source file, you could tell.
<0> Given that my previous background is in bash scripting, that has helped AND hindered.
<1> ok well...
<1> once you get the sorting by date figured out... honestly i can't help with that... the rest is simple
<0> The creation of an array holding filenames isn't a stupid idea at all.
<1> find the start date in that list, start from that position in the list, then iterate your position, stop when the filename in that position matches your enddate
<0> it'd probably solve the issue, but then I'd end up with an array that differed in number of elements every single time I ran the php script.
<1> then, even the possibility of missing dates is covered...
<1> leap years as well
<0> yeah. I guess.
<1> and you dont have to futz with date arithmatic
<0> it just creates a rather long array when I don't actually NEED to hit every dir entry on the disk just to build up the directorylist
<0> i.e. 1531 elements, most of which I won't use, but I'm forced to read the directory anyhow.
<1> actually...
<1> the files in question...
<0> yes?
<1> were created on the date in the filename, right?
<0> yup.
<0> each day of logs creates a file.
<1> ok... ou can sort them by creation date
<0> acteally, I can't.
<1> i can't tell you the function but i know there is one ;p
<0> they get copied around via email, and extracted from my mailspool on odd days.
<1> ahh
<0> so date of initial creation of file is correct, but creation of file I work with isn't the same date, due to timezone issues, and a couple of things like only running the despool program a couple of times a week.
<1> hrmm...
<1> ouch
<0> so if I pull twelve logs out, all those logs are dated at the time I create them on the harddisk from the mailspool
<0> i.e. 23Feb2006 will end up being dated my 25th Feb 2006
<1> ok
<0> so all I can sort on is the filename.
<0> I can munge the array any way I like, and I've got ways of converting back and forth. I have split off day, month, Month, and year into their own vars.
<1> is it possible to change how the logs are named?
<0> not really, no.
<1> heh
<1> can yo urename them as you get them?
<0> UNless you have a better way of doing it?
<0> rename them to what format?
<1> 20060225 is a LOT easier than 25feb2006
<0> so that I'm using Japanese format?
<1> then you just sort them numerically
<0> yeah, but then I run into the problem of iterating between the vars, which is what I came in here to ask to begin with.
<0> I can count from 7 to 32. Any idiot computer can do that. But I can't count from 20050318 to 20050429 without missing out a few hundred in between.
<1> use the array
<1> and iterate your position in that array ;p
<0> i.e. 20050331+ 1 = 20050332 (which SHOULD be 20050401 instead)
<0> yeah.
<0> so I count from 7 to 32 instead.
<1> bingo
<0> Now my only problem is in mapping what's between positions 7 and position 32.
<1> $files(7)
<1> $files(8)
<1> etc
<0> yeah.
<1> using $files($pos)


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #php
or
Go to some related logs:

#skype
#javascript
#chatzone
benny benassi-pump this party
#MissKitten
#chatzone
#php
xavi 7722r+
normalpeoplehateme
lil minn ha nahxi?



Home  |  disclaimer  |  contact  |  submit quotes