|
nielsm posted:To display a map with your own overlay, you can look into OpenStreetMap. Edit: Basically unless you want to use google maps or mapbox, you should probably start by using leaflet, openlayers, or MapLibre with a tile provider (I think a bunch of them have free tiers), and then you can always switch between them or try to self host the tiles later. It's getting easier to self host the tiles so even if you don't want to that now it may be completely trivial soon and if you're using one of those map libraries it should be easy to switch whenever you want to. mystes fucked around with this message at 21:29 on Apr 5, 2024 |
# ? Apr 5, 2024 21:17 |
|
|
# ? Jun 5, 2024 04:17 |
|
CitizenKeen posted:
I wouldn't rush to swap to Vue, you can do a lot with simple HTML + HTMX with a little JavaScript. I've built a large ecom platform and we are removing all of our React and moving to more static file approach with HTMX. The performance increase in rendering is probably 100x.
|
# ? Apr 7, 2024 13:24 |
|
Funking Giblet posted:I wouldn't rush to swap to Vue, you can do a lot with simple HTML + HTMX with a little JavaScript. I've built a large ecom platform and we are removing all of our React and moving to more static file approach with HTMX. The performance increase in rendering is probably 100x. I did not keep up with the Javascript/Web stuff that much, but from what I've seen from HTMX it looks pretty elegant.
|
# ? Apr 14, 2024 18:58 |
|
If you already want to render everything on the server but then do progressive enhancement primarily through dynamically loading html fragments rather than reloading the whole page, like what used to be common, htmx is a very good option in 2024 for doing that without having to manually write any javascript, but imo it's not necessarily as novel or exciting as some people are making it out to be. I don't think it's helpful to even think of it as "vue" vs "htmx" as competing frameworks or something. The first question is whether you want to write something as an SPA / render stuff on the client (but maybe add back server rending using something like next.js for SEO or performance) or use traditional server rendering, and if you choose the latter, htmx may be useful. I do think that some of the htmx hype is because people who don't know what the web was like 20 years ago and are only used to stuff like react or vue are looking at traditional server rendering for the first time and only seeing the ways it seems to be simpler than having a separate frontend making api calls, but maybe not seeing the other ways that approach can actually be more complicated (e.g. having to have a bunch of view state temporarily stored on the server for each session when you're doing anything remotely complicated). But that's not to say that it's a bad approach either; it worked for a really long time and it can still work perfectly fine in 2024. mystes fucked around with this message at 19:20 on Apr 14, 2024 |
# ? Apr 14, 2024 19:09 |
|
Responses: Sorry, still looping this thread into my "check up on". My bad. Yeah, the page is mostly just data retrieval, with one huge form. That form might be better as an SPA, but I don't think it's worth turning the whole page into an SPA. I get a lot of positive feedback on how thin the site is, so I think I made the right call. I am running into a problem though, and I have no idea where to begin solving it. This is mostly devops, stuff, though - if there's a better thread, I apologize. I think I'm running into some scaling problems. I've gone from 1,000 users in February to 24,000 now, so it's been a bit wild. I'm seeing these spikes in my processor and my users are reporting intermittent 502s... https://imgur.com/a/gd3Z3W6 I have no idea how to debug that or where to begin. I'm running a .Net 7 Razor pages app on a Digital Ocean server with Postgres. That's about it, pretty bog standard. I've made a few small changes to the nginx config based on googling to increase some cache buffer sizes, but otherwise it's mostly out of the box. No cron jobs, no scheduled recurring processes. Just Entity Framework queries and a few views for intensive reads. (I'm also running a Discord bot using DSharpPlus, but that's mostly a wrapper around two commands which pull some basic static info from my site.) I don't know if Postgres was the right choice - it was free and its syntax matches SQL Server which I'm used to at work - because my understanding is that it's optimized for writes instead of reads and my site is pretty read heavy. I'm kind of lost on how to start tracking down why my server's CPU just starts running away. (It's an 8 gig / 4 Intel basic CPU box on Digital Ocean). I can afford to double those resources if I'm just running into resource limits, but I'm concerned it'll be like urban traffic and just swell to fill whatever new stuff I provision. Any thoughts on where to start investigating this? Please and thank you.
|
# ? Apr 22, 2024 19:08 |
|
can you set up your hosting thing to capture a process dump if cpu spikes above 90% or something like that? we've done that with our azure thing in the past, but no idea what sort of tooling digital ocean offers in that regard can you correlate request count or duration with the spikes? could there be users with an unusually large number of somethings? example: at a previous job we had strange intermittent perf problems that ultimately arose from a bot who had added thousands of items to its cart (normal number of items would have been less than 20 or something like that)
|
# ? Apr 23, 2024 07:52 |
|
redleader posted:can you set up your hosting thing to capture a process dump if cpu spikes above 90% or something like that? we've done that with our azure thing in the past, but no idea what sort of tooling digital ocean offers in that regard So the site is hosted on a DigitalOcean VM, so I have pretty hefty ability to add what I want to it, but it's just a hosted Linux box so I don't have true god mode. The problem is, I don't know what kind of tooling or tracing or anything I should be pursuing. I started this project to learn some industry practices that my management team doesn't value enough, but this scaled faster than I expected. All I've got in place is Serilog. I have a search syntax DSL where users can write very simple queries against the data; I'm wondering if I left some infinite regression in there or something. I'm going to have Serilog write out all queries to a separate log file so I can look over what kind of queries people are writing. Right now, the things I need to learn are:
I also need to set up a staging environment; that would probably alleviate some of my stress.
|
# ? Apr 23, 2024 16:23 |
You evaluate your code in production by instrumenting it with logging that captures data that can help answer your questions, without interrupting the normal request handling. What data your need to capture depends on the application. For example, capture the total request times (request received until response ready to be sent) together with some category of the requests, so you can measure whether you have outliers where some requests take unusually long time compared to other requests of the same type, or if the request processing time increases when the service is busy. Depending on the nature of the data you process, you can also try capturing request series and replay them in a testing environment, where you can more heavily instrument things. Figuring out whether it's worth optimizing your program more, or throw more hardware at it, is not a science. It's just as much a business tradeoff: What's more expensive, your development time, or your increased hosting bill? It's probably always a good idea to try to identity the cause of slowness, to decide if it's something you can reasonably improve on or not, and whether it's something that could prevent scaling to faster/wider hardware.
|
|
# ? Apr 23, 2024 16:51 |
|
nielsm posted:You evaluate your code in production by instrumenting it with logging that captures data that can help answer your questions, without interrupting the normal request handling. What data your need to capture depends on the application. Is that something I can do with Serilog, or is that a separate kind of logging?
|
# ? Apr 23, 2024 17:05 |
CitizenKeen posted:Is that something I can do with Serilog, or is that a separate kind of logging? Probably? The main thing is to make sure you can retrieve the logged data so you can graph or analyze it in a useful way. You also need to make sure the instrumentation logging doesn't drown out other operational or error logging, perhaps by logging them to separate streams/files/tables. If you need to do instrumentation that captures lots of data, it might be better to make a database table/whatever specifically for that data, so you have it structured, efficiently packed, and indexed.
|
|
# ? Apr 23, 2024 17:16 |
|
If you think the issue is with the user written queries to the database, you could enable some query logging for queries that are taking over a set amount of time. I'm pretty sure PGSQL has some settings to enable and capture this. Might be another option to help you figure out what's going wrong.
|
# ? Apr 23, 2024 17:22 |
|
Rawrbomb posted:If you think the issue is with the user written queries to the database, you could enable some query logging for queries that are taking over a set amount of time. I'm pretty sure PGSQL has some settings to enable and capture this. Might be another option to help you figure out what's going wrong. Oh yeah, that's probably a good idea; I'll investigate what PGSQL has. Then I'll have to parse backwards from the SQL that Postgres is running to the EntityFramework it's generating - that might be a mess, but it's my mess.
|
# ? Apr 23, 2024 18:56 |
|
You can also configure entity framework to log all of its sql queries. https://learn.microsoft.com/en-us/ef/core/logging-events-diagnostics/
|
# ? Apr 23, 2024 20:11 |
|
CitizenKeen posted:Oh yeah, that's probably a good idea; I'll investigate what PGSQL has. Then I'll have to parse backwards from the SQL that Postgres is running to the EntityFramework it's generating - that might be a mess, but it's my mess. you can use IQueryable<T>.TagWith to make it way easier to track sql back to the EF that it came from
|
# ? Apr 25, 2024 10:22 |
|
redleader posted:you can use IQueryable<T>.TagWith to make it way easier to track sql back to the EF that it came from It sounds like it's not applicable in this case, but just a heads up that this uses SQL comments to do the tagging, which means some managed SQL services won't show it because the comments get stripped out along the way (e.g. Azure SQL's query explorer/monitoring). You can replicate this manually via adding bogus checks (like WHERE 5=5) to your statements, but it's a pain to do with EF even for individual queries.
|
# ? Apr 25, 2024 12:01 |
|
I've got a mobile app to rewrite at work and a really generous deadline, so I figured I'd take time and play with all the new toys, see what they're like. So I made a MAUI/Blazor hybrid app, and... this is a website. This is a literal, css-using, wwwroot-folder-having, website. They've somehow tricked it into running as a desktop or mobile app, but the code itself is pure website. And I get what Microsoft is going for, right? If they can unify every design case into "just write it in this one language, we'll compile it appropriately for you", everyone's life gets appreciably easier. But it's been a loving decade since I did web development in any major capacity and it's a bit annoying that we've taken in all of web design's weaknesses too and jettisoned strengths of coding for apps, so now the codebehind just plain can't see anything you put on the razor pages, hope you didn't need sender in any of your event args. Is it known to what degree this is gonna be the way things go in the future? Like, if Microsoft intends to continue the pressure to turn everything into a Blazor app, okay, gently caress it, I'll start learning web design. But if it's not, I... kinda don't want to.
|
# ? Apr 25, 2024 18:34 |
|
It does seem to be the way the world is going, with electron apps, react native, and all that good stuff. No one wants to learn how to write native apps for both iOS and Android and maintain the two code bases. Unless you have a career entirely in stuff that doesn't use the web, you should probably learn some web design. That said though, I doubt that Maui/Blazor is 'the' future. Blazor maybe, at least for non-tech companies it is very popular, but Maui really isn't good yet, and they don't have many people working on it. Doesn't seem like a big priority for them.
|
# ? Apr 25, 2024 19:32 |
|
ChocolatePancake posted:That said though, I doubt that Maui/Blazor is 'the' future. Blazor maybe, at least for non-tech companies it is very popular, but Maui really isn't good yet, and they don't have many people working on it. Doesn't seem like a big priority for them.
|
# ? Apr 25, 2024 19:38 |
|
CapnAndy posted:I've got a mobile app to rewrite at work and a really generous deadline, so I figured I'd take time and play with all the new toys, see what they're like. So I made a MAUI/Blazor hybrid app, and... this is a website. This is a literal, css-using, wwwroot-folder-having, website. They've somehow tricked it into running as a desktop or mobile app, but the code itself is pure website. That's not to say I think MAUI is good or anything but the whole idea of hybrid apps is to use MAUI to do something like Cordova for blazor apps but within the MAUI / .net ecosystem and within that context the idea probably more or less makes sense. mystes fucked around with this message at 19:47 on Apr 25, 2024 |
# ? Apr 25, 2024 19:44 |
|
CapnAndy posted:I've got a mobile app to rewrite at work and a really generous deadline, so I figured I'd take time and play with all the new toys, see what they're like. So I made a MAUI/Blazor hybrid app, and... this is a website. This is a literal, css-using, wwwroot-folder-having, website. They've somehow tricked it into running as a desktop or mobile app, but the code itself is pure website. I'd love to know where y'all land, I'm in a similar situation at work. EOL Xamarin App, and looking to move to something else.
|
# ? Apr 25, 2024 19:52 |
|
mystes posted:You can also just use MAUI. Hybrid apps are specifically for when you want to use MAUI to present a webview control for your blazor app
|
# ? Apr 25, 2024 20:00 |
|
CapnAndy posted:Yeah, I know. I'm specifically wondering if I should do a hybrid app because it's likely that Microsoft will put more pressure on in the future to turn everything into Blazor -- because, like I said, I can see the benefit of literally everything being one codebase and they'll just compile it differently for us. If they're gonna, I'll go with it, but if they're not gonna, I really don't want to.
|
# ? Apr 25, 2024 20:06 |
|
CapnAndy posted:Yeah, I know. I'm specifically wondering if I should do a hybrid app because it's likely that Microsoft will put more pressure on in the future to turn everything into Blazor -- because, like I said, I can see the benefit of literally everything being one codebase and they'll just compile it differently for us. If they're gonna, I'll go with it, but if they're not gonna, I really don't want to. I hate writing web apps and wish I could write native apps, but it seems like the world is moving to hybrid/web type apps. The economics are just too good. You can have a single team write an app that works on android iOS, macOS, Linux, and windows. You just can't beat that with native apps. You need a team or developer for each platform. The suits just aren't gonna pay for that. Even if the result is a shittier experience. People will get over it. poo poo sucks yo.
|
# ? Apr 25, 2024 20:14 |
|
If your old app is Xamarin I think upgrading it to Maui is the easiest path forward for sure. Otherwise anything else you are looking at basically a total rewrite.
|
# ? Apr 25, 2024 20:53 |
|
Oh, we're doing Maui no question. I'm just looking ahead. Basically, if in five years Microsoft is gonna go "okay, everyone start using Blazor or whatever web language we've replaced it with for everything", I want to have spent those five years getting good at web development.
|
# ? Apr 25, 2024 23:27 |
|
Jen heir rick posted:I hate writing web apps and wish I could write native apps, but it seems like the world is moving to hybrid/web type apps. The economics are just too good. You can have a single team write an app that works on android iOS, macOS, Linux, and windows. You just can't beat that with native apps. You need a team or developer for each platform. The suits just aren't gonna pay for that. Even if the result is a shittier experience. People will get over it. poo poo sucks yo. This is a big reason I'm into proprietary tooling. gently caress that web bullshit. Build in WPF.
|
# ? Apr 26, 2024 06:53 |
|
I have a question about async/await. What's the difference between these two programs? They both compile and run and print 42. In the first example, it's async/await "all the way down", and is how I thought things needed to be. This is the complaint/observation that when working with an entirely synchronous legacy app, when you need to call a BlahAsync method, it will infect all callers up the chain. In the second example, just the last method in the chain is async Task<int>, and the intermediate methods (in this case just Apple but there could be more) are just Task<int>. For some reason I thought I'd get a Task returned from Apple, from which I'd need to extract the result. C# code:
C# code:
|
# ? Apr 26, 2024 18:32 |
|
epswing posted:For some reason I thought I'd get a Task returned from Apple, from which I'd need to extract the result. epswing posted:They both compile and run and print 42. code:
|
# ? Apr 26, 2024 18:51 |
|
Oops. Ok, so I'm playing around in LINQpad8 and it must be doing some magic, enough for me to question my entire existence as a developer for a few minutes there. Glad to hear I'm not crazy, this time.
|
# ? Apr 26, 2024 19:22 |
|
epswing posted:Oops. Ok, so I'm playing around in LINQpad8 and it must be doing some magic, enough for me to question my entire existence as a developer for a few minutes there. Glad to hear I'm not crazy, this time. Huh, I wonder what LINQPad is doing behind the scenes, visual studio reports the expected output
|
# ? Apr 26, 2024 19:27 |
|
epswing posted:Oops. Ok, so I'm playing around in LINQpad8 and it must be doing some magic, enough for me to question my entire existence as a developer for a few minutes there. Glad to hear I'm not crazy, this time. Edit: It seems like linqpad overrides Console.WriteLine with a more magical one that does stuff like this. I guess that's useful but also potentially confusing as in cases like this. mystes fucked around with this message at 19:35 on Apr 26, 2024 |
# ? Apr 26, 2024 19:27 |
|
Yeah, LINQPad has its own Console.WriteLine because one of the 'selling points' of LINQPad is that it has a rich output display. It can expand arrays, introspect into objects, show images, syntax highlight JSON, etc.
|
# ? Apr 27, 2024 13:06 |
|
I'm developing an ASP .NET Core Web API for a side project, and was just wondering, what kind of permissions system do I need so users are members of different organizations? I'd like to use Azure B2C. For example, Org 1 has users A, B, C, and Org 2 has D, E, F. When user A accesses the /products endpoint, they would only see products added by their organization.
|
# ? Apr 30, 2024 00:14 |
|
Sounds like you want to implement multi-tenancy
|
# ? Apr 30, 2024 00:26 |
|
Yep, multi tenant is what you want. I typically set up a separate subdomain for each tenant to make it easier on myself. So for example users from A would go to a.example.com. If you're using 1 database for all the tenants, and using entity framework, then I would recommend setting up a global query filter so that the organization data filtering is done automatically. This will go a long way to make sure A never sees data from B and vice versa.
|
# ? Apr 30, 2024 03:37 |
|
tip: no matter how you decide to implement multitenancy, you will regret your decision and look fondly upon alternate implementations fwiw i'd lean towards a db per tenant, instead of one big db for all tenants (or, god forbid, multiple big dbs each with multiple tenants - the worst of both worlds)
|
# ? Apr 30, 2024 07:23 |
|
my current role loves multi-tenancy. it's a small shop with a strong SQL guy running it, so everything uses magic that's only available in Azure SQL instances. related: anyone have tips on how to integration test like this without EF? ideally I'd spin up a stack or similar with a mssql instance, create and populate a DB, and test. but the mssql images can't do some of the things we need (mostly related to external tables and external stored procedure calls).
|
# ? Apr 30, 2024 13:08 |
|
redleader posted:tip: no matter how you decide to implement multitenancy, you will regret your decision and look fondly upon alternate implementations i also think this is usually the cleanest option. no query filters, just a separate connection string per tenant. the downside is that you have to be really drat sure you will never need to perform queries across multiple organisations if you do need that, using one schema per tenant can be a decent compromise. you can specify the schema in the connection string, but still override it in the query if needed. at least if your db is mssql or postgres
|
# ? Apr 30, 2024 15:56 |
|
I so wish we were doing the DB per tenant option. Right now we're migrating from an internal IDP to Okta, and as part of that change users will now be able to exist in multiple tenants (before this was not the case). Unfortunately, our application does a lot of "user impersonation" on the back-end when running user workflows to get the tenant context. This will obviously no longer work since users can exist in multiple tenants now. Fixing this is my job and it's a loving nightmare
|
# ? Apr 30, 2024 19:12 |
|
|
# ? Jun 5, 2024 04:17 |
|
Thanks everyone! I believe for my use case, separate DBs are the way to go. I'll most likely use Azure's managed Postgres service for each DB and factor the costs into my pricing. Also, this might be for another thread, but currently I have an MS Business basic subscription which I use for email hosting & Onedrive (domain1.com). I have an Azure account tied to this subscription which I use to host my portfolio website and a few Static Web Apps. If I'm planning on creating a SaaS app, do I want to purchase a separate Business subscription for the email addresses and create a new Azure account under that (to keep the SaaS stuff completely separate from my other things), or am I better off using my existing Azure account and just setup a new subscription inside that one? I also use Simplelogin and have the option of forwarding domain2.com's emails to my main domain. I can also send emails on behalf of domain2 this way as well. Just curious as ideally I don't want to have to pay for two separate MS Business accounts if I don't need to.
|
# ? Apr 30, 2024 21:40 |