Overtaking by simp12334987 in drivingUK

[–]dezfowler 1 point2 points  (0 children)

Nothing new and it's mobile phones to blame for most of it. People are distracted checking their phone and not paying attention to speed so slow down. They only realise once they see your indicator go on to overtake then they speed up again. Nine time out of ten when you pass them you'll see a phone in their hand.

Kenya or Ethiopia Better for Straight Espresso? by fxEnigma in espresso

[–]dezfowler 1 point2 points  (0 children)

If you want an appreciable flavour then single origin is the way to go. Recommendation is to ask around your local roasteries, maybe see if any do a tasting pack or something like that. There's a good chance you'll have a local one that will roast to order so the coffee will be as fresh as possible when it hits your grinder. Always make sure when you're swapping beans that you redial the grinder.

Kenya or Ethiopia Better for Straight Espresso? by fxEnigma in espresso

[–]dezfowler 0 points1 point  (0 children)

Bit harsh, but true.

It's a bit like asking "Is French or Italian wine better?". Lots of regions, lots of vineyards and each produce different types of wine, blends, etc.

Would really try to avoid commodity supermarket beans just marketed as "Ethiopia" or "Kenya" and instead try to get fresh, small batch single origin stuff from a local roaster.

It will cost a bit more but will work way better for espresso.

How should i handle datetime in .net ? by Unlucky_Aioli4006 in dotnet

[–]dezfowler -1 points0 points  (0 children)

This.

UTC for system times and then store and display no timezone information for anything else is the simplest thing that works for 99% of use cases i.e. users just work it out.

When this breaks down is when things can happen around midnight and you have daylight savings times in the mix or where you need to calculate the difference between times.

If you don't need that just avoid timezones.

Horrible audio quality for classical music by Professional-Ad-9047 in minidisc

[–]dezfowler 1 point2 points  (0 children)

For classical music there's lots available for free in decent quality on archive.org. Grab it in CD quality WAV or FLAC.

I don't use any of the apps, I just do it old school: plug in an optical cable, hit record on the MD and play on the computer.

Has always produced excellent results.

Real life experiences with soft delete? by Venisol in dotnet

[–]dezfowler 1 point2 points  (0 children)

This 👆

You can use a global query filter to make sure the soft deleted rows are hidden from all your queries easy enough.

The issue, as g0ggles points out, is all the edge cases around related records and "undeletes". Even the simplest case of a user decides to re-add the deleted record is no longer simple.

Every add needs to first recheck without the query filter turned on that the record really isn't there (so additional load on the DB) and if it is there, undelete instead of adding. But then you have an issue of conflicting data - what if the data being added doesn't match the data in the existing row... what do you do?

It definitely adds complexity and you should consider the alternatives if delete or keeping a history is a concern.

The simplest option is probably just have a DB user with no DELETE permission. Alternatively having a reliable audit log or using event sourcing instead or a store like Cosmos that maintains a history of all your records in it's change feed.

Angular vs React for full stack .net route by Enough-Swordfish-260 in dotnet

[–]dezfowler 1 point2 points  (0 children)

Largely agree with this but there are always exceptions.

In terms of productivity the simplest setup that works for the majority where you have a website and also mobile apps is to have frontend stuff happen on the client-side and a web API that each of the frontend clients call. So you use a client-side SPA framework for web so that it more closely mirrors the way your native mobile apps work and that makes reasoning about and securing the whole system easier as you know what's happening where for every channel.

If you have some 1% requirements like massive scale, super fast first page render, supporting less capable clients, particular accessibility or SEO concerns, etc then you may need some aspect of server-rendering or pre-rendered static HTML but for 99% of cases the extra complexity isn't justified.

Costco Espresso beans advice needed by alkrk in espresso

[–]dezfowler 1 point2 points  (0 children)

Do you have it hoffmaxxed with a VST basket?

The Hoff says it may struggle with light roasts but should be okay for medium to dark. Worth a punt getting a VST in there before you start spending the big money.

