Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. 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.
  2. That video is almost 7 years old. Maybe you can try finding something a little more recent?
  3. If you're running some kind of long-term process (and you expect it to run for a long time) then you need to disable the script timeout. That's to be expected. But you should consider whether you really want to be doing that for a script running through your web server.
  4. What menu links? I don't see anything in there that looks like a menu.
  5. If you install it then there's no need to install it a second time.
  6. So you know, titling your thread "Adult Content" is a great way to get an admin's immediate attention - and not in a good way. So I've edited in something for you that's a little more specific. What kind of problems?
  7. MongoClient was removed in mongodb 1.0.0. That was back in 2015.
  8. Whatever you found that talks about "MongoClient" is out of date. There is no such class - not anymore. https://www.php.net/manual/en/set.mongodb.php
  9. Fixed.
  10. It seems to be working, and the invite code isn't set to expire at all. Is there maybe something else going on? I see someone named @rain in there. Would that happen to be you?
  11. 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.
  12. Actually what it's telling you is that \1 in a double-quoted string does something special...
  13. Can't be abstract anymore. What kind of resources and what sorts of ways of controlling access do you need for them?
  14. I think I might have guessed right regarding an access policy. How much "customization" does each resource need regarding its access? I would assume not much, and that they all typically pick from a small handful of possibilities. If so then you have access policies, a resource uses an access policy, every user has something to consume policies in a similar design, then you manage access through those secondary objects. user <-> permission policy <-> access policy <-> resource The principle here is that a resource does not try to decide how and where it can be used - it has a policy which manages that. And a user doesn't decide how and what it can use - it has permissions that decide. Consider a roller coaster ride. They'll have a sign saying "you must be this tall to ride" and a person who enforces that; the roller coaster is the resource and the sign is the access policy. When someone wants to ride, they present themselves; they are a user and their permissions are their physical appearance (ie. height). The person who enforces the height requirement would then be the code used to implement the system - someone who understands the access policy, the permissions, and how to evaluate the two together.
  15. I mean, I guess composition makes sense here? I wouldn't think a resource "is a" access control, but it certainly could "use a" access control. But depending what "access control" is, I'm wondering if maybe what you need is an intermediate "access policy"?
  16. URL rewriting does not affect what happens in <a> links. You have to write those with the URLs you want. <a href="/detail/4">
  17. [ ] is shorthand for array( ) so the thing at the top is an array. Which is good because arrays are easier to create than objects. You can use that syntax for your own arrays if you want, or if it helps you can edit the sample to use "array("s instead. Look at how the array structure you need is set up: 1. line_items is an array of items 2. Inside the array is another array 3. That inner array has a price_data and a quantity 4. The price_data is an array with a currency, product_data, and unit_amount 5. product_data is yet another array with a name and description To mirror that, 1. Create a $line_items array 2. Put inside it more arrays, which you'll be getting from your database 3. Each item has an array - let's call it $line_item - with price_data and a quantity. You already know the quantity. 4. There's only the one price_data, so you could use a variable or you could put it directly inside your $line_item, and it has currency (presumably always "USD") and unit_amount (the price per item) and the product_data 5. There's also just the one product_data, and it has a name (which looks like a sku) and a description (which is obvious)
  18. In no particular order, and not restricting my commentary to just OOP issues or your question of compactness, - Inheritance represents an "is a" relationship. When you say "class X extends Y" then that means "X is a Y". It seems like Dbh is a database connection class. Would you say that Products "is a" database connection? I would not. - PHP supports types for function arguments and return values. Use them. Types on class properties are generally a good idea too but they come with some nuances to consider. - I don't think "price", "weight", "height", "length", or "width" are strings. - It seems ridiculous that everything with a weight must be a book, or everything with a size is a DVD, or everything with a height is a fur. - Your methods to get a book/DVD/fur have nothing to do with Products. You don't use the Products class for anything besides as a place to put these methods. - Catching exceptions and then returning their error messages is... not good. If you are not going to actually handle the exception then do not use try/catch at all. - You have interfaces and traits but aren't using them. - If your Product's sku, name, and price are private and you don't provide any setter methods then how are those going to get values? - It might make sense considering the weight/size/height problem, but since multiple traits cannot redefine the same method, your Withsize and WithWeight traits are mutually exclusive. - What you're doing when you call the setter methods is not correct. Having gone through that, I would say that you're not at the point where "compactness" should be a concern. In fact, compactness is almost never a thing that should be concerned at all. Focus more on whether your designs and architectures make logical sense: if they do then you will have compact code.
  19. Your code does not make sense. The price in your <select> has nothing to do with YouTube or Facebook. You also seem to have no idea how getElementById works or what window.location.assign does. And the markup with the <option>s is confusing. You need to learn about things before you can use them. <form id="abc"> <select name="foo"> <option value="bar" selected>Bar</option> </select> </form> <script> alert(document.getElementById("abc").elements["foo"].value); </script>
  20. If you're having a hard time asking a question then post your code.
  21. Since your example does not make sense, I'm going to guess you don't actually want to do this and just need something to demonstrate your question. The most obvious option here would be to change the target of the link when you change the value of the SELECT: give the button an ID and modify its HREF. <a id="buynow" class="btn-main" href="#">Buy Now</a> document.getElementById("buynow").href = "https://www.youtube.com"; Another option is to use the change_price() function to literally browse to that URL, using window.location. window.location.assign("https://www.youtube.com");
  22. But why the second page? The first page, with the search, should be able to do just that. It doesn't now because it's broken - like I mentioned. Try using your form but only searching by faculty...
  23. If you want to use Laravel for something then you install just laravel/laravel and Composer will get the other dependencies - unless it can't reach GitHub in which case yes, you have to download all of those separately, and then download all of their dependencies, and so on. That is not going to be fun. And what about mpdf?
  24. Your search is broken. You want this second page to do what, exactly? You're already showing information for searched things: it's your search page.
  25. Composer needs to do other work besides just download from GitHub. If you can download it yourself manually then you should be able to put it on your computer somewhere and tell Composer to read from it instead of GitHub. I forget the exact method but I believe you put a custom "repository" in your composer.json.
×
×
  • 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.