« first day (679 days earlier)      last day (4283 days later) » 

10:00 PM
if it doesn't cause your system blow up its memory, then you shouldn't worry about it
 
@netcoder My problem is that it keeps there consuming memory, increasing after each request.
 
@Keyne: when you say "Web requests", do you mean they are actually apache processes or httpd processes? or are they php processes?
 
@netcoder apache processes I mean, sorry.
 
but the processes' commands themselves, what are they? apache (or similar) or php?
 
@netcoder apache
 
10:05 PM
as in /usr/bin/apache or /usr/bin/php...
@Keyne: are you using persistent connections (databases, sockets, etc.)? APC?
 
@netcoder No...
 
how many of them do you have? does the number of processes grow infinitely?
 
@netcoder The command is /usr/sbin/apache2 -k start
It rises up to 10 and then keep between 10 and 6. Whenever a new request is made it goes again to 10, 12 ...
killing it at the end I keep the memory with 100mb... otherwise it goes up to 600mb+
All processes with 0.0 cpu, only eating memory.
 
@Keyne: how do you know it's 600mb? top?
if so, what column are you looking at?
 
Yes, top. The amount of memory used is on the top of the screen,.
 
10:15 PM
oh ok, 600mb total then? not per process?
 
@netcoder Right... average of 600mb without killing it. 100mb total killing it.
@netcoder Right... average of 600mb without killing it. 100mb total killing it.
@netcoder Right... average of 600mb without killing it. 100mb total killing it.
@netcoder Right... average of 600mb without killing it. 100mb total killing it.
Sorry for the repeated messages... something went wrong here..
Can't delete it.
 
@Keyne: With the information you gave me, I don't think there's any problem
Apache processes will cache stuff increasing their memory consumption over time
Eventually they will clean that cache which would cause the memory consumption to decrease
 
@netcoder I'm on a VPS which let me use more memory than I have for a short period of time, the problem is that without killing it keeps above my quota.
 
if you have 600mb used by apache, depending on a lot of stuff (your configuration, your script, your HTML pages and external references, etc.), I don't think it's a problem
 
hi everyone
 
10:29 PM
@Keyne: you're probably using mpm-prefork, so you can use MaxSpareServers and MinSpareServers to tweak that up
 
As everything works well killing it at the end, I thought that it could run with just 100mb.
@netcoder Will check it.
 
MaxSpareServers basically tells Apache keep have a maximum of X processes waiting for requests
so if you change that, Apache should end unused processes when you exceed the limit automatically
 
Did you guys know some good paypal plugin for wordpress ?
 
@netcoder Okay I'll look for this config. Thank you!
 
pce
10:42 PM
nevermind, i am drunken, i ate at a party ... peace.
 
what ?
 
pce
hi!
 
10:55 PM
are ifs and switches the same thing internally
 
How do I subtract a date from today so that it returns the number of days?
So, for example, subtract yesterday's date from today and I want "1 day" or something of the like...
 
@PeeHaa sigh Now why didn't I find that!!!
Thanks @PeeHaa!
 
np
 
@Nile no , but depending on code , it could be considered a code-smell
 
don't want to , its 2AM here
 
okay, fair enough. so in the php src, the switch isn't just a loop that uses ifs to determine final results?
(i'd check the source myself, but I can't find it in these files: github.com/php/php-src)
 
no , iirc, it was based around some hash-list-thing
 
alrighty
 
here , ask @NikiC , he plays with php-src
 
11:16 PM
@NikiC what's the internal difference between switch...case....case...case...default and if..elseif...elseif...elseif...else
 
@Nile What kind of difference are you looking for?
 
@NikiC little enough to say that using if...elseif...elseif...elseif...else is just as smelly as switch...case...case...case
 
@Nile I'd say that usually it is the other way around ;)
I usually only use switch if I need the fall-through behavior
 
@NikiC but nonetheless, if somebody says "I don't want to use ifs" and a commenter says "use a switch!" and I say "they're the same thing...", am i wrong*?
* enough in this situation
 
Well, they're not the same thing, though you are right that it makes little difference which you use in practice
 
@NikiC okay
 
The main distinguishing features that switch has is the ability to fall-through and the ability to break/continue out of it. But that's not something you usually need.
 
