Jump to content

Jack

Moderators
  • Posts

    3,777
  • Joined

  • Last visited

  • Days Won

    100

Jack last won the day on April 13 2022

Jack had the most liked content!

1 Follower

About Jack

  • Birthday 08/23/1991

Users Experience

  • Experience
    Advanced
  • Area of Expertise
    Web Developer

Profile Information

  • Gender
    Male
  • Location
    Jersey Channel Islands

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Jack's Achievements

  1. Some will refuse to work on sites they don't control because they don't know how bad the underlying site or code is. It could be built with a page builder and the efforts may not be worth it. There's also a risk that the external developers could undo your work, or could affect what you have put in place. Strategically it often makes more sense to handle everything on a single side IMO.
  2. The point in having this assigned to you as part of university is to implement it yourself. Even if someone could write it here, you would get very stuck trying to explain the code out if you were required to. Multiple journeys could be plotted as an array of objects. This could then be used to plot onto a map using the latitude and longitude of each location. [ { destination: 'Victoria', coordinates: { lat: '52.621780', lng: '-1.113930' } }, { destination: 'Oxford', coordinates: { lat: '51.514960', lng: '-0.144460' } } ] To actually plot these when you click, you need to store the coordinates so that you can query against a service like https://developers.google.com/maps/documentation/javascript/examples/directions-waypoints I highly recommend you take the time to learn JS at even a fundamental level, or you will really struggle to understand any of this. Some resources that may help are (in order): https://frontendmasters.com/bootcamp https://frontendmasters.com/workshops/js-fundamentals-to-functional/ (paid with free trial) https://javascript30.com If you go through each of these in full, you will have a significantly better understanding of Javascript and programming in general.
  3. Interesting – thanks for the detailed reply. I semi agree with the ORM thing. I defiantly have seen slow queries from them, but for getting a product to market quickly they are often the best bet for developers that don't have a lot of DB experience, like myself, although I see how this could be problematic in the future.
  4. I don't think you're a troll or spammer, I was genuinely curious, since most ORM's use this exact method. You see this in ActiveRecord, Ecto, Eloquent, Prisma and many others all the time. In fact, many will write the created_at and modified_at date for you on insert or update for this exact purpose. Persisting data from LocalStorage isn't secure, it can be modified by anyone from any domain. It's fine for locking content, showing and hiding UI etc, but the data should be seen as untrustworthy. None of your examples look slow to me either. They are broken in what they return, that's true, but the timer seems to be instant, unless I'm missing something? As I said before, you don't need to filter using SQL anyway, this can be handled server-side at the application level. We don't know what OP is trying to do, but for others that stumble across the same thread in Google looking for an answer, it's worth explaining that this method isn't viable in some cases, since most user sessions aren't 5 mins in duration. As i mentioned, for locking content with absolutely no data persistence, go ahead and use LocalStorage and setTimeout, it will work fine. However, if OP's goal is to require that data in some way, disabling the UI and waiting for it to be written after a period of time is significantly more error prone than disabling the UI and writing instantly. No, discussions like this are worth having, and I never edit other peoples posts. You know more about databases than me as far as I can tell, which is why I asked in the first place. At the very least we have detailed the options more thoroughly as a result of this discussion anyway.
  5. This would be true if you're querying datasets that contain a large amount of data that regularly increase. Without knowing anything about the size of the data, how often writes happen, and how the database is architected, saying there's a perf issue reading a value with a WHERE clause is completely over the top. Literally every CRUD app will use WHERE to filter things like getting a user ID, and they basically never run into issues with this until they hit very high scale. The app we're talking about here might only have 10 users and barely any data, so this type of query would be nanoseconds on a modern DB server. You don't even have to filter using WHERE on the date, you can grab the last value and do the comparison server-side. OP hasn't been very clear about what they're trying to do, but if the aim is to have the data saved, the most important thing is to persist the data as soon as possible. A user can alter the app state in so many ways in a 5 min period, that can cause data to simply never be saved, or become corrupted. If you're suggesting using setTimeout and waiting 5 mins before saving, that's likely going to lead to a lot of state bugs that are tricky to replicate. You can save to localStorage, but if the user closes their session, there is no action that runs in the background to ever save that data in the DB. Even if the user comes back, you'll have to run something on the client to check, and reading from localStorage, running that process etc, would be considerably slower than a single DB read, since localStorage isn't very well optimised. The chances of running into inconsistent state bugs and timing issues is practically guaranteed. This could also potentially be a security issue depending on what you're saving as LocalStorage can be modified on the client without any checks. Again, we don't know much about what OP is actually trying to do as his question is vague. Hiding the content using LocalStorage for 5 mins would be fine just to "lock" content temporarily, but if saving is involved in some way, and the data needs to be accessed again later, I would personally write instantly and worry about perf later, if it even becomes an issue.
  6. There are quite a few ways to do this, but I would be interested to know why the data can't be persisted in the DB straight away? You can store the data and not show it using a timestamp which would remove a lot of complexity. Then you could just hide any interface with JavaScript and prevent re-submissions server-side using a check on the timestamp just in case JS is disabled. Or, you can add it to a queuing system, and have that persist the data after a period of time. Typically you would only use a queue to process intensive tasks like image processing though. Could you explain a bit more about what you're trying to do and why it has this requirement?
  7. It's hard to say what might be clearing the value. You could parse the URL token and store it as a session variable instead, then clear it when a users password is reset. That way you won't lose access if the user navigates away. Subsequent forgotten passwords should also overwrite the value in the session to the new token to prevent the system from trying to use expired tokens. Obviously you'll still need to check for token validity against your DB as well. --- https://www.php.net/manual/en/function.parse-url.php Setting: <?php if( !isset($_SESSION['pw_reset_token']) ) { $_SESSION['pw_reset_token'] = 'url value'; }; ?> Clearing: <?php unset($_SESSION['pw_reset_token']); ?>
  8. <button onClick="window.print();">Print Recipe</button> If you want to modify the appearance of the print version, you'll need to add a print stylesheet. https://www.sitepoint.com/css-printer-friendly-pages/
  9. An option is https://gumroad.com, it's designed for the type of thing you're describing but they will take a higher cut than PayPal.
  10. This really isn't a good starter project, if you don't have experience with Shopify apps and remote services then a forum post probably won't help. You can't run this within a Shopify app because you'll need to have access to a Node server on their network to run Puppeteer. Instead you would have to create a remote service of your own that takes a URL, crawls it and returns the data back to Shopify.
  11. It's really not. If you don't know how to manage a server yourself, you're going to struggle to keep things patched and operating properly. Only a few providers are really expensive, managed hosting is fairly cheap now because of the demand for it. Even then, I think they would be justified charging so much, a decent managed host does more than you think. The other options are a dedicated server, where you're responsible for everything, or shared hosting, which has never been a good option. If you go with a cloud provider, or VPS, you're also on your own in most cases.
  12. If the domain is on the new platform, then yes, you'll pay the new prices. if it's still pending transfer, or, hasn't been transferred in yet, then you will need to pay the original fee. I think some hosts prevent you from transferring if your domain is close to expiring, so you might want to do it before.
  13. Make sure the version of Joi is the same as the one used in the tutorial.
  14. WebP is for raster images, so it's a good substitute for JPG and PNG, but not for vectors. If you convert an SVG to WebP you lose all of the benefits of vectors, like being able to scale without adding weight, being able to apply colours with CSS etc.
  15. You need a function in WordPress to add support, but they work fine. Webp isn't designed to optimise vector graphics, so you need both ideally.
×
×
  • Create New...