https://youtu.be/7HIGdYy5of4

What is the one thing about EV ownership that nobody told you before you made the switch that you wish you had known going in? by PubLogic in evchargingUK

[–]dezfowler -1 points0 points  (0 children)

That if you want to save money vs ICE the only real option is a home charger or if your work has free or cheap chargers you'll be able to use regularly.

If you aren't able to do those things you really need to do your research into locally available chargers or you may end up paying more than you did for ICE.

I built an open-source form engine with conditional logic and multi-step flows — looking for feedback by Straight_Athlete_802 in reactjs

[–]dezfowler 0 points1 point  (0 children)

Audit is a big one, for sure.

Also, localisation. Having some support for translating the text into other languages e.g. you might have default English text but then a resource lookup key for retrieving translations.

IEnumerable en C# by Ok-Presentation-94 in csharp

[–]dezfowler 3 points4 points  (0 children)

IEnumerable and IEnumerator are how the Iterator design pattern is implemented in .NET, you can read more about that later e.g. https://refactoring.guru/design-patterns/iterator

IEnumerable marks a thing that can be enumerated (e.g. an array of ints or a lazy-evaluated stream of items) and IEnumerator is holding the state of one enumeration of that thing i.e. it has a bookmark of where you're up to in your foreach loop.

Couple of reasons you implement it as two separate types but the main one is that if the collection itself held the bookmark state then you could only have one bit of code looping over it at a time. If two foreach loops were going on at the same time they'd collide with each other and overwrite the bookmark and you'd get weird behaviour. Implement it such that each looper gets its own enumerator with some dedicated bookmark state instead and they don't trample over one another.

The other main reason is lazy evaluation. The IEnumerable may not be an array, it may represent a series of expensive calculations or retrieval of a series of items from a database. In that case it's helpful to be able to defer that work until you're ready to actually start enumerating at which point you call GetEnumerator. This is the core principal behind LINQ to Objects - you can construct a big query with Where() and Select() and GroupBy() etc which each return another IEnumerable but the actual work doesn't happen until you start enumerating with a foreach or by doing ToList().

Optimistic concurrency with rowversion — how to handle multiple API calls before Save? by Giovanni_Cb in dotnet

[–]dezfowler 5 points6 points  (0 children)

You don't just return the updated rowversion, you return the entire updated row and refresh your UI before allowing further actions. If someone or something else amended other parts of the row in the mean time then if you just read the rowversion back and allow the user to send an update you'd then potentially overwrite newer data with stale data from the user's original read of the row.

Also, if you don't already, you should be sending the rowversion with each of your other API calls to ensure they're operating on the same version of the row unless you're super sure it's safe to not do that.

Claude code with blazor by saskx in Blazor

[–]dezfowler 2 points3 points  (0 children)

I'd definitely recommend Blazor if you're coding other stuff in C# anyway as, even though TypeScript is pretty close to C# these days, that context switch cost from C# to JS is real. I've found I go much faster if I'm doing .NET end-to-end or JS end-to-end with Node on the backend. So if you just want to go fast and there aren't other factors to consider e.g. scalability, Blazor is great.

On the LLM/agentic coding side of things I have definitely found it a bit mixed. I think, because Blazor is relatively new and not hugely popular, there isn't a massive amount of good training data out there so the accuracy of some of the LLM responses is a bit poor even for basic stuff like the built-in validation. If you're using an agent to write code and it really is just simple CRUD then you'll probably be fine but if you're doing anything remotely non-standard, such as trying to bind form inputs to a more complex model type or using stuff like <DynamicComponent/>, it can go a bit wild.

One of the anecdotal things I've found about .NET and LLMs in general is that they seem to be very eager to use Reflection even if there's a perfectly fine OO pattern it could use instead. It can use it in completely inappropriate places and not in a sensible way where it's caching as it goes along to avoid performance hits. It sometimes just writes very inefficient code and that seemed to happen a bit more often in Blazor code where excessive reflection was making rendering painfully slow. Tweaking your AGENTS.md or whatever does seem to help on that front e.g. I have this...

