Jump to content

requinix

Administrators
  • Content Count

    10,885
  • Joined

  • Last visited

  • Days Won

    198

Everything posted by requinix

  1. requinix

    Order of dependency injection

    Depends. What "uses" what? I would expect the Connection uses a Protocol, so the Protocol should be injected into the Connection.
  2. requinix

    Order of dependency injection

    Inheritance and injection are two different things, and you should probably be using both. Inheritance is what helps you write less code. If two different Modbus protocols would share a non-trivial amount of code, you might as well move that code into a superclass. And if many protocols would share code, you move that stuff up into a superclass as well. Injection is how you pass stuff around. At some point the different protocol classes will get involved. Either you use injection by determining the right object ahead of time, or you use a factory so that the right object gets constructed when it's needed. Maybe a factory to create the object that will be injected.
  3. requinix

    <th> properties via css

    Which is why I added the second line about using classes. You aren't aware that things like IDs and classes can be used everywhere?
  4. requinix

    <th> properties via css

    Inline styling is totally okay for very particular things like this. CSP is a mixed bag. Just give up and use classes.
  5. requinix

    <th> properties via css

    Occurs to me I might be misunderstanding exactly what you want aligned center/right, but I'm talking about <tr style='text-align: center'> <th rowspan=2> S.No.</th> <th colspan=3> COL A </th> . . <th rowspan = 2> Action </th> </tr> <tr style='text-align:right'> <th> WS </th> <th> WS1 </th> . . <th> VS </th> <th> VS1 </th> . . . <th> XS2 </th> <tr>
  6. requinix

    <th> properties via css

    Give a text-align to the parent <tr> and the cells will inherit it. Unless you have something else in place to override it, of course.
  7. requinix

    Is 'password_hash' broken?

    There isn't a tutorial on password hashing, if that's what you mean, but the documentation for password_hash does say it creates passwords, and that the returned value can be used with password_verify() to verify the hash.
  8. Make sure you have PHP errors being reported or logged correctly: if get_headers() is not returning a Location then either the URL is not sending one or get_headers() somehow failed.
  9. You won't get the semicolons but it sure looks like that does what you want. Did you perhaps try it?
  10. requinix

    Assign Session Variables: Best Practices

    There are basically two philosophical reasons you would consider the variable: 1. You don't want to type $_SESSION["trackingNumber"] everywhere. B/C are identical. 2. You need the value in the script but also need it in the session. B is more suggestive of that (you need the value later, adding it to the session is a secondary concern) but C is perfectly fine too, it's a negligible difference. If neither of those apply then you might as well just stick with A.
  11. That's not quite what I said you needed to do. Look again. I assume that u_paid_videos even has a "time" column? Otherwise explain what "without success" means. What do you see? What do you expect to see? Are there any error messages?
  12. Passing an array to get_headers is invalid, so there's that. Post code. And since it's perfectly valid for it to return empty, why do you say that's wrong?
  13. This seems suspiciously complicated, but I think you might be able to do =CONCATENATE(B1,IF(C1="","",";"&TRANSPOSE(INDIRECT(ADDRESS(ROW(),3)&":"&ADDRESS(ROW(),COUNTA(C1:Z1)+2))))) (sounds like you'll have to translate the function names though) Hinges on whether Calc allows you to concatenate a string ";" with each cell in a range.
  14. Presumably, you would change the query to SELECT SUM(earned_amount) AS sum FROM <whatever T_* constant is the u_paid_videos table> WHERE <some condition to limit based on the date> AND user_id = <user ID> There's a couple <things> in there that I don't know the answer to that you will have to figure out.
  15. Merged. One question, one thread. I'll ask again: what do you mean by "combine", and why is the number of rows a problem?
  16. I can't tell what you're actually trying to end up with. What is the code for the "transaction file" and what do you want to do with the "$earned_amount" (which is not a variable defined in that code you posted).
  17. requinix

    Auto Insert based upon value

    For something that simple: yes, in MySQL 5.7+ you can do it using generated columns and a CASE expression, however if the logic ever needs to change then you have to do an ALTER TABLE. The fact that you would have to alter the table definition for something so simple and arbitrary means you should not do it. The commission rate should be determined through code, then stored with the rest of the sale data.
  18. requinix

    Log in system the right way?

    The session cookie is an access token. Think about it.
  19. requinix

    Git, Windows, Linux, and end of line

    Reminder that when core.autocrlf controls when Git converts line endings: - true = CRLFs in your working directory, LFs in the repository - input = whichever in your working directory, LFs in the repository - false = no conversions For the project you were contributing towards, if they asked for core.autocrlf=true then they want LFs in their code. That means you need either the "true" or "input" settings, depending whether you care about having CRLFs in your working directory. That's only ever useful if you want to open or edit a file in a dumb editor - which used to be Notepad, but since the October update that's finally no longer the case. So I would use core.autocrlf=input - LFs normally but with graceful handling of CRLFs. If you're the only developer then it doesn't really matter, but most people use LFs.
  20. requinix

    Weak type declaration for integers

    You have to scroll down to the Strict Typing section to see that PHP will coerce by default. So the "int" hint does what you want.
  21. requinix

    How to insure good form data winds up in the table.

    mb_check_encoding is fine to use if you want to verify you're receiving valid string data. If your "binding" does that already then you don't need to add it.
  22. requinix

    How to insure good form data winds up in the table.

    Can you be more specific about this "not being read" or "read twice"? What had you changed when this started happening?
  23. Here. This looks like a reasonable example I just happened to find lying around somewhere. server { listen 80; root /var/www/votes/public; index index.php index.html index.htm index.nginx-debian.html; server_name rather-long-name-demo.demo-apps.tk; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.2-fpm.sock; } location ~ /\.ht { deny all; } access_log /var/www/votes/storage/logs; # server_names_hash_bucket_size 64; }
  24. Don't edit the default file. Revert it to the original, disable it from sites-enabled, then create a new file in sites-available. The file only needs one server block, or two if you want http+https support. No http block, that's nginx configuration and would belong somewhere else if you needed one at all.
×

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.