Jump to content

DeX

Members
  • Posts

    258
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Calgary, Alberta
  • Age
    37

DeX's Achievements

Advanced Member

Advanced Member (4/5)

1

Reputation

3

Community Answers

  1. I'm not sure if I phrased that question properly but I'll give an example: I have a User class and I have a Car class. I have users on a website and they own cars. So if I want to get all users from the database, I use the User class to do that fetch and the same if I want to get all cars from the database. My question is when I want to get all cars owned by a specific person. Should I do something this? $user = new User(123); $carsOwnedByUser = $user->getCars(); Or should I do something like this? $carsOwnedByUser = \CarNameSpace\getCars(123); In the first one I have a function in the User class to get all of their cars and in the second one I have a function in the Car class that gets cars when you pass in a user ID. Is one more proper than the other? Each one will return an array of Car objects. Thanks a lot.
  2. I have models for all of my database objects. For instance, I have a User class and in that class I have functions like so: getFirstName() getLastName() getAddress() And of course I have setters for each as well. My question is whether I should also have some helper functions inside this model for something like getFullName() which will return a concatenation of getFirstName() and getLastName() or if we should simply concatenate the data every time we want to display it on each page. So we will be displaying the user's name on the top of each page, in their account profile and maybe some other places of this portal type system. Is it proper object oriented programming to use helper functions like this? Should they go into the controller? Should we create separate logic namespaces for each model to control this logic? Another example would be if I wanted to get the most recent user that signed up, where would this function go? In the user model? In the controller? Thanks.
  3. Sorry, I should have included that. We will be running reports based on which quotes have certain criteria: - how many are over a certain length - how many have item X selected - how many of item X we sold These are all based on user entered inputs and wrapped up in the JSON. The reports are generated whenever anyone loads the reports page to view them, they're not done on a schedule like nightly.
  4. The inputs are related to quotes being sent to customers so often times a customer will want to modify their quote, in which case the user will open an old one, load all of the input values from the database and change some, only to re-save it with the new inputs. The re-save does not modify the old table row, it simply creates a new row under the same account.
  5. I have a system where users enter about 100 inputs, not all are required. We capture every input when the user clicks save and they have the ability to look back at any save they have and edit the inputs to re-save. Currently we serialize the inputs, wrap it up in a JSON string and save it into a column in the MySQL table. I'm wondering if there would be a speed / storage advantage to specifying a column for each input and storing each value in its own column. If you're wondering how often the inputs change, it's infrequent. We might add / remove / modify about 20 inputs a year, probably fewer. If you're wondering how often saves are done, it's about 8 users doing 40 saves each, per day.
  6. Every item has a corresponding quantity calculation that's input manually by the developer, this calculation never changes. Then when a final price for the building is needed, it does the following: - get all product ID from the database - loop through all product ID quantity calculations and multiply this quantity by the price in the database (price updated once a month) - adding all these totals together and multiplying by a markup percentage gives us our final price Is that all you needed?
  7. There are only 400 items total in the products table, plus however many of these items there are.
  8. I have a Bill Of Materials (BOM) and we buy a building product from a third party supplier that custom makes them for us. They charge us a certain price based on these factors of the product: - width of building (in static increments: 24, 30, 36, 42, 44, 50...) - building type it's being used in (each type requires certain design specifications to meet code requirements) - snow load (depending on where in the country the building will be, we need to make it more durable if there will be a higher snow load on the building) Based on all of these, they build the product for us and charge us accordingly. I'm wondering if I need to have 400 items in my BOM to account for each combination of length, building type and snow load for this one product. Is this normal practice? The price differences don't have a pattern and don't overlap in any way, it's random pricing set for each combination. It's not like the price goes up $30 for each length, the pricing gaps are all different for each setting.
  9. Never mind. I was trying to run the script on the wrong server, it appears it was working the whole time on the proper server.
  10. bitnami@ip-172-26-***.***:~$ echo "subjectt" | sudo -u daemon mail -s "bodyy" d*****@******.com /home/bitnami/Maildir/sent: Permission denied Failed to save message in "/home/bitnami/Maildir/sent" - message not sent
  11. Is this correct? Daemon is the web user for Bitnami Apache. bitnami@ip-172-26-***-***:~$ sudo -u daemon echo "subjectt" | mail -s "bodyy" d*****@*****.com
  12. How can I do that if the command is being run through PHP and Apache?
  13. I just set up my first mail server ever using Postfix and when I run echo testing | mail -s subjecttttt da***@*********.com it sends fine and I receive the email at that address. The problem is when I create a php page on the server and write mail("da***@*****.com", "test", "test"); then run the page in my browser, it doesn't send the email. From what I read online, it's because the root user on the command line has permissions to send mail while the www-data user in the browser does not. Is there a way I can specify which user Postfix uses? Any other suggestions? Thanks a lot.
  14. I actually figured it out after 3 weeks of frustration. I disabled a NAT policy on my firewall for outbound requests and it solved everything. The script works great now and I can ping without issue.
×
×
  • 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.