Jump to content

requinix

Administrators
  • Content Count

    10,917
  • Joined

  • Last visited

  • Days Won

    199

Everything posted by requinix

  1. If by "clean up" you mean start from scratch then delete everything. If by "clean up" you mean something that only you know, then
  2. For crying out loud dilbert, Do you want to use a USB stick or do you want to use a CD/DVD?
  3. requinix

    Order of dependency injection

    Yes, but now you're changing the nature of the object. Cantonese as a language is not the same thing as a Cantonese "communicator". If WalkieTalkie was responsible for making sure information being sent was in the right language, it would need to know a language "protocol". That would be Cantonese. So you would inject Cantonese into the WalkieTalkie. class WalkieTalkie { public function __construct(Language $lang) { $this->lang = $lang; } } new WalkieTalkie(new Cantonese()); If you have a CantoneseCommunicator, you would be specifically coupling Cantonese the language with whatever device. class CantoneseCommunicator { public function __construct(Communicator $comm) { $this->lang = new Cantonese(); $this->comm = $comm; } } new CantoneseCommunicator(new WalkieTalkie()); The best approach would be to inject the language and the communicator. class LanguageCommunicator { public function __construct(Communicator $comm, Language $lang) { $this->comm = $comm; $this->lang = $lang; } } new LanguageCommunicator(new WalkieTalkie(), new Cantonese());
  4. requinix

    <th> properties via css

    Specificity only applies to the elements targeted by rules. If you put the text-align on the TR then that is separate from the text-align on the TD. But that's not quite the issue here. Aligning the row works because the cells were set to inherit their alignment from their parents. As in text-align:inherit. That's what actually matters. When you gave your text-align:center you removed the inheritance altogether.
  5. 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.
  6. 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.
  7. 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?
  8. 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.
  9. 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>
  10. 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.
  11. 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.
  12. 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.
  13. You won't get the semicolons but it sure looks like that does what you want. Did you perhaps try it?
  14. 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.
  15. 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?
  16. 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?
  17. 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.
  18. 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.
  19. Merged. One question, one thread. I'll ask again: what do you mean by "combine", and why is the number of rows a problem?
  20. 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).
  21. 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.
  22. "Combine"? And why would the number of rows make a difference?
  23. requinix

    Log in system the right way?

    The session cookie is an access token. Think about it.
  24. 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.
  25. 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.
×

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.