[-] [email protected] 1 points 4 days ago* (last edited 4 days ago)

Yes, I agree that this is a bit of an anti-pattern, as you lose quite a few benefits from the Generics compile-time safety and instead open yourself to runtime exceptions. Not sure what your use case is, but if you want to maintain type safety it might be better to have multiple overloads for each type you want to process rather than a Generic. Typically you use Generics when the actual type doesn't matter to the method being called (e.g. LINQ uses Generics for IEnumerable<T>.Where because T can be anything and it just calls a Func<T, bool> on each element).

[-] [email protected] 2 points 4 days ago* (last edited 4 days ago)

If you don't want to go the pattern matching route you can also use reflection with MakeGenericMethod to specify the generic type and then invoke it.

Untested example:

var type = field.GetType();
var methodInfo = typeof(GenericClass).GetMethod("GenericMethod").MakeGenericMethod(type);
methodInfo.Invoke(null, field);

Edit: wrong documentation link https://learn.microsoft.com/en-us/dotnet/api/system.reflection.methodinfo.makegenericmethod?view=net-8.0 ~~https://learn.microsoft.com/en-us/dotnet/api/system.reflection.emit.methodbuilder.makegenericmethod?view=net-8.0~~

[-] [email protected] 10 points 4 weeks ago* (last edited 4 weeks ago)

On one hand you definitely don't want to be assigning manual/static IPv6 to all your devices because if your prefix ever changes you'll have to update it everywhere. IPv6 doesn't really have a concept of private address space (with a few exceptions). ~~On the other hand most modern IPv6 stacks support dynamic protocols like SLAAC while also assigning a static suffix to the published prefix (e.g. You want :0:0:1234:1 to go to your server, and SLAAC gets the prefix 200x::5678/64 your server would assign itself 200x::5678:0:0:1234:1).~~

DHCPv6 fixes a lot of these headaches for managed networks by allowing you to reserve specific IPv6 for a given DUID.

IMO, your network, do what you want. ~~I have two jump Raspberry PIs that I have static suffixes so I always know where they are without relying on DNS or whatever.~~ Edit: I apparently misremembered how I had these setup. I use a custom interface up script to take the SLAAC prefix and append the custom suffix to it as a secondary IP.

[-] [email protected] 29 points 2 months ago

The amount of Windows bashing in this thread is hilarious, for what amounts to Enterprise grade DNS-over-TLS with additional whitelisting. Doesn't help the home user, but likely won't break home users internet access either.

[-] [email protected] 16 points 2 months ago

Perhaps they should ask Copilot how their templating system works.

[-] [email protected] 10 points 2 months ago

I had analytics turned on (new phone and didn't check it before), and the app info only shows 76 kB have been transferred in the past 30 days. Seems pretty reasonable, but I disabled it anyways out of principal.

[-] [email protected] 71 points 3 months ago* (last edited 3 months ago)

I mean it was not too long ago there was a bug which could lead to an unauthenticated RCE against Bluetooth on Android.

https://nvd.nist.gov/vuln/detail/CVE-2022-20345

So yea, reducing surface area of attack when a feature is not needed is kinda important.

[-] [email protected] 56 points 3 months ago

The creator's clear check doesn't count towards the level being cleared, so these levels are uncleared. I think if the creator plays it on the uploader account it wouldn't count either.

[-] [email protected] 25 points 3 months ago

You can, sure, but you probably shouldn't. Encrypting and decrypting consume additional cpu time, and you won't gain much in terms of security.

[-] [email protected] 19 points 5 months ago

If only they had done this with .local ages ago. Still, it's a nice change, but I doubt my company will adopt.

[-] [email protected] 15 points 7 months ago

A torrent is broken into pieces, and further into blocks. The torrent file contains hashes of all the pieces that make up the full torrent. The client validates each piece that is downloaded and will re-download from another peer if an invalid piece is encountered. The spec goes in to more depth if you're interested. https://wiki.theory.org/BitTorrentSpecification

[-] [email protected] 18 points 9 months ago

There are 4 pinned posts at the top, should be more posts below that.

view more: next ›

theit8514

joined 11 months ago