@PeeHaa Maybe you can help me a little more??
 
> Just tell us your problem. If anybody* can and wants to help, they will.
* (including @PeeHaa)
 
I need to run a date through an if statement. If the date is within 24 hours of today, then it needs to execute the code.
How would I do that?
The date is in the date('d/m/y h') format
@Nile :-D Thanks!
 
11:24 PM
@daviesgeek You can also just use DateTime::diff for that
 
@PeeHaa Yes, but date_diff doesn't like my first parameter...(code coming)
 
@daviesgeek get the timestamp of that date and assign it to a variable (we'll refer to it as $date). now, make a time stamp that's the current time - 24 hours ($before) and one thats the current time + 24 hours ($after). check and see if $date is greater than or equal to before AND less then or equal to after
 
date_diff(strtotime('-1 day', date('d/m/Y h')), date('d/m/Y h'))
 
@daviesgeek huh?
It expects DateTime instances
 
facepalm
Wrong code!
Sorry, that was a test bit of code for something else...
if($created >= date('d/m/Y h') && $created <= strtotime( date('d/m/Y h'), strtotime('-1 day'))){
 
11:29 PM
And that has nothing to do with diff()
 
(Just ignore what I said before)
 
Or DateTime class
 
@PeeHaa :-D (see above comment)
 
I was talking about your last snippet
 
@PeeHaa I know.
 
11:30 PM
<?php
$date = strtotime($date);

$yesterday = strtotime("-1 day", time());
$tomorrow = strtotime("+1 day", time());

if(($date >= $yesterday) && ($date <= $tomorrow)) {

	// run code

}
 
I was talking about and posting the wrong thing...
 
So...
@daviesgeek I've only seen wrong things
 
@daviesgeek how'd that work?
 
@Nile Okay...somehow it isn't seeing that some of the dates are within 24 hrs...
 
Neither code snippets you posted have anything to do with the DateTime::diff(). Have you actually opened the link I shared earlier?
 
11:36 PM
@PeeHaa Yes. I did and I decided to do it a little differently...date_diff would work, but methinks @Nile's way is actually better...
:-)
 
...
 
I'm not sure why... try strptime instead of strtotime for the $date variable... and how do you know that it's better than Datetime::diff()...?
 
Well then why would you ping me ±P
 
@Nile The result should be better than what date_time will give me...
@PeeHaa ...................
 
But if you get the absolute value of the difference, all you have to use is one operator to see if it's greater than 24 hours...
Probably faster than my code...
 
11:40 PM
Ugh...maybe...
I really don't know...
 
okay. good luck.
 
:-) Thanks. I'll need it!
 
not really... this should be pretty basic stuff
 
Yah, but I get easily confused with such code. There's other stuff I have to to besides just the date stuff...
@Nile 25/08/2012 is in the datetime format right?
 
use the manual
4
 
11:51 PM
Hey, can someone help me install PHP and a local webserver?
 
@GeorgeSumpster I might. Someone will be able to help you, though.
PHP

Discussion for all things PHP - Don't ask whether someone is here or can help. Just tell us your problem. If anybody can and wants to help, they will.
 
@GeorgeSumpster cd /usr/ports/www/lighttpd; make install clean; cd /usr/ports/lang/php; make install clean
done
 
Okay @Nile for whatever reason, the if statement still doesn't return anything...I'm not sure why...
 
your basic webserver software has been downloaded , compiled and installed on your freebsd machine
 
@daviesgeek if statements aren't supposed to return anything
so that's probably a good thing
 
11:54 PM
@Nile Right! :-D But I have code inside...
 
@daviesgeek so what you're trying to tell me is that the condition is evaluating to false?
 
Actually I did figure it out. Using time() produces something like this: "1345852450"
@Nile :-) Yes.
 
okay... and so what?
 
@Nile The date that I'm passing into the statement is like this: 25/08/2012
in d/m/Y format
 
@daviesgeek and you need to convert it into a timestamp...
 
11:56 PM
@Nile strtotime() returned nothing for me when I did ran it on the date...
 
echo it out
and i said to use strptime
 
@Nile Oh sorry!! I musta missed that...
@Nile Okay, now I'm getting an array back.
 

« first day (679 days earlier)      last day (4283 days later) »