c# – Removing a base class from its according collection OOP

Lets say i have a zoo class, with a bunch of collections. The collections are giraffes, elephants, tigers etc. All animal types derive from the same interface or base class, lets call it IAnimal.

So in my code i’m running in the same problem in 2 places. I end up in a method, that gets an IAnimal that its supposed to delete, but i dont know which exact type it is. So i basically end up with methods that look like this

if(animal is Tiger tiger)
else if(animal is Giraffe giraffe)

This code moves around, sometimes it lands in the zoo class, sometimes in a DBService class, sometimes in a viewmodel. Sometimes its a dictionary, but lets be honest its the same thing.

I know i can probably brute force a solution that i never need to touch again with some smart reflection somehow, but that feels like its not really OOP.

I can split up the method it ends up in from a single method that gets an IAnimal into several method that get a Tiger, Giraffe etc, but that feels the same as a big factory method. It feels like i should be able to do something with generics, but it just doesn’t work since i don’t know the type at compile time.

The best i can do is a bunch of DeleteTiger(Tiger tiger) methods that internally call a DeleteAnimal<Tiger> method that saves a single line of code in each of the delete methods.

This isn’t just a theoretical best practice thing, i keep having to go back and back to that method every time i add a new subentity to my application.

What can i do to stop having to do this? Can i even do anything?

android emulator – Could not initialize class anroidx.appcompat.app.AppCompatViewInflater

Stack Exchange Network

Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

php – How to fix “Object of class WP_Term could not be converted to string”?

I basically want to loop through each post I have and get the taxonomy/category id. After that I want to output those id’s into a single string (not as a numeric value), separated by a space.

I get this error when I try to echo the string: “Object of class WP_Term could not be converted to string”

Here is what i have so far:

          $taxonomy = wp_get_object_terms($post->ID, 'categories');
          $ids = "";
          foreach ($taxonomy as $cat) {
              $ids .= $cat;


Enterprise class hardware? Do budget providers utilize enterprise class hardware, and why is this important anyway? In theory, dedicated ser… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1815104&goto=newpost

dnd 5e – Is there a class ability, spell or other, that lets you share spells with your familiar?

The closest suggestions to what you want that I have found are a Beast Master ranger or the find (greater) steed spells

I was unable to find anything that allows a wizard/warlock to have self-only spells also affect a familiar summoned via find familiar. The closest things I could find would require heavy multiclassing into undesired classes, and still wouldn’t actually affect the familiar, but here’s what I found…

The Beast Master ranger gets a class feature at 15th level called Share Spells (PHB, p. 93), which says:

Beginning at 15th level, when you cast a spell targeting yourself, you can also affect your beast companion with the spell if the beast is within 30 feet of you.

This doesn’t affect a familiar via find familiar like you wanted, but it does allow your beast companion to benefit from tensor’s transformation. Note that with 15 levels in ranger, you wouldn’t have access to tensor’s transformation anyway.

Alternatively, if you were able to gain access to the find steed (PHB, p. 240) or find greater steed (XGtE, p. 156) spells (which, as far as I’m aware, means taking levels in paladin or bard), both of which say:

While mounted on it, you can make any spell you cast that targets only you also target (your/the) mount.

Again, this still doesn’t affect the familiar via find familiar, but this should also allow a summoned mount to be affected by tensor’s transformation. If you took the bard route, you could learn tensor’s transformation via Magical Secrets, otherwise this build also doesn’t have access to tensor’s transformation.

How does creating and initializing a map in Java using an anonymous class potentially cause memory leak issues?

I’ve seen code that creates and initializes a map by extending HashMap (via an anonymous class) and initialization block as follows:

   final Map<String, String> headers = new HashMap<String, String>() {{

According to https://www.baeldung.com/java-initialize-hashmap

Note that, we must try to avoid this initialization technique as it
creates an anonymous extra class at every usage, and also holds hidden
references to the enclosing object and might cause memory leak issues

Why might this cause a memory leak issue?

html – The underline using ::after pseudo class works perfectly in Firefox but not working in Chrome

First of all, I was working on a web project and I was previewing it from Firefox not Google Chrome. There were some pseudo classes (like ::after and ::before) in the code and I used the hover animation to do some animation effects and everything worked more than fine and like I planned inside Firefox.
Firefox view

However, when I checked the same project in Chrome and Edge, the animations and the pseudo classes animations were not working at all. Some of them were completely invisible, and the ::before class worked while the::after class did not
Chrome view

The pink color also was too dim, not bright like the one in Firefox!
So, I am wondering why such issue is happening? I know that there are some points that might change from a browser to another one and I should put them in consideration, but I guess the disappearing of a whole pseudo class is so annoying and just not right. So can anyone help me to debug this problem (I will send the source code if needed)? Also, is there any other way when creating a website to match all the browsers without checking each one of them? because I find this so tedious and not productive at all!

Video showing this issue: https://drive.google.com/file/d/1AKrJgH7cfiejVyjULRwmH5EpHGjgFd9G/view?usp=sharing

(I use the latest versions of both Firefox and Chrome)

typescript – Inheriting parent class attributes in Mixin

I am trying to access a property from a inherited class inside a mixin

class BaseItem{
     public id:string;
     constructor(id:string) {
        this.id =id;  

abstract class ConfigMixin<K extends BaseItem>{
        public saveConfig() {
            const repo = getRepository(Entity);
                    id: this.id // Typescript error

class BaseDevice extends BaseItem{
     constructor(id:string) {
export interface BaseDevice extends ConfigMixin<BaseDevice> {}
applyMixins(BaseDevice , (ConfigMixin));

However im recieving the following error:
TS2339: Property ‘id’ does not exist on type ‘ORCASmartLightConfig’.

find the Conjugacy class of this group : {sb3(z3)={a=(aij)∈gl(z3):a21=a31=a32=0,det(a)=1(mod3}

i try to find the best way .. we are know 2 matrix for size 3*3 Matrix similarity if and only if have the same Jordan normal form . but in this group can’nt say Two matrix have a same Jordan normal form are in the same Conjugacy class .
what the best way to find all the Conjugacy class that have 108 elemnts ?

applications – Identify the source (e.g. Java class, process, app) from an output in the logcat

When I plug my phone into my computer, I can see the console output in Android Studio. I recently noticed that whenever I start entering a password in a field designated for passwords (the ones that display ‘*’ for any character), the phone prints a very concerning message to the console:

D/HwAutofillHelper: inputType is password, now record

Since it is an Honor Phone, I suppose Hw is short for Huawei?

Nevertheless, I’d like to know if there is a way to find out what process produced this output and what app it belongs to?