Jump to content

john_doemoor

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

john_doemoor's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a problem, I would have to find a .csv file that is the most latest modified from a specific directory. And return the name of the latest modified file. Does some1 have a working example for this kind of case? Thank you in advance!
  2. So my issue is, that i have this function: public function parseLogLines($logLines, $householdId) { $logLinesArray = array(); foreach(preg_split("/\n|\r/", $logLines) as $logLine) { if (preg_match("/$householdId/", $logLine) > 0) { $logLineArray = preg_split("/,/",$logLine, 2, PREG_SPLIT_NO_EMPTY); $index = (int)$logLineArray[0]; $content = $logLineArray[1]; $logLinesArray[$index] = $content; } } return $logLinesArray; } which goes thru loglines and if they match stores them to array. then i have this function: public function getUserLogLines($logLines, $householdId) { $this->userLogLines = $this->userLogLines + $this->parseLogLines($logLines, $householdId); return $this->userLogLines; } which goes thru new log entries and remembers them. How can i make that last function to find a part of a string from value? Other issue is how to make the first function to parse also those loglines which include the part of string parsed from value?
  3. So my issue is, i need to use: public function parseLogLines($logLines, $householdId) { $logLinesArray = array(); foreach(preg_split("/\n|\r/", $logLines) as $logLine) { if (preg_match("/$householdId/", $logLine) > 0) { $logLineArray = preg_split("/,/",$logLine, 2, PREG_SPLIT_NO_EMPTY); $index = $logLineArray[0]; $content = $logLineArray[1]; $logLinesArray[$index] = $content; } } return $logLinesArray; } at next function, and at next function i parse more loglines with this function, and i need all of the loglines stay in an array.
  4. Hi guys, My problem is, when I use array i created in previous function, it "forgets" the values I already inserted. How can i make array "remember" the values and not to delete them? THANKS!
  5. The first one worked, when i returned $this->userLogLines; and thanks for that! Still need help, i need to make a comparison in that function that lines haven't multiplied. function testGetUserLogLines_SameLogLinesAreNotMultiplied() { $loglines = "3294051,Sun Jun 10 17:59:59 2012,NFO,HB,10.111.221.30,RealGoldRush2,h-1-JG26D2S-s0\n"; $loglines .= "3294052,asdö aölköaslklk,RealGoldRush2,h-1-JG26D2S-s0\n"; $loglines .= "3294053,Sun Jun 10 17:59:59 2012,NFO,qwpjqwrepoqwe poqiwepoiqwe\n"; $expectedLoglines = "3294051,Sun Jun 10 17:59:59 2012,NFO,HB,10.111.221.30,RealGoldRush2,h-1-JG26D2S-s0\n"; $expectedLoglines .= "3294052,asdö aölköaslklk,RealGoldRush2,h-1-JG26D2S-s0"; $this->assertEquals($expectedLoglines, $this->schedulerLogLiveView->getUserLogLines($loglines, "1-JG26D2S")); $this->assertEquals($expectedLoglines, $this->schedulerLogLiveView->getUserLogLines($loglines, "1-JG26D2S")); }
  6. Yeah, you got the idea! gonna test it tomorrow, cause don't have testing enviroment on this pc... THANKS!
  7. So my question was how do i use "parseLogLines" function to return loglines including specific "$householdId" as "userLogLines" on "getUserLogLines" function? logLines are given on PHPUnit's testcase...
  8. Hello guys, I need help with this: So i should use previous function: to parse this: Any suggetions on how to do it? Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.