Jump to content

requinix

Administrators
  • Posts

    15,290
  • Joined

  • Last visited

  • Days Won

    436

Everything posted by requinix

  1. Like the kind you used to access this forum? A form that asks for a username/email and password? You know, the normal thing that you see on the internet.
  2. Yeah, you definitely still need to use escapeshellarg. Escaping values isn't always about malicious data - sometimes it's simply about making sure that stuff doesn't get screwed up. But serialize? Ew. I'd rather have the other process read JSON through stdin.
  3. Not in this forum. The PHP Coding Help forum supports it as a sort of trial run-type thing, but we've had that running for so long we might as well apply it to the other forums too...
  4. Browsers will remember Basic authentication credentials and pass them along any time they think the website might want to have them. The session is essentially pointless. The "only" way to log out a user is to re-send a new 401 response so the browser will prompt for (new) credentials. An even better answer would be to forget Basic auth and set up a normal login system like every other website does instead.
  5. It gives more control, but one feature it doesn't have is a way to wait for the process to close or a timeout to expire. So unless I missed something, that means having to poll the process every couple seconds to see if it's still going, then giving up and terminating it if the 120s has passed.
  6. 1. Live Server? Didn't you say you were using XAMPP? 2. Unless configured otherwise, .html extensions do not run PHP code. Use a .php extension.
  7. It has nothing to do with the IDE. Okay, AJAX, then:
  8. Note that PHP 8 changed string <=> number comparisons.
  9. It wouldn't have to be a second script. All you'd have to do is edit the main script right near the beginning so that it forks, does a timed (120s) wait while the child runs, then if the time expires it sends a term signal to the child. But don't bother. Use timeout(1) for the problematic command.
  10. "Could not authenticate" could mean a variety of things. Start by checking the username and password you need to use for you mail server.
  11. Telling us the file name and line number where a problem happened does not help us. I posted a link. Read it and follow its instructions.
  12. Make sure you have your php.ini set up for development with these settings (restart WAMP if you change them): error_reporting = -1 display_errors = on Then look for error messages.
  13. http://www.catb.org/~esr/faqs/smart-questions.html
  14. I'm thinking either (a) the while loop Barand pointed out is returning more rows than expected or (b) the PHP script is executing twice. Both should be pretty easy to test.
  15. The other common reason for PHP trying to allocate absurd amounts of memory is, unfortunately, a PHP bug. Exactly which version are you using? Was it upgraded recently?
  16. Wouldn't it be easier to have the data on the page when it loads instead of having to load the page and then load even more after that?
  17. So... do that? You can tell what button is pressed, so if they pressed the Delete button then make the code do what you want it to do.
  18. You have it choose selectedIndex=0. It's not visible but that actually selects the first option - Select. If you want to unselect an option then set selectedIndex to -1.
  19. foreach($myObjectMap1 as $key => $item): $key is only valid for use on $myObjectMap1. Using it on Users $item->Users[$key] will not work correctly. Hint: if you have two arrays then you probably need two loops.
  20. It's the standard model of particle physics. You know, the one where everyone says it's too damn complicated and there's gotta be a simpler model of Everything. In other words, quantum bovine scatology.
  21. Let's see... So obviously you can't go polynomial for this. 21 data points means a 20th-order polynomial, and that's only 1 hour's worth of data. Also can't go sinusoidal because that's essentially a wavy line on top of a polynomial. You're getting into math that's beyond my capabilities. In essence, I think you need to fit a curve to a handful of points within a moving window (say, a window of 7 points and a best-fit 3rd-order polynomial) in a way that the curves smooth out. You're going to want a statistics library to do this.
  22. Oh, dude, that makes so much more sense to work with. Really should have started off with that. But first: you are combining rows and not columns, right? P49s get math-ed together, P51s, P55s, and P60s too, but you aren't mathing more than one of those together (as far as this thread is concerned), right? Seems to me you should first try to focus on merging those rows at creation time rather than later after the fact. Given that the sensors seem to poll every 3 minutes, how about the code storing this data first tries to UPDATE an existing row created within the last minute (and only INSERTs if not)? 13:00:22: P51 and P60 happen together, no rows within the last minute, create new row as [null, 4.47, null, 16.43] 13:00:25: P49 and P55 happen together, existing row within the last minute, update row to be [0.23, 4.47, 4.75, 16.43] 13:03:22: P51 and P60 happen, no rows within the last minute, create new row... That "one minute" can be any window you want as long as (a) it's consistently shorter than the time between every sensor's reports and (b) it's longer than the time between "sets" of sensor reports. If the window is too long and violates (a) then the data is still good but you're losing some values because newer ones are overwriting. If the window is too short and violates (b) then you get holes in your data, and though too many holes will break the chart, that's not likely to happen and besides it isn't a critical problem if it does. You do lose the timestamp of the second set of data, but you could fix that by also tracking timestamps of each sensor value reported. So that's five: creation time plus one for each sensor.
  23. They aren't even consistent with themselves. I would expect a sensor to report values on a regular basis, even if not at the same rate as another sensor, and yet, for the Value1 sensor, you have a value at midnight, one at 2:13, one at 3:14, and then nothing until 7:30? Too little data and all you can do is guess... Now, if you want to get really smart, you might be able to pool more data than you think. For example, if daily values tend to be similar then you can include the previous and next days' data in calculations. Expand out to a week or more both ways and you can derive a trendline for your trendline...
  24. Capital letters does not make it an environment variable. It it were then you would probably be using $_ENV instead of $_SERVER. https://www.php.net/manual/en/reserved.variables.server.php HTTP headers stored in $_SERVER are prefixed by "HTTP_". Take a look on that page to see if maybe there's something useful. To the question itself (since it is possible the User-Agent header may not be passed) then then solution is to check if the value is set before trying to use it.
  25. Yeah, looks like I was just being pedantic. Your question is "I have values measured inconsistently over time and I want to group similar values together and I'm currently doing some math on them". Raises questions like "what values?" and "why are they inconsistent?" and "does it make sense to group/average them like you've been doing, and if so why and how?" and "are you trying to interpolate data or render a chart or what?" And you can't tell it "no, these aren't discrete values, please give me a trendline"? Surely there's some sort of options to override what it's trying to determine automatically.
×
×
  • 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.