Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Sure there's something better: your computer. 1. Create a file named whateveryouwant.html 2. Edit file in whatever editor you want 3. Open file in browser 4. ??? 5. Profit!
  2. Hahaha. "I want to build a race car from scratch. It has four tires, a steering wheel that pivots them, and windshield wipers. How hard can it be?" You aren't just writing PHP code. You're writing PHP code that must observe a binary protocol communicating through a TCP socket. That is something 99% of PHP developers never have to think about in their careers. If you have a reliable spec that is relatively easy to understand then perhaps you should start there. Build your code from the ground up by dealing with the little things here and there: a function to send a specific message, a function to read a specific message, a class holding constants for all those magic numbers like 40084 and 40108. Each one of those can be written more or less by itself, and when you have enough of them, you can piece them together into something that actually does the thing you want done. Now that is something we're suitable to deal with. If you didn't create it yourself then yes: PHP doesn't have a "write" function. You will be wanting fwrite. The Python script says TCP... If it's not TCP then the initial connection to the device will fail. Which is a really easy thing to notice. And since you haven't noticed it, I imagine it hasn't happened.
  3. Without me trying to write the script myself, I see three options: 1. Dig deeper into the Python code to find out exactly what it does. Specifically, the ModbusClient. Translate everything in there directly to PHP code. Same class names, same method names, same everything. 2. Use a packet sniffer to see what the Python script sends versus what your script (for the same information) sends. 3. Keep the Python script, and write your output.log stuff in Python instead of PHP.
  4. How about... not developing your layout with jsfiddle?
  5. What's the Python script, and is there some documentation online about this sort of thing?
  6. More or less. Try a regular CREATE TABLE with an existing table name and post the full output of what you get back from the server. Potentially. I didn't create it so I don't know what the motivation was behind creating it. I also said that it was my opinion that using IF NOT EXISTS is a symptom of a problem, and though very many people may believe otherwise, opinions are not facts.
  7. PHP is Turing-complete so you can do literally anything with it. If you'd like me to share information with you about this subject, I will recommend this link.
  8. Can't tell from what you've posted, but would you happen to be destroying and recreating the Edit Quote buttons? Such as by replacing the contents of some ancestor container element during an AJAX request? Separately from that, 1. Make the modal show in the success handler. Otherwise it'll show immediately before the AJAX request has finished and filled in the contents. People on the internet are going to notice this effect much more than you will if you happen to be testing this locally or in a local network. 2. You're attaching the same onclick handler to every single Edit Quote button, and they all do the same thing. That's wasteful. Set up one handler that applies to all of the buttons. If you are doing the destroy/recreate thing then this will also solve your problem.
  9. There is a bug, but it is not with PHP or SQLite. Echo out the $sql and try that directly. Some value somewhere, either $ime or in $_POST or in your database, is not what you think it is.
  10. Why are you asking here. Note that was not a question. It was a statement. https://help.imgur.com/hc/en-us
  11. That's it. "-p X:Y" maps the host's X to the container's Y. Make sure the container (and Apache) is running, and that you're browsing to localhost:8080. You should definitely get a connection, even if something else doesn't work.
  12. Try again. And pay very close attention to what you read. Hint: What port does the Dockerfile say it will be exposing?
  13. Why do you think you need a temporary table?
  14. Getting closer. Read up on what the -p argument does.
  15. Weird that the browser decided that it would take what you typed in and then do something else instead. Is there anything else you did differently from the example? Any redirects in place? Did you read the part in the example that talked about port mappings? No hostname means it should handle requests for every hostname. It's not a proper setup, thus the warning.
  16. Okay. So where are you getting "www.test.local" from? Also, forget the hostname and just use localhost.
  17. Exactly what happens when you try a regular CREATE TABLE? Look carefully. And opinion: if you need IF NOT EXISTS then that means you don't know what is happening to your database. You should always know whether the table exists or not.
  18. Where are you getting "www.test.local" from? Just use localhost.
  19. Not quite, no. It was a matter of the elements being visible or not. Or I guess for consistency's sake I should say it was about them being visible or not. If the modal is hidden then the prices are not visible, right? And if you tell jQuery that you want to remove the visible prices then that's not going to do anything. So you have to take out that part of the selector. But if you do that then you'll target every div.price on the page, which may or may not be acceptable. I assumed not. Which means that to avoid removing things you don't want to remove, you have to tell jQuery exactly what you did want to remove: the price inputs inside the modal. Thus your final code should/could be $('div#add-edit-product div.price:not(:first)').remove();
  20. Sure it does. You just said it was working, didn't you? Also, $(selector).find(selector) is wasteful. Just do one $(selector selector).
  21. Are you sure they're visible? You can see them on the page? Your selector is finding every single visible div.price on the page. I'm saying, find the div.price inside the modal so that way you don't even have to care whether they're visible.
  22. Riddle me this: at the moment that code is running, what visible "price" inputs are there? If you want to remove prices from the modal then remove prices from the modal. As in literally, find the prices in the modal's markup and remove them.
  23. There are three things about this thread that bother me: 1. You still haven't asked a specific question. As in, written a sentence that ends in a question mark. You've said things about algorithms and papers and Euclidean this and Euclidean that, but never asked a question. 2. "Euclidean distance" is a highly Google-able phrase that leads to a very simple (you probably already know what it is, even if you aren't aware of it yet) equation. 3. You're reading through a paper that involves... well, it's not that it has a lot of math in it, but that it's not casual reading material. Honestly, a lot of it is quite obvious if you give it a minute - what's "new" is the concept of using multiple measurements as a way of reducing errors. It's basically statistical regression. So how about you do everyone a favor and ask a specific question that demonstrates either (a) you do not have the necessary background information about how the math is supposed to work, and are looking for an explanation of it, or (b) you do have the necessary background information and are having a hard time with one or more specific aspects of translating that information into code. Above all, I want to see a sentence with a question mark. Bonus points for stating what Euclidean distance is, and more bonus points for posting the code you've written so far.
  24. Not sure how the QR code is supposed to help, but if you want to determine approximate location based on signal strengths, convert those signal strengths into distances from the AP (it's not enough to know -67 dBm but you have to know where that measurement happened), then apply standard triangulation math (which also requires knowing the location of the APs themselves). In other words, get some real world numbers, do the math on paper until you get the right answers, then translate that math into code.
  25. The Euclidean distance formula is simple, but with logarithmic scales it'll be weird. What you haven't done yet is give a description of what you want to do. Saying "I have these numbers and I want to use the 'Euclidean Distance Algorithm' with them" doesn't actually say anything. What are you trying to get out of this? Why are you calculating a "distance" with field strength measurements?
×
×
  • 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.