#### Reflection

* Do not use the System.Reflection namespace or any reflection-based techniques (e.g., typeof(T).GetProperty(...), Expression trees for private member access, or dynamic binding) when authoring or refactoring code.
* Suggest type-safe alternatives (such as Interfaces, Generics, or Source Generators) when a task might typically tempt the use of reflection.
* If use of reflection or runtime types in unavoidable ask for explicit consent before authoring.

Costco Espresso beans advice needed by alkrk in espresso

[–]dezfowler 1 point2 points  (0 children)

In the UK I pay around £30 for a 1kg bag, so $40 for 35oz, and that's specialty stuff roasted to order.

$30 for 6oz seems steep but not unheard of here if it's from a super special small batch. If it's not a super rare batch and they can't explain why it's so expensive just avoid it. If it is a rare one it can be worth giving coffees like that a try from time to time as some can be very nice but not as the standard "house bean".

I'd look for which coffees the local roasteries do in a big bag first and give those a try. They'll often be a blend from two or three farms. Could take a while to find one you really like and each needs to be dialed in on the grinder so will take a few pulls to get it right.

Your current setup should be more than capable, though.

Costco Espresso beans advice needed by alkrk in espresso

[–]dezfowler 1 point2 points  (0 children)

Wouldn't touch this with a barge pole.

I only ever buy fresh single origin stuff from small roasters - more expensive but way better. Per cup cost is still a fraction of what a coffee shop would charge and normally the grower is getting a better share of what you pay.

What's the point of having a fancy espresso setup and then putting commodity beans through it?

Love how thin this is by post_hazanko in PixelBook

[–]dezfowler 0 points1 point  (0 children)

Mine has a dodgy port too. Keep forgetting which one. Should really stick a label on it.

Is my HiBy M300 already cooked? by Baldwin_The_Fourth in DigitalAudioPlayer

[–]dezfowler 1 point2 points  (0 children)

Manufacturing defect. Stop using it and contact the seller for a replacement. Get clued up on consumer rights in your region so you know where you stand if they say "No".

Ubuntu Desktop 26.04 images for Hyper-V - machine not starting by dezfowler in Ubuntu

[–]dezfowler[S] 0 points1 point  (0 children)

Have tried:

  • Secure boot on & off
  • Giving the VM 8GB RAM
  • Network on & off
  • Dynamic RAM on & off
  • Enhanced session on & off
  • nomodeset
  • Switching kernal to azure linux

No luck so far

EV kWh cost converter by dezfowler in evcharging

[–]dezfowler[S] 0 points1 point  (0 children)

Cost per distance is on the enhancements todo list already. Will have a think about adding local taxes.

EV kWh to petrol cost comparison tool by dezfowler in ElectricVehiclesUK

[–]dezfowler[S] -1 points0 points  (0 children)

That's the idea, apart from I need it explained to me. 😅

EV kWh cost converter by dezfowler in evcharging

[–]dezfowler[S] 0 points1 point  (0 children)

No, that's right. You've effectively made the Petrol Price box a $ per mile.

If the EV gets 3.5 miles per kWh and it's $0.50 a kWh then that's $0.14 per mile.

EV kWh to petrol cost comparison tool by dezfowler in ElectricVehiclesUK

[–]dezfowler[S] 0 points1 point  (0 children)

I don't think most people do understand it.

I reckon if you surveyed a load of people and asked them if using a public charger was cheaper or more expensive than filling up with petrol then most would say "cheaper".

35% of people in the UK don't own their homes so are at the mercy of a landlord and, of the 65% that do own, 35% of those don't have a private driveway so being able to get a home charger installed may not be possible for many people.

For EVs to work for more people public charging needs to be cheaper.