Jump to content

requinix

Administrators
  • Posts

    15,066
  • Joined

  • Last visited

  • Days Won

    414

Community Answers

  1. requinix's post in [cakephp] Database driver Cake\Database\Driver\Mysql cannot be used due to a missing PHP extension or unmet dependency. Requested by connection "default" was marked as the answer   
    It would appear that the driver cannot be used due to a missing PHP extension or unmet dependency.
    Do you have the pdo and pdo_mysql extensions installed?
  2. requinix's post in Fulltext searching was marked as the answer   
    FULLTEXT searching just does not do that. It doesn't offer particularly sophisticated features: it's oriented towards taking an input list of words and trying to find things that are relevant to those list of words.
    "M/C" isn't going to work because those aren't words. Prices aren't going to work because those aren't words. "Within 10 words of each other" isn't an option.
  3. requinix's post in Upgrade website from 7.3 to 8 was marked as the answer   
    Sure: upgrade to PHP 8 and see what it complains about. Not on the real site, of course, but in some development version of it. That's really the most effective method.
    I don't know what "tags" are, but the online documentation has migration guides.
    Go through each guide in sequence; if you want to upgrade to latest, which is 8.2, then you need the 7.3->7.4 and 7.4->8.0 and 8.0->8.1 and 8.1->8.2 guides.
  4. requinix's post in Subracting a number from decimal value in mysql was marked as the answer   
    DECIMAL(65,0) means it can store a number with 65 digits and 0 after the decimal point.
  5. requinix's post in Structure for Small Custom System was marked as the answer   
    You already know the answer to that: some point before you end up with 116 functions in a 2600+ line file.
    As for where "before" is, that's tricky. Because despite what many others will say, sometimes having complicated things contained in one single place makes them easier to understand than if they had their components spread out across multiple locations - but having that as an exception to the rule also lends itself to being an excuse to ignore the rule.
    The simplest approach is what I hinted at: separate by category, or purpose. With 116 functions there are going to be a much smaller number, perhaps a dozen, of groupings. Like notes functions, and activity functions. Even if you only had one "createNote" note function, the fact that it's a different subject matter than activities warrants having it in its own place.
    The other answer is that good code design won't let you create massive utility classes to begin with - no offense. Following principles like SOLID (its "single-responsibility principle" is what that whole categorization thing is essentially about) or DRY will naturally encourage you to break things up as a side-effect.
  6. requinix's post in Why does directory listing wih array_push gives warning "the first argument is not an array" ? was marked as the answer   
    The second argument to array_push is the item you want to push. It is not an array of items you want to append. So that's a problem, though a bit separate from what you're looking at now.
    How about the return value?
  7. requinix's post in How to reflect the ball at an angle? was marked as the answer   
    You don't need physics - just a simple if/else. Assuming you're talking about vertical and horizontal walls (like those of the containing box).
    Give it a thought yourself and you'll probably find it's easier than you expect. You're already calculating the ball's "angle" using X,Y components so consider what happens to them if you have, say, a velocity {x=1, y=2} at the time when the ball encounters a horizontal wall...
  8. requinix's post in Ratings in database ala Amazon. How many of each? was marked as the answer   
    Does it have to be in your results? It would be really easy to just write a tiny bit of code that uses 0 if there aren't any ratings of a particular star count.
  9. requinix's post in Smarty template & PHP 8.1, TEXT: Function strftime() is deprecated was marked as the answer   
    Huh, it's actually doing the thing I thought it wasn't...
    Only thing left I can think of would be skipping E_DEPRECATED messages.
    set_error_handler("error_handler", E_ALL & ~E_DEPRECATED);  
  10. requinix's post in need help to figure something was marked as the answer   
    I'll give this one more try:
    1. I've already mentioned that include() will return a boolean. Specifically, true if it was able to include the file and false if it was not.
    2. You are using <?= tags instead of regular <?php. Remind yourself of what the special <?= form does.
    Do you know what happens when you combine those two together?
  11. requinix's post in JS Front End was marked as the answer   
    "Best practices" only apply to very specific questions. There is no single answer to "how do I make a login page" but there are a couple for "how do I handle password resetting".
    If you're looking to learn frontend Javascript then the most common answer is React, but there are also others like Vue and Angular that have a following.
  12. requinix's post in PHP 8.1 Showing Warnings was marked as the answer   
    You have code that ends up doing something like this:
    $variable = false; echo $variable->current; That is wrong and broken. It needs to be fixed, and making the warnings go away does not do that.
  13. requinix's post in category_page restriction was marked as the answer   
    Looks good to me.
    There are a few online tools to help build and test regular expressions, like if you want to try running a few inputs through the regex to see if they match. regex101.com and regextester.com come to mind.
    A router takes a request and routes it to a different location or resource or code path. That sounds like what you're doing.
  14. requinix's post in Bring navbar at center CSS was marked as the answer   
    So I guess you figured it out?
  15. requinix's post in issue with a update query not updating was marked as the answer   
    I'm not talking about a column in a table. I'm talking about the PHP variable you have there called $voucher_code_in_transaction. Where is the line of PHP code that declares that variable?
  16. requinix's post in Difference between an instance variable inside the class and one outside the class..? was marked as the answer   
    Forums are way better than StackOverflow for anything but the most trivial and straight-forward of questions. Forget trying to discuss anything on SO...
     
    Yes: the first one allows one and only one instance of the class, while the second allows anyone to create as many as they want.
    Which also means the first one's constructor should be private. Public could be okay but that means two paradigms for the class and that's one too many.
  17. requinix's post in best forum site out there so far, i would like to see a tutorials section appear was marked as the answer   
    But what's to prevent us from having the same "deprecated stuff" problem in a couple years? What could we do to make the tutorial concept actually successful?
    I'm not just making these questions up: I worked on a site that had the exact same idea, and we even got some people to write a few, but writing them is hard so nobody wanted to keep making more and soon the ones that had been made previously fell out of date.
    It's a great idea on paper. It's a difficult idea in practice.
  18. requinix's post in Reading binary (data structures) files help was marked as the answer   
    The one helpful part missing from your post is stating what the correct values are supposed to be. Because e484d857-00b7-4107-a58a-36ff29f6a3a5 looks like a correct GUID to me.
    Typically, though, one deals with binary file data by reading an entire "block" of stuff at once and then unpacking it.
    $data = fread($handle, 52); print_r(unpack("C4header/vversion/vlicense/v2flags/Vnames/Vnameoffset/Vfiles/Vfileoffset/Vtypes/Vtypeoffset/C16guid", $data)); Array ( [header1] => 193 [header2] => 131 [header3] => 42 [header4] => 158 [version] => 127 [license] => 29 [flags1] => 33 [flags2] => 0 [names] => 31 [nameoffset] => 72 [files] => 7 [fileoffset] => 753 [types] => 6 [typeoffset] => 711 [guid1] => 228 [guid2] => 132 [guid3] => 216 [guid4] => 87 [guid5] => 0 [guid6] => 183 [guid7] => 65 [guid8] => 7 [guid9] => 165 [guid10] => 138 [guid11] => 54 [guid12] => 255 [guid13] => 41 [guid14] => 246 [guid15] => 163 [guid16] => 165 )  
  19. requinix's post in How can you generate a sysid with PHP? was marked as the answer   
    I know an application with lots of database tables. Each record has a blargh identifier that is unique across all blarghs in the world. Do you think they're the same as sysids?
    I can't tell you how to create a "sysid". I can tell you about things like UUIDs.
  20. requinix's post in Discord Link was marked as the answer   
    Fixed.
  21. requinix's post in php install question was marked as the answer   
    Does Flywheel also have its own web server? Probably does.
    "Correct" is highly subjective. If you want to run both at once then all you actually need to do is make them run on different ports, say 8000 for one of them and 8001 for the other.
  22. requinix's post in Call function/PHP reload every 5 seconds was marked as the answer   
    Any errors in the browser console? Can you see in the developer console the browser making a network request to shipline.php?
  23. requinix's post in SAML SSO php7 app vs Microsoft app eg Teams was marked as the answer   
    Single sign-on means one place that you use to log in. It does not necessarily mean that you use it to sign in once and then nothing has to ask for your account again. In fact it shouldn't: the place with your account should be asking you each time whether you want to allow $app access to your account.
    If you coded the account stuff yourself and you're being asked multiple times then it means your app is not remembering you. If you wanted, you could have it remember you (like with a cookie) so that next time all you'd need to do is click a button to allow access.
    One way or another, you really should make sure that you have to click a button or do something - don't make the authentication completely automatic when a different app wants you to sign in. For example, in addition to remembering you, your site can also remember which apps you've allowed access to: if the same app wants access then that could be automatic, but if a different app wants access then your site should tell you first.
  24. requinix's post in Manage behaviour when comparing values. was marked as the answer   
    The general term is "CAPTCHA". Google's reCAPTCHA and whatever the non-Google alternative is, are the de-facto standards. It takes a little more work to implement but they're effective and reliable.
  25. requinix's post in Implications of final classes and final constants was marked as the answer   
    private + final doesn't make sense: if it's private then nothing can override it anyway. Just make it private.
×
×
  • 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.