Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Tell me you've never used any other programming languages without telling me that you've never used any other programming languages 🤣 https://docs.python.org/3/tutorial/floatingpoint.html https://www.codemag.com/article/1811041/JavaScript-Corner-Math-and-the-Pitfalls-of-Floating-Point-Numbers https://stackoverflow.com/questions/1661273/floating-point-arithmetic-not-producing-exact-results https://www.cprogramming.com/tutorial/floating_point/understanding_floating_point_representation.html https://stackoverflow.com/questions/753948/why-is-floating-point-arithmetic-in-c-sharp-imprecise and finally, https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
  2. I wasn't a fan of it for a long time either - things like "it makes diffs cleaner" just don't matter that much to me - but I slowly moved myself over into that camp over the last couple years. Mostly, I decided I kinda liked the consistency of all lines having those commas, rather than all lines except for the last one.
  3. A good portion of the programming community, quite possibly the majority, encourages trailing commas on multi-line statements in languages that support it.
  4. ...yes, in particular? I mean, you installed the PHP extension thing for Eclipse, right? Do you have any PHP support at all? Do you get other errors and/or warnings but not the one about unused variables?
  5. People still use Eclipse? What setup do you have to enable PHP support?
  6. And you need to do this over ftp? The only want to compare the contents of a file over FTP is to download the file and read it locally. If you have to do that, and if you're optimistic that the remote server's files are almost the same as your local files, then you might as well download all the files and do a normal local-local comparison. To do this in PHP, I would first recommend writing something that can compare files in two local directories. Because the complication here is going to be in the comparison work - not in the FTP work. For the FTP work, though, PHP already has built-in support for doing many file operations using the ftp:// stream wrapper and it might work for you. https://www.php.net/manual/en/wrappers.ftp.php If you have something that can compare two directories, then switching one of those two be "ftp://..." could work. If you're not aware of it already, I'll also throw out RecursiveDirectoryIterator as a hint. That lets you read files from a directory and also open files for reading. The "might" is because I don't know how the ftp:// wrapper handles connections: if it is able to reuse one (besides the PASVs) then that's great, but if it tries to create a new session every time you call something like file_get_contents then you should probably go with the regular ftp extension instead. So that's something for you to investigate: can you use RecursiveDirectoryIterator without it creating unnecessary connections?
  7. By understanding what the mysqli code you have now does, understanding how PDO works, and then translating between the two. It's like translating between two spoken languages (but considerably easier): you hear what someone says, you understand what they're saying, and then you repeat their thoughts using different words. $queryres=mysqli_query($myConnection,$querysl); $pagerow=mysqli_num_rows($queryres); $pagedata=mysqli_fetch_assoc($queryres); That runs a query, gets the number of rows it returned, and fetches the (first) row from the results. See what PDO offers to do that.
  8. That's JSON. Can I assume you've already json_decode-d it? Here's how to read that output: { The value you get back from json_decode represents an object. If you decoded it as an object (the default behavior) then you will have PHP objects to work with; if you told it to decode to associative arrays then the JSON objects will be PHP arrays. To get to the price, status, and name, first you have to get to "usedOffers": [ the usedOffers list. That means you need ->usedOffers or ["usedOffers"] on whatever variable you're using for the decoded JSON. The [ means this value will be an array. Since there are multiple items in this array, you need a foreach to get the next thing to work with. Each of those { will be an object (or associative array). The price is immediately available from there. For the condition status, you continue from there by getting "condition": { the condition, which is also an object (or associative array), and from that you can get the status. Similarly, the name is under the "seller" object. If you have trouble, post your code and describe both what you expected to happen as well as what actually happened.
  9. If you're on Ubuntu then do not edit INI files yourself. As most other major distros do too, Ubuntu will set everything up automatically for you. Undo all of your manual changes, including where you added that extension=openssl line, then install the php-openssl package (using apt).
  10. Where's the rest of it? The rest of the HTML and the rest of the CSS?
  11. Because as the first two words of that output show, those are warning messages - not exceptions. Which suggests that you didn't include in your own code the set_error_handler code that blog post demonstrated. Which, by the way, would throw an ErrorException and not an EngineException. And speaking of, there is no such thing as "EngineException". PHP 7+ converted some things into exceptions. Not all things.
  12. Taking for granted who is writing a web app? Is it someone other than the person who started this thread? What? Really? PHP can do other things than serve websites? I had no idea! 🙄 So if this isn't for a website then would you kindly explain what this is all about?
  13. Strider is probably on the right subject. URLs don't have to match files. You can have a file named "whatever.php" and show it in a URL as "whatever" - or anything else you want. So keep the file extension, and if you want your URLs to look a certain way then make the URLs look the certain way.
  14. confirm() will present a browser dialog with a "confirm" button (eg, Confirm or Yes) and a "cancel" button (eg. Decline or No or Cancel).
  15. You're saying that you don't believe programmers should be using file extensions?
  16. Without a file extension, your system has to guess what type of file it is based on the data. Apparently, it guessed "map-path". And your PHP Editor doesn't know what to do with "map-path" files. Give your PHP files the .php extension. It's what you're supposed to do.
  17. preg_match_all returns the number of matches. Come back next week when your head has cooled off. Or don't.
  18. Did you check the link I gave? It pointed you to the Return Values section (or at least it was supposed to).
  19. If it works in one file and not in another then you likely have some sort of problem with variables. Namely, that $txt one. Side note: don't count the matches like that.
  20. Once again: I'll even point you in the direction of using RewriteCond to perform that check.
  21. There are no duplicates in that output either. Look at the Grader column: every value is different. That means every row is different. You need to describe what data you want to get with a query. What rows do you want? What values do you want? What rows and values do you not want?
  22. A height of 100% fills to the parent's height. If you want the full height of the viewport then (a) make sure the parent element - and its ancestors - are the full height as well, or better yet (b) don't use percentages and use actual meaningful units like vh.
  23. I don't see any duplicate rows in that output. 1. What data do you have in the tables? 2. What is the query you are executing? 3. What results do you want to get, and why?
  24. The way they do it is they give the user something to connect to that supports only IPv4, and then another that supports only IPv6. Then they combine the information together to give you the full results. Because all you can ever get from the user is how they connected to your site. If they used IPv4 then you can't know what their (public) IPv6 address is.
×
×
  • 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.