Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. The error message is telling you that the function requires at least two arguments but you only passed one. Perhaps the documentation may be of help? There are other... issues in here, though.
  2. How do I ask a good question?
  3. Sounds more like a concurrency problem: you've got two things reading state at the same time, both finding out that the room is available, and both trying to use that room. Operations need to be atomic, meaning the act of checking for an available room and joining the room need to work as one cohesive unit, with state information that can't be unknowingly modified by something else. How are you finding a room to assign to a user? Is it something straightforward like "SELECT available room" and then "UPDATE room SET is not available anymore"? If not that then I don't follow what this "can't tell whether the user is 1 or 2". AJAX polling will start a request, and that request should most definitely be able to identify which user is making it...
  4. Because require() isn't like PHP where you "require" a file and then you get the variables in it. In Javascript, each file is like an independent module, so if you want to share - or export - data from a file then you need to use module.exports as Strider64 showed. What require() will then do, internally, is run the file and then return to you what was exported. If you wanted to export just the one value then you can set module.exports like that. If you had multiple values then you can treat module.exports as an object (which is what it is by default) and set properties on it; this pairs well with destructuring. const arrayOfObjects = [ ... ]; const anotherArrayOfObjects = [ ... ]; module.exports = { arrayOfObjects, anotherArrayOfObjects }; const { arrayOfObjects } = require("./data");
  5. Images are for memes. If you want to show code then please use the Code <> button and paste it into your post. $header1 = "Content-Type text/csv"; $header2 = "Content-Disposition: attachment; filename='" . $csvname . "';"; They're both malformed: the first one is missing a colon, and the second one is using single-quotes when they're supposed to be double-quotes (and it has an extra semicolon that doesn't belong).
  6. Your first goal should be to reproduce the problem - because you can't know what to fix if you don't know what it is, and if you can't reproduce the problem then how will you know if your fix is working? 1. Gather more information. What SSL error? Surely there's some more specific information someone can give you? Like an actual error message, maybe? 2. Apply some logic. Which users are seeing this? What do they have in common? Do they have anything in common at all? Can the users successfully log in at another time? 3. Think about it from a technical standpoint. There are tons of possible SSL errors (see action item 1) but most of them boil down to the server not giving an appropriate cert. Do you have multiple servers? Is there a load balancer? Geographic CDNs? Are you sure they're all configured with identical information and up-to-date certificates? 4. Examine the details. "Certain static content not found" isn't any error message I've ever seen before - assuming it's a literal message. Where is it coming from? Under what conditions will it be emitted?
  7. You're using the htmlentities function when you should not be. 1. You should be using htmlspecialchars instead when outputting something safely to HTML. htmlentities is unnecessary, and if you "need" it to make something look correct then that means you have other character encoding problems that need to be solved. 2. You should only be doing that at the very last moment right when you're doing the output - never before, or else you'll run into problems such as your current issue.
  8. Start with the values in $_POST. That will tell you only the checkboxes that were checked. Then you find out what the corresponding costs are and add them to your table - something which you can do easily with an INSERT...SELECT query.
  9. What kind of "news" are you talking about? What does it look like? What information is part of the news item, by which I mean things like author names or publish dates or tags or banner images... Because unless you literally want the most basic-looking "news" ever, you're going to need something more than just plain text. Because "build a simple flat file" is an implementation decision, and how can you decide that if you don't even know yet what you want implemented?
  10. The way you describe this makes it sound like you're doing something more complicated than what it should be... With a proper server, you can use a normal <link> to your CSS file and never need to clear a cache - if you do then that means it's not configured properly. The question to answer first is whether your browser is receiving the correct <link>, and if so why it isn't loading the CSS. My guess would be the file path, as you need to remember that $stylecss is relative to the webpage URL and not to the config.php file path.
  11. If you want a distinction between $this (use the instance) and self (use the class statically) then create an enum with cases for instance vs. static, and take that enum as the argument to your attribute. But ultimately, the caring about the instance/class needs to happen by whatever code is reading the attribute. As in, you must necessarily already have code that says "for this particular class, find me the attributes" - so reuse that information.
  12. And a description of what's going on here would be...?
  13. Remember the part where I said And remember the part where I posted Take the time to understand what I was describing about how to read the var_dump output, then look at that one line of code I posted to see if it makes sense according to what I described. It should not make sense, and you should be able to spot a small error. I'm trying to get you to learn here, instead of just accepting what a person on the internet says and copy/pasting their code. You can't be a chef by copying someone else, and you can't be a programmer by copying someone else.
  14. But what's everything in between? Or rather, what's the whole script? Because there's something important here that isn't shown in what you've posted - if statements, function calls, reused variables... Also, partly for good measure and partly because there's a rather high likelihood that doing so will help you discover the problem: have you verified that your error reporting/logging settings are appropriate, and then checked for error messages?
  15. Probably. Inheritance represents an "is a" relationship. Would it be accurate to say that your custom exception class "is an" InvalidArgumentException? If I had code that caught InvalidArgumentException, should that code also be able to catch your exception? Composition represents a "has a" relationship - or "needs a", or something else similar to that. Would it be accurate to say that your exception class "has an" InvalidArgumentException? Is your class a distinct form of exception separate, but not entirely unrelated to, an InvalidArgumentException? The answer seems like it would be the first one, however the $otherDetails is suspicious and suggests something more than an invalid argument, thus perhaps composition is more appropriate, however the fact that you chose to make it anonymous means it will be impossible to catch or type guard for that particular class in the first place, which makes composition almost useless. In other words, your example doesn't make sense. If you want a special exception class then it should be a full named class. If you want special exception data then it needs to be a full named class. And that is the real code smell.
  16. Read my description of the var_dump output, then look closely at the code I posted (hint: the error message tells you exactly where to look). There was a typo.
  17. Most editors and IDEs will let you open an entire folder as a project and then search across all the files for something you want. If you know what the text says, or the filename of the image, then you can search for that and see where it is.
  18. Read my description of the var_dump output, then look closely at the code I posted (hint: the error message tells you exactly where to look). There was a typo.
  19. But do you actually understand why they say that? Because they are not saying that inheritance is bad. So tell me: in this situation you find yourself in, why do you feel that composition is better than inheritance?
  20. object(stdClass)#12 (4) { The value you dumped is an object. ["result"]=> array(6) { It has a "result" property, which is an array. [...]=> object(stdClass)#11 (2) { Somewhere in that array (you should probably not rely on it being in a particular place) is an object. ["code"]=> string(8) "switch_1" It has a "code" property, which is a string with the value "switch_1". ["value"]=> bool(true) That same object has a "value" property, which is the boolean value true. This is an awkward structure to work with. What if you wanted other things besides the switch_1? Wouldn't it be nice if you had a single object/array that had everything at once? Try this: // assuming $object was the variable you dumped, $results = array_reduce($object->results, function($array, $result) { $array[$result->code] = $result->value; return $array; }, []); Then try dumping out $results and see if the data is easier to use in that form.
  21. That's unfortunate. Keep trying? It's not like I can log into their servers and fix it or anything.
  22. .obj :hover > div :hover That will target an .obj with a descendant-element you are hovering over which contains a DIV with another descendant-element you are hovering over. In other words, your HTML has to be something like <A class="obj"> <B> <div> <C> <!-- hovering here --> </C> </div> </B> </A> I doubt that's what you want. :hover isn't cinnamon, so you can't sprinkle it over miscellaneous elements and expect them to taste better. If you want the animation to play while hovering over the DIV then apply :hover directly to it alone - while also remembering that whitespace in CSS is occasionally significant. .obj > div:hover
  23. SSL is only if you are not using a Unix socket. Which you are. So you don't need it.
  24. I don't know. Try https://community.devsense.com/
  25. Are you using their extension? Did you turn on the appropriate settings?
×
×
  • 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.