text:
Q: MEF don't see dependencies in other projects in VSIX Editor Extension I'm writing a Visual Studio editor extension. In my solution has two projects: the main VSIX Project (first) and the class library project (second). In the second project has several dependencies that exported for MEF and used in the first project. But in runtime MEF can't resolve dependencies that placed in the second project.
How I can resolve this issue?
In other cases (simple is - console app) I would do something like this:
var assemplies = AppDomain.CurrentDomain.GetAssemblies()
    .Where(x => x.Location.Contains(AppDomain.CurrentDomain.BaseDirectory));

var compositionHost = new ContainerConfiguration()
    .WithAssemblies(assemplies)
    .CreateContainer();
var compositionContext = compositionHost.GetExport<CompositionContext>();
var exporter = new Export<CompositionContext>(compositionContext, () => { });

var someService = exporter.Value.GetExport<ISomeService>("First");

But how to resolve this issue for Visual Studio editor extension I can't understand

A: This problem is resolved.
If someone is interested need just to add assets of 'Microsoft.VisualStudio.MefComponent' type for necessary assemblies to vsixmanifest.


text:
Q: Can substitution be used to solve a single equation that represent a partial order with two variables? I am still trying to wrap my head around partial orders and my algebra is not the best...
My question is pertains to the following example:
ex.) Let a relation R be defined on the set of real numbers as follows:
$ xRy ⇔ 2x +y = 3 $
Prove that this relation is antisymmetric.
Solution: aRb is $(2a+b=3)$, since bRa  is $2b+a=3$
$(2a+b)−(2b+a) = 3−3 $
$2a + b − 2b − a = 0$
$a−b=0 $
$a = b $
My question is, why subtract the two equations? Do we subtract the two equations because a partial order is a way to quantify how objects in a set are different from each other?And is it possible to solve the same equation by substitution?
I solved:
$2x + y = 3 $
$x= 3-y/2 $
and plugged x back into the equation and solved for y.
$2(3-y/2)+y=3 $
$3-y+y=3$
$3+y=3+y $
$y=y$
I tested a few values to find that the equation 2x+y=3 is true for any value y that is added to 2(3-y/2).

A: In order to show antisymmetry we have to show that given $xRy$ and $yRx$ the equality $x=y$ follows. Here we have the situation that since $xRy$ is defined as $2x+y=3$ the system of equations
\begin{align*}
2x+y&=3\tag{1}\\
x+2y&=3\tag{2}
\end{align*}
is valid.

We can do any admissible equivalence transformations with (1) and (2) to find out if $x=y$ is true. This means that we can subtract (1) from (2) to come to a conclusion as well as applying the substitution method. So, both  approaches are fine.

Hint: Your calculation needs to be revised somewhat. In fact from $2x+y=3$ it follows $x=\frac{3-y}{2}$. Substitution of $x=\frac{3-y}{2}$ in $x+2y=3$ results in $y=1$ and we finally get $\color{blue}{x=y}=1$.

redpajama_set_name: RedPajamaStackExchange


text: Q: Correct way to use Hausdorff Distance I am looking for some guidance here.  I am trying to compare two x-rays of jaw bones.  The x-rays show trabecula bone, which is bone that contains lots of holes.  I am hoping to show that trabecular bone patterns, like fingerprints, can be used to identify an individual.  I want to use the Hausdorff distance to compare how similar (or different) two x-rays are.  I take the x-rays and threshold them to become black/white images, then use an edge detection filter.  I wrote a C# program to compute the Hausdorff distance of the two images.  Can I identify the points in both images as starting at the origin (0,0) or do they need to be spaced at some distance from each other?  Thanks in advance for your help.  Jim


text:
Q: I am getting invalid number error SET SERVEROUTPUT ON
DECLARE
    lv_comp_msr VARCHAR2(20000);
 BEGIN
     WITH msr AS
        (SELECT REGEXP_SUBSTR ('02,03,04,09,12', '[^,]+',1,LEVEL) AS msr_id
           FROM DUAL
          CONNECT BY REGEXP_SUBSTR ('02,03,04,09,12', '[^,]+',1,LEVEL) IS NOT NULL    )
     SELECT listagg (measure_id, ',') WITHIN GROUP (    ORDER BY measure_id) AS MEASURE_ID
     INTO lv_comp_msr
    FROM
          (SELECT measure_id FROM irp_measures_def   )
    WHERE measure_id IN  (SELECT listagg (msr_id, ',') WITHIN GROUP (ORDER BY msr_id) msr_id
                          FROM msr   )
      --and COMP_MSR_FLAG is null
   ;
   DBMS_OUTPUT.put_line('lv_comp_msr=' || lv_comp_msr);
END;

A: listagg() produces a string. In your WHERE clause you compare it with measure_id, which I'm going to guess is numeric. You're comparing a number and a string, so Oracle performs an implicit datatype conversion. But of course an aggregated comma-separated string can't be converted to a number, hence the ORA-01722 error.
The error is easily avoided. Your have a WITH clause which produces a table of numbers: why are you applying a listagg() in the first place? You can just use the output of the sub-query factoring:
 WHERE measure_id IN  (SELECT msr_idFROM msr   )


text:
Q: Как в Android вызвать стандартную обрезку картинки? В андроид есть стандартная обрезка картинок, которая вызывается, если вы хотите назначить контакту картинку, но она для этого слишком большая, хотелось бы узнать, как её можно вызвать.
А ещё было бы лучше, если бы вы посоветовали, как вызвать обрезку, после того, как я сделаю фото, т.е. из моего приложения нужно вызвать стандартную камеру, сделать снимок и чтобы далее вызвалась стандартная программа для обрезки фото.
Может, я ошибаюсь, и так не получится сделать, может, я смогу только вызвать камеру, сделать снимок и только потом вызвать обрезку картинок, в принципе не важно, но первый вариант куда более предпочтителен. И хотелось бы ещё узнать, как передать параметры в обрезку картинок, это необходимо делать через Bundle при передачи интента?
Заранее большое спасибо.
A: //call the standard crop action intent (the user device may not support it)
Intent cropIntent = new Intent("com.android.camera.action.CROP");
    //indicate image type and Uri
cropIntent.setDataAndType(picUri, "image/*");
    //set crop properties
cropIntent.putExtra("crop", "true");
    //indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
    //indicate output X and Y
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);
    //retrieve data on return
cropIntent.putExtra("return-data", true);
    //start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP);

Дивайс вполне вероятно может и не поддерживать эту фичу.


text:
Q: Is there an elegant way to check if the POST request body matches the expected parameters at the endpoint? I implemented a simple server in NodeJS using TypeScript and ExpressJS. At present, in each endpoint, I check if the incoming request body matches the expected parameters in the following way: -
express.Router().post('/add', (req: Request, res: Response) => {
     if (!req.body.operand1 || typeof req.body.operand1 !== 'number' ||
         !req.body.operand2 || typeof req.body.operand2 !== 'number') {
          res.send('Request body is invalid');
          return;
     }

     const parameters = req.body;

     res.send(parameters.operand1 + parameters.operand2);
}

But this would get tedious if there are many expected parameters in a given endpoint. What is the best way to achieve this?
EDIT
I edited this question because, before I had included some interfaces and the question looked similar to Detect whether object implement interface in TypeScript dynamically, which (understandably) confused people, while the scenario was different from that. There, the asker wanted to know if an object implements an interface. Here, I want to see if the body in a post request is the expected one.

A: So here is my example and what I had in mind. Its a very basic example and goes under the assumption that everything you define in your rules MUST be present in the body:
const AddEndpointRules = {
    operand1: 'number',
    operand2: 'number'
};

express.Router().post('/add', (req: Request, res: Response) => {
    // --- Changed
    if (!matches(req.body, AddEndpointRules)) {
        res.send('Request body is invalid');
        return;
    }
    // ---

    const parameters: AddEndpointParameters = req.body;

    res.send(parameters.operand1 + parameters.operand2);
}

function matches(body, rules) {
    // All keys of rules must be present, so we use that to check our body
    for (let attribute in rules) {
        // The type of value must be same as our rule
        // Not present would mean 'undefined'
        if (typeof body[attribute] !== rules[attribute]) {
            // We invalidate body as soon as we find our first invalid attribute
            return false;
        }
    }

    // All checked out, request body is OK
    return true;
}

You can also place the matches function in a class of its own and require/import it above your request and use it like for example: Validator.validate() (rename it to validate). That way you can also extend the logic some more and check for length and/or check deeper in the object.

A: What you are looking for is called a schema. It's a way to define what a json object should look like or be formatted as and then use that to compare against the body that is being sent to the API. I would look into this.
https://www.npmjs.com/package/jsonschema


text:
Q: How to convert a String array to a Byte array? (java) I have a one dimensional String array that I want to convert into a one dimensional byte array. How do I do this? Does this require ByteBuffer? How can I do this? (The strings can be any length, just want to know how to go about doing such an act. And after you convert it into a byte array how could I convert it back into a String array?
-Dan

A: You don't say what you want to do with the bytes (aside from convert them back to a String[] afterward), but assuming you can just treat them as an opaque bag of data (so you can save them to a file or send them over the network or whatnot, but you don't need to examine or modify them in any way), I think your best bet is to use serialization. To serialize your string-array, you would write something like:
final String[] stringArray = { "foo", "bar", "baz" };

final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final ObjectOutputStream objectOutputStream =
    new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(stringArray);
objectOutputStream.flush();
objectOutputStream.close();

final byte[] byteArray = byteArrayOutputStream.toByteArray();

and to recover it afterward, you'd write the reverse:
final ByteArrayInputStream byteArrayInputStream =
    new ByteArrayInputStream(byteArray);
final ObjectInputStream objectInputStream =
    new ObjectInputStream(byteArrayInputStream);

final String[] stringArray2 = (String[]) objectInputStream.readObject();

objectInputStream.close();

A: Array to Array you should convert manually with parsing into both sides, but if you have just a String you can String.getBytes() and new String(byte[] data);
like this
public static void main(String[] args) {
    String[] strings = new String[]{"first", "second"};
    System.out.println(Arrays.toString(strings));
    byte[][] byteStrings = convertToBytes(strings);
    strings = convertToStrings(byteStrings);
    System.out.println(Arrays.toString(strings));

}

private static String[] convertToStrings(byte[][] byteStrings) {
    String[] data = new String[byteStrings.length];
    for (int i = 0; i < byteStrings.length; i++) {
        data[i] = new String(byteStrings[i], Charset.defaultCharset());

    }
    return data;
}

private static byte[][] convertToBytes(String[] strings) {
    byte[][] data = new byte[strings.length][];
    for (int i = 0; i < strings.length; i++) {
        String string = strings[i];
        data[i] = string.getBytes(Charset.defaultCharset()); // you can chose charset
    }
    return data;
}

for one byte[] from string[] you have to:

*

*to byteArray concat byte arrays from each string using some delimeter

*from bytearray split by te same delimiter and create String as I
described above.

A: You can check this
package javaapplication2;

import java.util.Arrays;

/**
 *
 * @author Ali
 */
public class JavaApplication2 {

 public static byte[] to_byte(String[] strs) {
        byte[] bytes=new byte[strs.length];
        for (int i=0; i<strs.length; i++) {
            bytes[i]=Byte.parseByte(strs[i]);
        }
        return bytes;
    }

    public static void main(String[] args) {
        String[] input = {"1","2","3"};       //original data
        byte[] byteArray = to_byte(input);//data to byte array
        String[] recovered=Arrays.toString( byteArray).split(",");// recovered data

    }
}

A: First declare the string like I declared here str="Suresh"
Second use getBytes() to convert it in bytes
getBytes returns the array of byte.
String str="Suresh";
byte[] s=str.getBytes();

A: String.getBytes()? is what you're looking for.

A: I would treat this as a serialization problem and just implemented it as follows(complete and working Java code):
import java.nio.ByteBuffer;
import java.util.ArrayList;

public class Serialization {
    public static byte[] serialize(String[] strs) {
        ArrayList<Byte> byteList = new ArrayList<Byte>();
        for (String str: strs) {
            int len = str.getBytes().length;
            ByteBuffer bb = ByteBuffer.allocate(4);
            bb.putInt(len);
            byte[] lenArray = bb.array();
            for (byte b: lenArray) {
                byteList.add(b);
            }
            byte[] strArray = str.getBytes();
            for (byte b: strArray) {
                byteList.add(b);
            }
        }
        byte[] result = new byte[byteList.size()];
        for (int i=0; i<byteList.size(); i++) {
            result[i] = byteList.get(i);
        }
        return result;
    }

    public static String[] unserialize(byte[] bytes) {
        ArrayList<String> strList = new ArrayList<String>();
        for (int i=0; i< bytes.length;) {
            byte[] lenArray = new byte[4];
            for (int j=i; j<i+4; j++) {
                lenArray[j-i] = bytes[j];
            }
            ByteBuffer wrapped = ByteBuffer.wrap(lenArray);
            int len = wrapped.getInt();
            byte[] strArray = new byte[len];
            for (int k=i+4; k<i+4+len; k++) {
                strArray[k-i-4] = bytes[k];
            }
            strList.add(new String(strArray));
            i += 4+len;
        }
        return strList.toArray(new String[strList.size()]);
    }

    public static void main(String[] args) {
        String[] input = {"This is","a serialization problem;","string concatenation will do as well","in some cases."};
        byte[] byteArray = serialize(input);
        String[] output = unserialize(byteArray);
        for (String str: output) {
            System.out.println(str);
        }
    }
}

The idea is that in the resulting byte array we store the length of the first string(which is always 4 bytes if we use the type int), followed by the bytes of the first string(whose length can be read later from the preceding 4 bytes), then followed by the length of the second string and the bytes of the second string, and so on. This way, the string array can be recovered easily from the resulting byte array, as demonstrated by the code above. And this serialization approach can handle any situation.
And the code can be much simpler if we make an assumption to the input string array:
public class Concatenation {
    public static byte[] concatenate(String[] strs) {
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<strs.length; i++) {
            sb.append(strs[i]);
            if (i != strs.length-1) {
                sb.append("*.*"); //concatenate by this splitter
            }
        }
        return sb.toString().getBytes();
    }

    public static String[] split(byte[] bytes) {
        String entire = new String(bytes);
        return entire.split("\\*\\.\\*");
    }

    public static void main(String[] args) {
        String[] input = {"This is","a serialization problem;","string concatenation will do as well","in some cases."};
        byte[] byteArray = concatenate(input);
        String[] output = split(byteArray);
        for (String str: output) {
            System.out.println(str);
        }
    }
}

The assumption is that *.* does not exist in any string from the input array. In other words, if you know in advance some special sequence of symbols won't appear in any string of the input array, you may use that sequence as the splitter.

A: You can iterate for each string and keep appending to the final byte array.
String example = "This is an example";
//Convert String to byte[] using .getBytes() function
byte[] bytes = example.getBytes();
//Convert byte[] to String using new String(byte[])
String s = new String(bytes);


text:
Q: iPhone. CATransition fades but I want sliding CATransition *animation = [CATransition animation];
  [animation setDuration:0.5];
  [animation setType:kCATransitionPush];
  [animation setSubtype:kCATransitionFromBottom];
  [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

  [animation setDelegate:self];

  [[self layer] addAnimation:animation forKey:@"popUpAni"];

The above code (contained within an object of UIView class) fades the view in. I want it to slide in, not fade.
No matter what I try:
        [animation setType:kCATransitionMoveIn];
  [animation setSubtype:kCATransitionFromTop];

The result remains the same. Am I doing something wrong?

A: EDIT: Sorry, I had that backwards, I meant to say the curlup animation shows as a fade animation on the simulator...
I know for sure the slide animation, just as you've written it, works on the simulator and of course the device.  The code in my project is practically verbatim to yours.
Try changing the key you specify in the addAnimation method from "popUpAni" to something else.  If that key is used somewhere else in your project, it may be causing this issue.
Also, have you confirmed you are using the correct version of the CoreAnimation Framework?  You should be referencing  and the QuartzCore.framework reference should be looking within the iPhoneOS frameworks folder.


text:
Q: Converting user input to an array of characters, and filtering letters from other characters? #include "stdafx.h"
#include "stdlib.h"
#include <ctype.h>

int num = 0;
int i = 0;
int ch = 0;

int letter_index_in_alphabet(int ch) {

        if (isalpha(ch) == true) {
            char temp_str[2] = { ch };
            num = strtol(temp_str, NULL, 36) - 9;
            printf("%d is a letter, with %d as its location in the alphabet!", ch, num);
        }
        else {
            return -1;
        }

}

int main()
{
    char input_str[10];
    printf("Please enter a series of up to 10 letters and numbers: \n");

     fgets(input_str, 10, stdin);

    for (i == 0; i <= 10; i++) {
        ch = input_str[i];
        letter_index_in_alphabet(ch);

    }

    return 0;
}

Hello everyone, this is my first post on SOF! The goal of this program is to read characters from the standard input to EOF. For each character, report if it is a letter. If it is a letter, print out its respective index in the alphabet ('a' or 'A' = 1, 'b' or 'B' = 2..etc). I have been searching some other posts on stackoverflow and this has helped me get this far(using fgets and strtol functions). I have no visible syntax errors when I run this code, but after I enter a string of characters (ex: 567gh3fr) the program crashes.
Basically, I am trying to use 'fgets' to bring each character entered into a string with the appropriate index. Once I have that string, I check each index for a letter and if it is, I print the number assigned to that letter of the alphabet.
Any help or insight into why this isn't working as intended is greatly appreciated, Thanks!

A: You have a few problems.
First, char input_str[10] is only big enough for the user to enter 9 characters, not 10, because you need to allow one character for the null byte that ends a string.
Second, your loop goes too far. For a string with 10 characters, indexes go up to 9, not 10. It also should stop when it gets to the null byte, since the user might not have entered all 9 characters.
To get the position in the alphabet, you can simply subtract the value of A or a from the value of the character. Use tolower() or toupper() to convert the character to the case that you're going to use. Your method works, but it's overly complicated and confusing.
letter_index_in_alphabet() is declared to return int. But when the character is a letter, it doesn't execute a return statement. I'm not sure why it's supposed to return something, since you never use the return value, but I've changed it to return the position (maybe the caller should be the one that prints the message, so the function just does the calculation).
In the for loop, it should be i = 0 to perform an assignment, not i == 0 which is comparison.
You also shouldn't use global variables so much. And system header files should have <> around them, not "".
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>

int letter_index_in_alphabet(int ch) {

    if (isalpha(ch)) {
        int num = tolower(ch) - 'a' + 1;
        printf("%d is a letter, with %d as its location in the alphabet!\n", ch, num);
        return num;
    } else {
        return -1;
    }
}

int main()
{
    char input_str[10];
    printf("Please enter a series of up to 9 letters and numbers: \n");

    fgets(input_str, sizeof(input_str), stdin);

    for (int i = 0; input_str[i]; i++) {
        letter_index_in_alphabet(input_str[i]);
    }

    return 0;
}


text:
Q: How to shorten a property, with repeating get and setter I have a problem with repeating code and would like to know a way to short the code further.
Thats how my code currently looks like:
private string _description = null;
public string Description
{
    get
    {
        _description = GetLang(this.TabAccountLangs, "TextAccount");
        return _description;
    }
    set
    {
        if (object.Equals(value, _description))
            return;

        SetLang(this.TabAccountLangs, "TextAccount", value);

        OnPropertyChanged();
    }
}

This property and the code within can come several times within one class and in serval classes within the whole project, the only things changing are the name of the property and backing field it self, as well as the parameters from the method calls.
Now I would like to know, if there is a way to further shorten this code for example like this:
(is just pseudo code)
[DoYourSuff(FirstParam=this.TabAccountLangs, SecondParam="TextAccount", ThirdParam=value)]
public string Description { get; set; }

This example would use an attribute, but maybe there is something better or if the attribute is the best way to do this. How would I implement such an attribute?

A: Several answers seem worthy, but here's another option.
Have a look at Fody.
They have a plethora of plugins, some of them do quite similar things. If you can't find the one you like , you can probably modify it to do your will (and post it back to contribute to the community at the same time).
The PropertyChanged plugin for Fody,for example, will change these 51 lines of code:
public class Person : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    string givenNames;
    public string GivenNames
    {
        get { return givenNames; }
        set
        {
            if (value != givenNames)
            {
                givenNames = value;
                OnPropertyChanged("GivenNames");
                OnPropertyChanged("FullName");
            }
        }
    }

    string familyName;
    public string FamilyName
    {
        get { return familyName; }
        set
        {
            if (value != familyName)
            {
                familyName = value;
                OnPropertyChanged("FamilyName");
                OnPropertyChanged("FullName");
            }
        }
    }

    public string FullName
    {
        get
        {
            return string.Format("{0} {1}", GivenNames, FamilyName);
        }
    }

    public virtual void OnPropertyChanged(string propertyName)
    {
        var propertyChanged = PropertyChanged;
        if (propertyChanged != null)
        {
            propertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

To 14:
[ImplementPropertyChanged]
public class Person
{
    public string GivenNames { get; set; }
    public string FamilyName { get; set; }

    public string FullName
    {
        get
        {
            return string.Format("{0} {1}", GivenNames, FamilyName);
        }
    }
}

A: If you really want to go down this route?  Code generation will work.
http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx
Microsoft has embedded the T4 templating language into Visual Studio.  This templating language allows quick and easy ways to generate boilerplate code.  While the system itself is primitive, clumsy, and generally frustrating, it allows you to generate code with whatever approach you like.
To do the basics, you'd make a template file describing your reusable code and logic.
So for example, we could have a TemplatedFields.Include.tt file that looks like this
<# // myFields and myClassName must be defined before importing this template #>
<# // stuff in these braces will not appear in the outputted file, but are executed by the templating engine #>
//this code is outside of the braces and will appear in the file1
public partial class <#= myClassName #> //notice the equals sign.  Works like webforms.
{

    <# ForEach(var field in myFields) { #>
    private string _<#= field.Name #> = null;
    public string <#= CapitalizeFirstLetter(field.Name) #>
    {
        get
        {
            _<#= field.Name #> = GetLang(<#= field.FirstParam #>, "<#= field.SecondParam #>");
            return _<#= field.Name #>;
        }
        set
        {
            if (object.Equals(value, _<#= field.Name #>))
                return;

            SetLang(<#= field.FirstParam  #>, "<#= field.SecondParam #>", value);

            OnPropertyChanged();
        }
    }
    <# } #>
}

And then for the definition of your... well, let's say this is Person.cs
Person.Templated.tt
<#@ output extension=".cs" #>
//stuff inside the angle braces is sent to the TT engine and does not appear in the file.
<#
var myClassName = "Person";
var myFields = new List<Field>()
{
    new Field {Name="Description", FirstParam="this.TabAccountLangs", SecondParam="TextAccount"),
    new Field {Name="Name", FirstParam="this.TabAccountLangs", SecondParam="TextAccount"),
    new Field {Name="MoarFieldzzzz", FirstParam="this.TabAccountLangs", SecondParam="TextAccount"),
}
 #>
 //included code is appears below, now that values have been set above.
 <#@ include file="TemplatedFields.Include.tt" #>

Saving the above file will generate Person.Templated.cs automatically.  I don't remember if you need a directive or not to make sure that VS will compile the resulting CS file, but I'm pretty sure it does by default.
I leave the implementation of CapitalizeFirstLetter and the definition of Field as an excersize for the reader.  This is, of course, an exceptionally crude approach - there are far more structured and intelligent ways to build a framework with t4.
Because the class is partial, you can provide more specific hand-coded logic in a second Person.cs file.
Oleg Sych has made the t4toolbox to make large, complicated T4 projects easier, but I warn you: T4 are a path to madness.

A: Setters can be replaced with one-liners:
    private string foo;
    public string Foo
    {
        get { return foo; }
        set { Setter(v => foo = v, value, () => Foo, () => Bar); }
    }

e.g.:
 set { Setter( v => SetLang(this.TabAccountLangs, "TextAccount", v), value, () => Foo );

"Setter" is the method in base class:
public abstract class BaseObject : INotifyPropertyChanged
    {
    public event PropertyChangedEventHandler PropertyChanged;

    protected void Setter<T>( Action<T> setter, T newVal, Expression<Func<T>> property, params Expression<Func<object>>[] dependentProperties )
        {
        if ( !equals( getPropValue( property ), newVal ) )
            {
            setter( newVal );
            notifyDependentProps( property, dependentProperties );
            }
        }

    private static string getPropertyName<Tz>( Expression<Func<Tz>> property )
        {
        return getPropertyInfo( property ).Name;
        }

    private static PropertyInfo getPropertyInfo<T>( Expression<Func<T>> property )
        {
        MemberExpression expression;
        var body = property.Body as UnaryExpression;
        if ( body != null )
            expression = (MemberExpression) body.Operand; //for value types
        else
            expression = ( (MemberExpression) property.Body );
        var pi = expression.Member as PropertyInfo;
        if ( pi == null )
            throw new ArgumentException( "expression must be valid property" );
        return pi;
        }

    private void valueChanged<Ta>( Expression<Func<Ta>> property )
        {
        if ( PropertyChanged != null )
            PropertyChanged( this, new PropertyChangedEventArgs( getPropertyName( property ) ) );
        }

    private void notifyDependentProps<T>( Expression<Func<T>> property, Expression<Func<object>>[] dependentProps )
        {
        valueChanged( property );
        if ( dependentProps != null && dependentProps.Length > 0 )
            {
            for ( int index = 0; index < dependentProps.Length; index++ )
                valueChanged( dependentProps[index] );
            }
        }

    private T getPropValue<T>( Expression<Func<T>> property )
        {
        PropertyInfo pi = getPropertyInfo( property );
        return (T) pi.GetValue( this, new object[] {} );
        }

    private bool equals<T>( T first, T second )
        {
        return EqualityComparer<T>.Default.Equals( first, second );
        }
    }

A: You can do something similar to this:
public class MyClass
{
    private TabAccountLangs TabAccountLangs = //whatever;
    private readonly Wrapper _wrapper = new Wrapper(TabAccountLangs);

    private string Decsription
    {
        get { return _wrapper.GetValue<string>("TextAccount"); }
        set { _wrapper.SetValue<string>("TextAccount", value, OnPropertyChanged); }
    }
}

public class Wrapper
{
    private Dictionary<string, object> _map = new Dictionary<string, object>();

    //pass TabAccountLangs to constructor and assign to _langs property
    //Constructor should be here

    public T GetValue<T>(string name)
    {
        object result;
        if (!_map.TryGetValue(name, out result))
        {
            result = GetLang(_langs, name);
            _map[name] = result;
        }
        return (T) result;
    }

    public void SetValue<T>(string name, T value, Action onSuccess)
    {
        object previousValue;
        if (_map.TryGetValue(name, out previousValue) && previousValue.Equals(value))
        {
            return;
        }
        SetLang(_langs, name);
        _map[name] = value;
        onSuccess();
    }

    //The rest
}

I don't know a lot about the details of your task but this will give you the basic idea. In case your classes don't share the same parent, this will prevent code duplication. In case if they do, you can hide this wrapper in base class and don't pass OnPropetyChanged delegate to wrapper

A: You may use PostSharp.
I won't paste any example here: They are plenty on their site !

A: Summary
Use interception to address cross cutting concerns in how your properties are implemented.
Attributes can be used to associate static metadata to your code, whilst runtime dependencies require a bit more configuration.

Explanation and Example
My understanding is that you are essentially concerned with an exercise in Aspect Orientated Programming. You wish to decouple the definition of your class, to the way the underlying data is persisted and any subsequent consequences (such as the raising of the INotifyPropertyChanged event).
What's interesting about your case is that you wish to do using both static data (the string value "TextAccount" in your code sample) and data that is only known at runtime (the this.TabAccountLangs in your code example).  These types of data require different approaches.
There is quite a bit going on in my solution, but let me first post the code and then explain it:
internal class Program
{
    private static void Main(string[] args)
    {
        var cOldClass = new PlainOldClass();
        var classProxyWithTarget =
            new ProxyGenerator().CreateClassProxyWithTarget(cOldClass,new Intercetor(cOldClass));
        classProxyWithTarget.PropertyOne = 42;
        classProxyWithTarget.PropertyTwo = "my string";
    }

}

[AttributeUsage(AttributeTargets.Property)]
public class StaticDataAttribute : Attribute
{
    public string StaticData { get; private set; }

    public StaticDataAttribute(string resourceKey)
    {
        StaticData = resourceKey;
    }
}

public interface IMyRuntimeData
{
    string TabAccountLangs { get; }
    void OnPropertyChanged(string propertyName = null);
}

public class PlainOldClass : IMyRuntimeData
{
    [StaticData("FirstProperty")]
    public virtual int PropertyOne { get; set; }

    public string PropertyTwo { get; set; }
    public event PropertyChangedEventHandler PropertyChanged;

    public string TabAccountLangs { get; private set; }

    public virtual void OnPropertyChanged(string propertyName = null)
    {
        var handler = PropertyChanged;
        if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
    }
}

public class Intercetor: IInterceptor
{
    private readonly IMyRuntimeData _runtimeData;

    public Intercetor(IMyRuntimeData runtimeData)
    {
        _runtimeData = runtimeData;

    }

    public void Intercept(IInvocation invocation)
    {
        var isPropertySetter = invocation.Method.Name.StartsWith("set_");
        var isPropertyGetter = invocation.Method.Name.StartsWith("get_");

        if (isPropertySetter)
        {
            //Pre Set Logic
            invocation.Proceed();
            //Post Set Logic
            var attribute = invocation.Method.GetCustomAttributes(false).Cast<StaticDataAttribute>().SingleOrDefault();
            if (attribute != null)
            {
                string resourceKey = attribute.StaticData;
                string tabAccountLangs = _runtimeData.TabAccountLangs;
                _runtimeData.OnPropertyChanged(invocation.Method.Name.Substring(4));
            }
        } else if (isPropertyGetter)
        {
            //Pre Get Logic
            invocation.Proceed();
            //Post Get Logic
        }
        else
        {
            invocation.Proceed();
        }
    }
}

I rely heavily on interception to address cross cutting concerns.  I have used Castle's Dynamic Proxy in my implementation of the IInterceptor interface.  The actual logic isn't important or maybe relevant to your needs - but it should at least give a conceptual view of how you can achieve what you want in your specific situation.
The properties I care about are marked as virtual (so the Dynamic Proxy intercepts calls to them), and decorated with the StaticDataAttribute, to allow me to attach static data to each property.  The trickier part is those aspects of the interception that rely on data that is not determined until runtime, that is the raising of the property changed event, and using the value of this.TabAccountLangs.  These "runtime dependencies" are encapsulated within the interface IRuntimeData, which is injected in to the constructor of the interceptor.
The Main(string[] args) method shows how everything is put together.  Obviously you wouldn't use it like this in code - you could wrap this "gluing" logic within a factory pattern, or configure the interception at the level of your IoC container configuration.

A: You can not implement such attribute without building up some framework which will go through your solution and generate code for such properties behind the scene. Creating and, more importantly, debugging such thing will require a lot of effort and generally is not worth it. At least not when the only reason for that is "to shorten the code".
Instead i would recommend using inheritance and aggregation where possible. You should also consider making a Resharper template (if you are using Resharper) or VS snippets (if you are not). This will not reduce the amount of code, but it will greatly reduce the time required for writing such properties.

A: *

*Create a custom attribute and apply to those fields

*Detect when you apply the attribute: create an another app, that runs all the time, and checks wheter you applied the attribute. I would try out the Roslyn CTP

*Use partial classes. Generate the properties to another file.


text:
Q: Node addon crashes in Electron but works fine in vanilla Node I am building a Node addon on macOS to communicate with Apple's Photos framework, it will query photos from the Photos library and export them to a folder.
The addon works well in vanilla Node (v16.14.0), but it crashes in Electron. I am using Electron version 17.0, and I have rebuilt the addon with the following command:
node-gyp rebuild --target=17.0.0 --arch=x64 --dist-url=https://electronjs.org/headers

The crash happened inside [PHAsset fetchAssetsWithLocalIdentifiers:options], this is the 1st call to Photos framework, if I add some logs before this call, the log will be printed.
Here is the full crash report:
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               Electron [34152]
Path:                  /Users/USER/*/Electron.app/Contents/MacOS/Electron
Identifier:            com.github.Electron
Version:               17.0.0 (17.0.0)
Code Type:             X86-64 (Native)
Parent Process:        node [33869]
Responsible:           Terminal [1129]
User ID:               501

Date/Time:             2022-03-03 16:33:30.4984 -0500
OS Version:            macOS 12.2.1 (21D62)
Report Version:        12
Bridge OS Version:     6.2 (19P744)
Anonymous UUID:        28E2F822-6FAD-09FC-E935-ECD9E9089417

Sleep/Wake UUID:       1E7186D6-E1F4-46B5-A327-C99D4697F0BD

Time Awake Since Boot: 190000 seconds
Time Since Wake:       825 seconds

System Integrity Protection: enabled

Crashed Thread:        29

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [34152]

VM Region Info: 0 is not in any region.  Bytes before following region: 4377473024
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->
      __TEXT                      104eaf000-104eb1000    [    8K] r-x/r-x SM=COW  ...acOS/Electron

Thread 0:: CrBrowserMain Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   CoreFoundation                      0x7ff8041f8af2 __CFRunLoopServiceMachPort + 319
3   CoreFoundation                      0x7ff8041f71cb __CFRunLoopRun + 1325
4   CoreFoundation                      0x7ff8041f65dd CFRunLoopRunSpecific + 563
5   HIToolbox                           0x7ff80ce334f1 RunCurrentEventLoopInMode + 292
6   HIToolbox                           0x7ff80ce33247 ReceiveNextEventCommon + 587
7   HIToolbox                           0x7ff80ce32fe5 _BlockUntilNextEventMatchingListInModeWithFilter + 70
8   AppKit                              0x7ff806c25d88 _DPSNextEvent + 886
9   AppKit                              0x7ff806c243f4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1411
10  AppKit                              0x7ff806c16919 -[NSApplication run] + 586
11  Electron Framework                     0x110aea116 node::AsyncResource::get_async_id() const + 8894342
12  Electron Framework                     0x110ae89e2 node::AsyncResource::get_async_id() const + 8888402
13  Electron Framework                     0x110aab96a node::AsyncResource::get_async_id() const + 8638426
14  Electron Framework                     0x110a75871 node::AsyncResource::get_async_id() const + 8416993
15  Electron Framework                     0x10fd7b424 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) + 5186084
16  Electron Framework                     0x10fd7cd62 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) + 5192546
17  Electron Framework                     0x10fd78b30 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) + 5175600
18  Electron Framework                     0x10df2e255 v8::internal::ExternalReference::fast_c_call_caller_pc_address(v8::internal::Isolate*) + 1957
19  Electron Framework                     0x10df2f423 v8::internal::ExternalReference::fast_c_call_caller_pc_address(v8::internal::Isolate*) + 6515
20  Electron Framework                     0x10df2eea1 v8::internal::ExternalReference::fast_c_call_caller_pc_address(v8::internal::Isolate*) + 5105
21  Electron Framework                     0x10df2d45d v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) + 12189
22  Electron Framework                     0x10df2dd93 v8::internal::ExternalReference::fast_c_call_caller_pc_address(v8::internal::Isolate*) + 739
23  Electron Framework                     0x10dc60be8 ElectronMain + 152
24  dyld                                   0x10db944fe start + 462

Thread 1:
0   libsystem_pthread.dylib             0x7ff80412cfec start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib             0x7ff80412cfec start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib             0x7ff80412cfec start_wqthread + 0

Thread 4:: ThreadPoolServiceThread
0   libsystem_kernel.dylib              0x7ff8040fd9c6 kevent64 + 10
1   Electron Framework                     0x110b14970 operator delete[](void*) + 138448
2   Electron Framework                     0x110aab96a node::AsyncResource::get_async_id() const + 8638426
3   Electron Framework                     0x110a75871 node::AsyncResource::get_async_id() const + 8416993
4   Electron Framework                     0x110ac78a8 node::AsyncResource::get_async_id() const + 8752920
5   Electron Framework                     0x110ab4fed node::AsyncResource::get_async_id() const + 8676957
6   Electron Framework                     0x110ac7a3d node::AsyncResource::get_async_id() const + 8753325
7   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
8   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
9   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 5:: ThreadPoolForegroundWorker
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   Electron Framework                     0x110af06af node::AsyncResource::get_async_id() const + 8920351
3   Electron Framework                     0x110ac0f20 node::AsyncResource::get_async_id() const + 8725904
4   Electron Framework                     0x110ac1ab4 node::AsyncResource::get_async_id() const + 8728868
5   Electron Framework                     0x110ac153d node::AsyncResource::get_async_id() const + 8727469
6   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
7   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
8   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 6:: ThreadPoolBackgroundWorker
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   Electron Framework                     0x110af06af node::AsyncResource::get_async_id() const + 8920351
3   Electron Framework                     0x110ac0f20 node::AsyncResource::get_async_id() const + 8725904
4   Electron Framework                     0x110ac1ab4 node::AsyncResource::get_async_id() const + 8728868
5   Electron Framework                     0x110ac14ad node::AsyncResource::get_async_id() const + 8727325
6   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
7   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
8   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 7:: ThreadPoolForegroundWorker
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   Electron Framework                     0x110af06af node::AsyncResource::get_async_id() const + 8920351
3   Electron Framework                     0x110ac0f20 node::AsyncResource::get_async_id() const + 8725904
4   Electron Framework                     0x110ac1ab4 node::AsyncResource::get_async_id() const + 8728868
5   Electron Framework                     0x110ac153d node::AsyncResource::get_async_id() const + 8727469
6   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
7   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
8   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 8:: Chrome_IOThread
0   libsystem_kernel.dylib              0x7ff8040fd9c6 kevent64 + 10
1   Electron Framework                     0x110b14970 operator delete[](void*) + 138448
2   Electron Framework                     0x110aab96a node::AsyncResource::get_async_id() const + 8638426
3   Electron Framework                     0x110a75871 node::AsyncResource::get_async_id() const + 8416993
4   Electron Framework                     0x110ac78a8 node::AsyncResource::get_async_id() const + 8752920
5   Electron Framework                     0x10fd7e0bf v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) + 5197503
6   Electron Framework                     0x110ac7a3d node::AsyncResource::get_async_id() const + 8753325
7   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
8   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
9   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 9:: MemoryInfra
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   Electron Framework                     0x110af06af node::AsyncResource::get_async_id() const + 8920351
3   Electron Framework                     0x110af053e node::AsyncResource::get_async_id() const + 8919982
4   Electron Framework                     0x110a5650c node::AsyncResource::get_async_id() const + 8289148
5   Electron Framework                     0x110aab96a node::AsyncResource::get_async_id() const + 8638426
6   Electron Framework                     0x110a75871 node::AsyncResource::get_async_id() const + 8416993
7   Electron Framework                     0x110ac78a8 node::AsyncResource::get_async_id() const + 8752920
8   Electron Framework                     0x110ac7a3d node::AsyncResource::get_async_id() const + 8753325
9   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
10  libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
11  libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 10:
0   libsystem_kernel.dylib              0x7ff8040f945e kevent + 10
1   Electron Framework                     0x10dc6021e uv_free_interface_addresses + 1310
2   Electron Framework                     0x10dc4eff0 uv_run + 320
3   Electron Framework                     0x114399ecf node::CommonEnvironmentSetup::context() const + 164335
4   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
5   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 11:
0   libsystem_kernel.dylib              0x7ff8040f7506 __psynch_cvwait + 10
1   libsystem_pthread.dylib             0x7ff804131a69 _pthread_cond_wait + 1224
2   Electron Framework                     0x10dc5add9 uv_cond_wait + 9
3   Electron Framework                     0x11439a0a2 node::CommonEnvironmentSetup::context() const + 164802
4   Electron Framework                     0x114397a77 node::CommonEnvironmentSetup::context() const + 155031
5   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
6   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 12:
0   libsystem_kernel.dylib              0x7ff8040f7506 __psynch_cvwait + 10
1   libsystem_pthread.dylib             0x7ff804131a69 _pthread_cond_wait + 1224
2   Electron Framework                     0x10dc5add9 uv_cond_wait + 9
3   Electron Framework                     0x11439a0a2 node::CommonEnvironmentSetup::context() const + 164802
4   Electron Framework                     0x114397a77 node::CommonEnvironmentSetup::context() const + 155031
5   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
6   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 13:
0   libsystem_kernel.dylib              0x7ff8040f7506 __psynch_cvwait + 10
1   libsystem_pthread.dylib             0x7ff804131a69 _pthread_cond_wait + 1224
2   Electron Framework                     0x10dc5add9 uv_cond_wait + 9
3   Electron Framework                     0x11439a0a2 node::CommonEnvironmentSetup::context() const + 164802
4   Electron Framework                     0x114397a77 node::CommonEnvironmentSetup::context() const + 155031
5   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
6   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 14:
0   libsystem_kernel.dylib              0x7ff8040f4af6 semaphore_wait_trap + 10
1   Electron Framework                     0x10dc5b3d0 uv_sem_wait + 16
2   Electron Framework                     0x11440bc83 node::SetTracingController(v8::TracingController*) + 52211
3   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
4   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 15:: NetworkConfigWatcher
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   CoreFoundation                      0x7ff8041f8af2 __CFRunLoopServiceMachPort + 319
3   CoreFoundation                      0x7ff8041f71cb __CFRunLoopRun + 1325
4   CoreFoundation                      0x7ff8041f65dd CFRunLoopRunSpecific + 563
5   Foundation                          0x7ff80505d66e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 216
6   Electron Framework                     0x110ae9fa9 node::AsyncResource::get_async_id() const + 8893977
7   Electron Framework                     0x110ae89e2 node::AsyncResource::get_async_id() const + 8888402
8   Electron Framework                     0x110aab96a node::AsyncResource::get_async_id() const + 8638426
9   Electron Framework                     0x110a75871 node::AsyncResource::get_async_id() const + 8416993
10  Electron Framework                     0x110ac78a8 node::AsyncResource::get_async_id() const + 8752920
11  Electron Framework                     0x110ac7a3d node::AsyncResource::get_async_id() const + 8753325
12  Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
13  libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
14  libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 16:: CrShutdownDetector
0   libsystem_kernel.dylib              0x7ff8040f54e6 read + 10
1   Electron Framework                     0x10de0b496 v8::CodeEvent::GetFunctionName() + 20854
2   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
3   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
4   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 17:: NetworkConfigWatcher
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   CoreFoundation                      0x7ff8041f8af2 __CFRunLoopServiceMachPort + 319
3   CoreFoundation                      0x7ff8041f71cb __CFRunLoopRun + 1325
4   CoreFoundation                      0x7ff8041f65dd CFRunLoopRunSpecific + 563
5   Foundation                          0x7ff80505d66e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 216
6   Electron Framework                     0x110ae9fa9 node::AsyncResource::get_async_id() const + 8893977
7   Electron Framework                     0x110ae89e2 node::AsyncResource::get_async_id() const + 8888402
8   Electron Framework                     0x110aab96a node::AsyncResource::get_async_id() const + 8638426
9   Electron Framework                     0x110a75871 node::AsyncResource::get_async_id() const + 8416993
10  Electron Framework                     0x110ac78a8 node::AsyncResource::get_async_id() const + 8752920
11  Electron Framework                     0x110ac7a3d node::AsyncResource::get_async_id() const + 8753325
12  Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
13  libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
14  libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 23:: NetworkConfigWatcher
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   CoreFoundation                      0x7ff8041f8af2 __CFRunLoopServiceMachPort + 319
3   CoreFoundation                      0x7ff8041f71cb __CFRunLoopRun + 1325
4   CoreFoundation                      0x7ff8041f65dd CFRunLoopRunSpecific + 563
5   Foundation                          0x7ff80505d66e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 216
6   Electron Framework                     0x110ae9fa9 node::AsyncResource::get_async_id() const + 8893977
7   Electron Framework                     0x110ae89e2 node::AsyncResource::get_async_id() const + 8888402
8   Electron Framework                     0x110aab96a node::AsyncResource::get_async_id() const + 8638426
9   Electron Framework                     0x110a75871 node::AsyncResource::get_async_id() const + 8416993
10  Electron Framework                     0x110ac78a8 node::AsyncResource::get_async_id() const + 8752920
11  Electron Framework                     0x110ac7a3d node::AsyncResource::get_async_id() const + 8753325
12  Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
13  libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
14  libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 24:: ThreadPoolSingleThreadSharedForeground1
0   libsystem_kernel.dylib              0x7ff8040f4aba mach_msg_trap + 10
1   libsystem_kernel.dylib              0x7ff8040f4e2b mach_msg + 59
2   Electron Framework                     0x110af06af node::AsyncResource::get_async_id() const + 8920351
3   Electron Framework                     0x110ac0f20 node::AsyncResource::get_async_id() const + 8725904
4   Electron Framework                     0x110ac1ab4 node::AsyncResource::get_async_id() const + 8728868
5   Electron Framework                     0x110ac156d node::AsyncResource::get_async_id() const + 8727517
6   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
7   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
8   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 25:: CacheThread_BlockFile
0   libsystem_kernel.dylib              0x7ff8040fd9c6 kevent64 + 10
1   Electron Framework                     0x110b14970 operator delete[](void*) + 138448
2   Electron Framework                     0x110aab96a node::AsyncResource::get_async_id() const + 8638426
3   Electron Framework                     0x110a75871 node::AsyncResource::get_async_id() const + 8416993
4   Electron Framework                     0x110ac78a8 node::AsyncResource::get_async_id() const + 8752920
5   Electron Framework                     0x110ac7a3d node::AsyncResource::get_async_id() const + 8753325
6   Electron Framework                     0x110ae40b5 node::AsyncResource::get_async_id() const + 8869669
7   libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
8   libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 29 Crashed:
0   ???                                            0x0 ???
1   libsystem_malloc.dylib              0x7ff803f5797f malloc_zone_batch_malloc + 64
2   CoreData                            0x7ff80a136151 _PFAllocateObjects + 145
3   CoreData                            0x7ff80a25b14c +[NSManagedObjectModel _newModelFromOptimizedEncoding:error:] + 4684
4   CoreData                            0x7ff80a1355d4 -[NSManagedObjectModel(_NSInternalMethods) initWithContentsOfOptimizedURL:] + 260
5   CoreData                            0x7ff80a0e473c -[NSManagedObjectModel(_NSInternalMethods) _initWithContentsOfURL:options:] + 476
6   PhotoLibraryServices                0x7ff90c955c88 __43+[PLPersistentContainer managedObjectModel]_block_invoke + 81
7   PhotoLibraryServicesCore            0x7ffb0c42663b __pl_dispatch_once_block_invoke + 25
8   libdispatch.dylib                   0x7ff803f7acc9 _dispatch_client_callout + 8
9   libdispatch.dylib                   0x7ff803f7bec1 _dispatch_once_callout + 20
10  PhotoLibraryServicesCore            0x7ffb0c42661c pl_dispatch_once + 144
11  PhotoLibraryServices                0x7ff90c955c20 +[PLPersistentContainer managedObjectModel] + 69
12  Photos                              0x7ff90a43c413 +[PHQuery _relationshipForFetchType:predicate:] + 247
13  Photos                              0x7ff90a43c2ee -[PHQuery collectionFetchType] + 50
14  Photos                              0x7ff90a43c1d2 -[PHQuery copyWithZone:] + 204
15  Photos                              0x7ff90a43bdbd -[PHFetchResult initWithQuery:oids:registerIfNeeded:usingManagedObjectContext:] + 144
16  Photos                              0x7ff90a43bcee -[PHFetchResult initWithQuery:] + 88
17  Photos                              0x7ff90a43bc32 -[PHQuery executeQuery] + 121
18  Photos                              0x7ff90a56d6fe __51+[PHAsset fetchAssetsWithLocalIdentifiers:options:]_block_invoke + 65
19  Photos                              0x7ff90a43a7eb +[PHObject authorizationAwareFetchResultWithOptions:fetchBlock:] + 83
20  Photos                              0x7ff90a56ab06 +[PHAsset fetchAssetsWithLocalIdentifiers:options:] + 123
21  native.node                            0x10bdd54d9 -[PhotosExport exportVideoAsset:withError:] + 249 (PhotosExport.m:138)
22  native.node                            0x10bdd4ce5 -[PhotosExport exportAsset:withError:] + 101
23  native.node                            0x10bddb1e8 Napi_PhotosExport_AsyncWorker::Execute() + 120 (Napi_PhotosExport.mm:70)
24  native.node                            0x10bddb63a Napi::AsyncWorker::OnExecute(Napi::Env) + 26 (napi-inl.h:4890)
25  Electron Framework                     0x10dc4b334 uv_cancel + 740
26  libsystem_pthread.dylib             0x7ff8041314f4 _pthread_start + 125
27  libsystem_pthread.dylib             0x7ff80412d00f thread_start + 15

Thread 29 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000000000305  rcx: 0x0000000000000305  rdx: 0x0000002e01034000
  rdi: 0x0000000115e1bc40  rsi: 0x0000000000000078  rbp: 0x0000700016564de0  rsp: 0x0000700016564da8
   r8: 0x0000002e010011a0   r9: 0x0000000000000000  r10: 0x00007ff845bc3c42  r11: 0x00007ff803fc865f
  r12: 0x0000000000000078  r13: 0x00007ff845976000  r14: 0x0000002e01034000  r15: 0x0000000000000078
  rip: 0x0000000000000000  rfl: 0x0000000000010246  cr2: 0x0000000000000000

Logical CPU:     2
Error Code:      0x00000014 (no mapping for user instruction read)
Trap Number:     14

Binary Images:
    0x7ff8040f4000 -     0x7ff80412afff libsystem_kernel.dylib (*) <c1d58a50-5a4d-3bcb-a1fc-ec0902ce34d3> /usr/lib/system/libsystem_kernel.dylib
    0x7ff804178000 -     0x7ff80467afff com.apple.CoreFoundation (6.9) <9b112884-be6c-3c7f-9a2a-a47c491105db> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7ff80ce01000 -     0x7ff80d0f8fff com.apple.HIToolbox (2.1.1) <c538aa78-7afd-3f8a-8fdb-1fc2acde6b3f> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
    0x7ff806be7000 -     0x7ff807a78fff com.apple.AppKit (6.9) <9d3ab204-4858-3120-b002-5c38b02edec4> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       0x10dc47000 -        0x1157e8fff com.github.Electron.framework (*) <4c4c4453-5555-3144-a1b9-be04e254285a> /Users/USER/*/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework
       0x10db8f000 -        0x10dbfafff dyld (*) <7de33963-bbc5-3996-ba6e-f1d562c17c95> /usr/lib/dyld
    0x7ff80412b000 -     0x7ff804136fff libsystem_pthread.dylib (*) <ee564342-d8f2-396d-b642-40092cf34d82> /usr/lib/system/libsystem_pthread.dylib
    0x7ff804ffe000 -     0x7ff8053b8fff com.apple.Foundation (6.9) <bf00b016-c645-3574-b74f-4386750fb009> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
    0x7ff803f4c000 -     0x7ff803f77fff libsystem_malloc.dylib (*) <db7b390b-09ca-3e17-a367-5ff55dc92262> /usr/lib/system/libsystem_malloc.dylib
    0x7ff80a0e3000 -     0x7ff80a4fdfff com.apple.CoreData (120) <71b53cb4-c37f-31ff-a569-35d3c415a335> /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
    0x7ff90c947000 -     0x7ff90d0bdfff com.apple.PhotoLibraryServices (1.0) <f5a10a94-a6c6-3585-a764-87654cf58aad> /System/Library/PrivateFrameworks/PhotoLibraryServices.framework/Versions/A/PhotoLibraryServices
    0x7ffb0c3e7000 -     0x7ffb0c4c9fff com.apple.PhotoLibraryServicesCore (1.0) <cea2ad49-ab1e-3c5b-98f6-d1dd03632803> /System/Library/PrivateFrameworks/PhotoLibraryServicesCore.framework/Versions/A/PhotoLibraryServicesCore
    0x7ff803f78000 -     0x7ff803fbefff libdispatch.dylib (*) <67d92c93-aa68-34c2-964b-23e8a8d32098> /usr/lib/system/libdispatch.dylib
    0x7ff90a436000 -     0x7ff90a6effff com.apple.Photos (1.0) <bdb65359-c7da-3c43-9df7-c582914dc645> /System/Library/Frameworks/Photos.framework/Versions/A/Photos
       0x10bdd0000 -        0x10bde3fff native.node (*) <757866cd-ed17-3a56-86f3-1bb253ecc27f> /Users/USER/*/native.node

A: Try using the longer form of the AsyncWorker - the one that allows you to set a resource_name or even an async_resource. The resource name must be a string that will appear when debugging async stack traces and in the async_hooks API. The resource can be an empty V8 object (obtained by calling Napi::Object::New(env)). I don't think this is a normal behavior, maybe it is a bug somewhere between Electron 17 and node-addon-api. If you can find the AsyncWorker that is causing it, you can try opening an issue on their Github.
Also double-check that you are building with the right ABI - because Electron has decided to publish a version 17 using the Node.js version 16 ABI and this can also be the reason. Instead of using the CLI options, use this:
export npm_config_target=17.0.0
export npm_config_arch=x64
export npm_config_target_arch=x64
export npm_config_disturl=https://electronjs.org/headers
export npm_config_runtime=electron
export npm_config_build_from_source=true
HOME=~/.electron-gyp npm install


text:
Q: What are these commands for (fglrx-updates installation)? And how to undo one of them? My ubuntu 14.04 was not able to install fglrx-updates. I have two graphic cards (intel and amd). I searched on the net and found some answers related to it.
Firstly i tried this one:
sudo apt-get install libcheese*

(the first one did not work)
Secondly i tried this one from another answer:
sudo apt-get install --install-recommends xserver-xorg libgl1-mesa-glx libegl1-mesa-drivers

(After the second one, i was able to install it successfully)
Now my question is, how can i undo the changes done by the first one, as i think it was not necessary.
Edit: This is what a post on the given link says about the first one:
"By running "sudo apt-get install libcheese*" you are basically reverting the mesa updates of 14.0.4.2. It'll remove all the new packages and give you the graphic stack compared to before installing the LTS enabled stack. Hence you can install fglrx again. You'll still have the new Utopic kernel though. I'm not sure if that's a good or bad thing. I can imagine some incompatibility issues without the new mesa stack, but if it works for you for the time being..."
https://bugs.launchpad.net/ubuntu/+source/fglrx-installer/+bug/1424491

A: You can remove a package by:
sudo apt-get remove <packagename>

So in your case it will be:
sudo apt-get remove libcheese*

But I will suggest not to do this unless you have a strong reason to.
Running sudo apt-get autoremove will be a safe bet.

A: First, check if the package is required by any tool by running the command
apt-cache rdepends $package

in this case
apt-cache rdepends libcheese*

If it is not used by any other package, then it is safe to remove it.
To remove a software completely use
sudo apt-get purge $package

That is in this case
sudo apt-get purge libcheese*

To remove a software but with keeping its configuration files, use
sudo apt-get remove $package

that is
sudo apt-get remove libcheese*


text:
Q: How to friend a specific template specialization? Is there a syntax for friending only certain specializations of a templated class, or do you have to friend all specializations with the likes of:
template<class FooType> friend class Bar;

If it existed, I would be looking for something like:
template<class FooType> friend class Bar<FooType const>;

It seems the specializations have their own "friendable" identity, because they are not friends of each other by default.  For instance, getFoo() here can't be called by the non-const case derived from the const specialization because it is private:
template<class FooType> class Bar;

template<class FooType>
class Bar<FooType const> {
public:
    Bar (std::string name) : _foo (name) { }
    FooType const * operator->() const
        { return &getFoo(); }
private:
    FooType const & getFoo() const
        { return _foo; }
private:
    FooType _foo;
};

template<class FooType>
class Bar : public Bar<FooType const> {
public:
    Bar (std::string name) : Bar<FooType const> (name) { }
    FooType * operator->()
        { return &getFoo(); }
private:
    FooType & getFoo()
        { return const_cast<FooType &>(Bar<FooType const>::getFoo()); }
};

You have to add template<class FooType> friend Bar; to the const specialization.
(As an aside, the tag description for friend is sort of funny.)

A: You are looking for
friend Bar<FooType const>;

which is one of two ways in which friends can be declared. The first syntax declares a class a friend:
friend Type;

where Type can be a simple type Bar (which is not a template), or it can be a specific instantiation of a class template, for example Baz<int>. int can, of course, also be a template parameter from the enclosing class template or whatever you like. The point is: It's a single type that is given friend status.
The second syntax declares a class template to be a friend:
template< ... > friend class ClassTemplate;

where the ... is the template parameter declaration of ClassTemplate. As you can see, you have to specify just the template parameter list, but the list is not used anywhere. It is not possible to combine both syntaxes, there is no way to "partially friend" a class template or to use SFINAE/enable_if to enable or disable certain friend declarations. In fact it doesn't even make much sense to add names to the template parameters, in your above I'd just write
template< class > friend class Bar;

as adding FooType doesn't really add anything of value here.


text:
Q: Pygame installation failed: metadata-generation-failed I tried to install pygame, but the following error was shown in the console. How can I properly install pygame without any errors?
× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
PS C:\Users\HP> py -m pip install setuptools -U
Requirement already satisfied: setuptools in c:\users\hp\appdata\local\programs\python\python311\lib\site-packages (65.5.0)
Collecting setuptools
  Downloading setuptools-67.1.0-py3-none-any.whl (1.1 MB)
     ---------------------------------------- 1.1/1.1 MB 1.4 MB/s eta 0:00:00
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 65.5.0
    Uninstalling setuptools-65.5.0:
      Successfully uninstalled setuptools-65.5.0
Successfully installed setuptools-67.1.0
PS C:\Users\HP> pip install pygame
Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [80 lines of output]

      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using WINDOWS configuration...

      Traceback (most recent call last):
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 1348, in do_open
          h.request(req.get_method(), req.selector, req.data, headers,
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 1282, in request
          self._send_request(method, url, body, headers, encode_chunked)
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 1328, in _send_request
          self.endheaders(body, encode_chunked=encode_chunked)
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 1277, in endheaders
          self._send_output(message_body, encode_chunked=encode_chunked)
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 1037, in _send_output
          self.send(msg)
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 975, in send
          self.connect()
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 1454, in connect
          self.sock = self._context.wrap_socket(self.sock,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 517, in wrap_socket
          return self.sslsocket_class._create(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1075, in _create
          self.do_handshake()
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1346, in do_handshake
          self._sslobj.do_handshake()
      ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:992)

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\HP\AppData\Local\Temp\pip-install-384h3q66\pygame_166167a860e649829039ff1d78b95041\setup.py", line 359, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "C:\Users\HP\AppData\Local\Temp\pip-install-384h3q66\pygame_166167a860e649829039ff1d78b95041\buildconfig\config.py", line 225, in main
          deps = CFG.main(**kwds)
                 ^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Temp\pip-install-384h3q66\pygame_166167a860e649829039ff1d78b95041\buildconfig\config_win.py", line 497, in main
          and download_win_prebuilt.ask(**download_kwargs):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Temp\pip-install-384h3q66\pygame_166167a860e649829039ff1d78b95041\buildconfig\download_win_prebuilt.py", line 290, in ask
          update(x86=x86, x64=x64)
        File "C:\Users\HP\AppData\Local\Temp\pip-install-384h3q66\pygame_166167a860e649829039ff1d78b95041\buildconfig\download_win_prebuilt.py", line 273, in update
          download_prebuilts(download_dir, x86=x86, x64=x64)
        File "C:\Users\HP\AppData\Local\Temp\pip-install-384h3q66\pygame_166167a860e649829039ff1d78b95041\buildconfig\download_win_prebuilt.py", line 124, in download_prebuilts
          download_sha1_unzip(url, checksum, temp_dir, 1)
        File "C:\Users\HP\AppData\Local\Temp\pip-install-384h3q66\pygame_166167a860e649829039ff1d78b95041\buildconfig\download_win_prebuilt.py", line 54, in download_sha1_unzip
          response = urllib.urlopen(request).read()
                     ^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 216, in urlopen
          return opener.open(url, data, timeout)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 519, in open
          response = self._open(req, data)
                     ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 536, in _open
          result = self._call_chain(self.handle_open, protocol, protocol +
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 496, in _call_chain
          result = func(*args)
                   ^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 1391, in https_open
          return self.do_open(http.client.HTTPSConnection, req,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 1351, in do_open
          raise URLError(err)
      urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:992)>
      Making dir :prebuilt_downloads:
      Downloading... https://www.libsdl.org/release/SDL2-devel-2.0.18-VC.zip ed561079ec622b0bab5a9e02976f5d540b0622da

      ---
      For help with compilation see:
          https://www.pygame.org/wiki/CompileWindows
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.


text:
Q: Echarts wordcloud 2 onclick I am using word-cloud2 with echarts:
Is there any option to add onclick to each word on echarts word-cloud2. My code is in js and is as follows:
 var chart = echarts.init(document.getElementById('main'));

var option = {
    tooltip: {},
    series: [ {
        type: 'wordCloud',
        gridSize: 2,
        sizeRange: [12, 50],
        rotationRange: [-90, 90],
        shape: 'apple',
        width: 600,
        height: 400,
        tooltip: {
            width: 0,
            height: 0,
          },
        drawOutOfBound: true,

        data: [
            {
                name: 'Machine Learning',
                value: 10000,

            },

        ]
    } ]
};

chart.setOption(option);

window.onresize = chart.resize;

A: after your call to setOption add this:
chart.on('click', 'series.wordCloud', function (el) {
    console.log(el);
    // add your custom logic here
});


text:
Q: How to have child override values of parent class, but use parent's method Apologies if this has been posted before, I keep only getting results for overriding the opposite way.
I want to be able to do 2 things:

*

*Reference the parent variable from the child class, in assigning the value for the child variable.

*Have the method in the adult class that references this variable use the child classes value. That way, I can have a lot of child classes, but not have the same repeating code for the method.

Here's a super simple pseudo-example of what I mean:
child class:
public class ChildClass extends AdultClass {
    static int a=super.a+1;
}

adult class:
public class AdultClass {
    static int a=5;
    static public int getA() {
        return a;
    }
}

class that uses ChildClass object:
public class ClientClass {
    public static void main(String[] args) {
        ChildClass.a <-I want this to =6
        ChildClass.getA() <-I want this to return 6
    }
}

A: If you want to leverage Java's polymorphism, you'll have to involve class instances. Static members cannot display polymorphic behavior, which you apparently require from AdultClass.getA().

A: then simply make the member a protected one, and use it as the child's own member.
this link may be useful too.
why instance variable of super class is not overridden in sub class method


text:
Q: Tomcat filter for enabling HPKP I am trying to enable HPKP certificate pinning in our app's tomcat server. I added a filter to include the HSTS and HPKP directives. I am getting the HSTS and HPKP directives in the response header as expected.
But even after I change the certificate in the server or intercept the request and send a fake certificate, browser does not stop the request. Browser is HPKP capable as it is blocking other HPKP enabled sites like facebook when the request is intercepted and presented with a fake certificate.
Just wondering if there is anything wrong the way I am generating the hash of the public key and hence browser is not pinning the key? Any feed back if anyone has enabled HPKP for tomcat?
Filter added in web.xml
    <filter>
            <filter-name>HttpsSecFilter</filter-name>
            <filter-class>com.x.x.x.x.x.HttpsSecurityFilter</filter-class>
    </filter>
    <filter-mapping>
            <filter-name>HttpsSecFilter</filter-name>
            <url-pattern>..[url-pattern]..</url-pattern>
    </filter-mapping>

Filter code (Modified to include only relevant parts for brevity)
public class HttpsSecurityFilter implements Filter {
    private boolean _isHTTSEnabled = false;
    private long _httsMaxAge = -1;

    private boolean _isHPKPEnabled = false;
    private long _hpkpMaxAge = -1;
    private String _hpkpCertHashesString = null;

    private boolean _includeSubdomains = false;

    @Override
    public void destroy() {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response,
                FilterChain chain) throws IOException, ServletException {

        if (_isHTTSEnabled && response instanceof HttpServletResponse) {
            ((HttpServletResponse) response).setHeader("Strict-Transport-Security",
                                                       "max-age=" + _httsMaxAge);
        }

        if (_isHPKPEnabled && response instanceof HttpServletResponse) {
            ((HttpServletResponse) response).setHeader("Public-Key-Pins",
                                                       _hpkpCertHashesString);
        }

        chain.doFilter(request, response);
    }

    @Override
    public void init(FilterConfig arg0) throws ServletException {
        //Read from application configuration file
        _isHTTSEnabled = true;
        _httsMaxAge = 5184000;

        _isHPKPEnabled = true;
        _hpkpMaxAge = 5184000;
        _includeSubdomains = false;

        if (_isHTTSEnabled) {

            try {
                KeyStore keyStore = KeyStore.getInstance("JKS");
                InputStream is = new FileInputStream(APP_HOME + "/conf/keystore");
                keyStore.load(is, keysotrePassword);
                is.close();

                Certificate cert = keyStore.getCertificate(myappcetificatealias);

                MessageDigest md = MessageDigest.getInstance("SHA-256");
                byte[] digest = md.digest(cert.getPublicKey().getEncoded());
                _hpkpCertHashesString = "pin-sha256=\"" + java.util.Base64.getEncoder()
                                        .encodeToString(digest) + "\"; max-age=" +
                                         _hpkpMaxAge;
            } catch (Exception e) {
                ;
            }
        }
    }
}

Directives from response header
Public-Key-Pins:pin-sha256="JdZ3itf02UwsCav0X26wcSQLGfo="; max-age=5184000
Strict-Transport-Security:max-age=5184000

A: The Public Key Pinning Extension for HTTP (HPKP) is a security feature that tells a web client to associate a specific cryptographic public key with a certain web server to decrease the risk of MITM attacks with forged certificates.
Unfortunately Apache Tomcat does not support HPKP filter. So we have to write our own 'Global filter', Valve.
First you need to extract the public key information from your certificate or key file and encode them using Base64.
The following commands will help you extract the Base64 encoded information from a key file, a certificate signing request, or a certificate.
openssl rsa -in my-rsa-key-file.key -outform der -pubout | openssl dgst -sha256 -binary | openssl enc -base64

openssl ec -in my-ecc-key-file.key -outform der -pubout | openssl dgst -sha256 -binary | openssl enc -base64

openssl req -in my-signing-request.csr -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

openssl x509 -in my-certificate.crt -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

The following command will extract the Base64 encoded information for a website.
openssl s_client -servername www.example.com -connect www.example.com:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

Example HPKP Header
Public-Key-Pins:
  pin-sha256="cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=";
  pin-sha256="M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE=";
  max-age=5184000; includeSubDomains;
  report-uri="https://www.example.org/hpkp-report"

In this example, pin-sha256="cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=" pins the server's public key used in production. The second pin declaration pin-sha256="M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE=" also pins the backup key. max-age=5184000 tells the client to store this information for two months, which is a reasonable time limit according to the IETF RFC. This key pinning is also valid for all subdomains, which is told by the includeSubDomains declaration. Finally, report-uri="https://www.example.net/hpkp-report" explains where to report pin validation failures.
Now create a Valve as described below.
Create a Maven Java Application.
Add the following dependency:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>catalina</artifactId>
<version>6.0.53</version>
<scope>provided</scope>
</dependency>

*

*Create your Java class and extend it from ValveBase.

*Implement the invoke(Request, Response) method.
public class GlobalFilterValve extends ValveBase {

    @Override
    public void invoke(Request request, Response response) throws IOException, ServletException {
    response.setHeader("Public-Key-Pins", "pin-sha256=\"cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=\"; pin-sha256=\"M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE=\"; max-age=5184000; includeSubDomains");
    getNext().invoke(request, response);
    }

}

*Build your library (.jar) file

*Copy the jar file in the    ${tomcat.home}/lib directory.

*Configure the server.xml to use your    new valve. For example:

<valve className="org.devan.GlobalFilterValve"/>

*

*Start the server to see    your new valve in action

Thank you !

A: Try to update /etc/apache2/sites-enabled/website.conf
or /etc/apache2/httpd.conf
Header set Public-Key-Pins "pin-sha256=\"JdZ3itf02UwsCav0X26wcSQLGfo=\"; max-age=5184000; includeSubDomains


text:
Q: Spark-SQL Query Hints for Join Performance Improvement I have recently been introduced to SparkSQL. We use Spark 2.4. I recently found out that SparkSQL query supports the following hints for its Join strategies:

*

*BROADCAST hint

*MERGE hint

*SHUFFLE_HASH hint

Unfortunately, I have not found any online materials which elaborately discuss these hints and their application scenarios. I wish to learn some tips regarding when to use these hints in a query Join for improving query performance.
Can anyone explain with some examples.
Any help is appreciated.
Thanks

A: *

*Broadcast join is very high performance join with sending data of the small table to every executor to execute a map-side join . here is the configuration :spark.sql.autoBroadcastJoinThreshold

*Sort-merge join is a default join choice after spark 2.3

there are some post ,Hope it help you:
Spark SQL Joins
Sort-Merge Join


text:
Q: Status bar shifts views down I have a view controller in which navigation bar is set to hidden and
showing my own UIView as navigation bar and have made it transparent.
I have also set my views frame Y position to 0. so it starts from the Top without any showing any space.
[self.navigationController.navigationBar setHidden:YES];

navBarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];

navBarView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top-bg.png"]];

[self.view addSubview:navBarView];

Above code works when I load this view controller but if I push to any other view controller and comes back to this view controller then status bar takes space and pushes views down.
how to fix it. I have tried every solution known to me.

A: I guess something may be wrong with layout constraints. Please try the following code:
UIView* navBarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];

navBarView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top-bg.png"]];

NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings(navBarView);
NSArray* horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|-[navBarView]-|"
                                        options:0 metrics:nil views:viewsDictionary];
NSArray* verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[navBarView(64)]-|"
                                                                         options:0 metrics:nil views:viewsDictionary];
NSArray* constraints = [horizontalConstraints arrayByAddingObjectsFromArray:verticalConstraints];
[navBarView addConstraints:constraints];

[self.view addSubview:navBarView];

A: Can you try adding your code to viewWillAppear and check if that works ?


text:
Q: How to call powershell commands in a row from python I am trying to run this ps command within a python script :

subprocess.call('powershell.exe $username = "admin@example.com";$password = Get-Content "C:/Scripts/user.txt" | ConvertTo-SecureString;$cred = new-object -typename System.Management.Automation.PSCredential ` -argumentlist $username, $password;Connect-MsolService -Credential $cred;Get-MsolUser -UserPrincipalName user@example, shell=TRUE)

So basically as you can understand I call this command within the script and autologin in azure and get the user. My problem is that I am getting this error :

'ConvertTo-SecureString' is not recognized as an internal or external command,
operable program or batch file.

Any ideas? Thank you so much in advance everybody.

A: You should run this as it was a normal CMD line. Use CMD's escape symbol ^ before special chars.
Example:
powershell.exe -Command Get-ChildItem ^| ConvertTo-Json

In difficult cases it's easier to use powershell.exe -EncodedCommand ENCCMD where ENCCMD is Base64-encoded text.

Avoid using MSOL Powershell CmdLets, use Microsoft Graph Api /users natively in python.


text:
Q: neo4j Cypher Grouping I have a database of tweet nodes and each tweet has a userId field with relationships based on if the tweet was replied to. I am trying to write a query where I group all of the tweets by user while preserving tweet relationships to see the relationship between users.
So far I have
match (n:Tweet) return  distinct(n.userId), n
but this does not work because the relationships are not preserved. Does anybody know how to do this?

A: I'm not quite sure what you're asking...  You're talking about relationships but you haven't matched on any.
Speaking generally when you use an aggregate function (such as sum, count, collect, etc...) in a RETURN (or a WITH) clause Neo4j will automatically group by the other columns in the clause.  Here's an example of something that you might do:
MATCH (source_tweet:Tweet {userId: 1234})<-[:RETWEET_OF]-(retweet:Tweet)
RETURN source_tweet:Tweet.id, source_tweet:Tweet.text, count(retweet)

This will give you one line for each tweet userId #1234 has made and a count of the number of retweets for each of those tweets.

A: Adding another answer in response to your comment.
So if you want to find out if users have had a conversation you might do:
MATCH (source_tweet:Tweet)<-[:REPLY_TO]-(reply_tweet:Tweet)
MATCH
  (source_user:User {userId: source_tweet.user}),
  (reply_user:User {userId: reply_tweet.user})
CREATE UNIQUE reply_user-[:REPLIED_TO]->(source_user)

Then you could do:
MATCH (user1)-[:REPLIED_TO]-(user2)
WHERE ID(user1) < ID(user2)
RETURN user1.userId, user2.user_id

... to get all of the combinations.
Though like I said, you should really have relationships between the tweets and users indicating which user made the tweet.  If you had that the query might be like:
MATCH (source_user:User)-[:WROTE]->(source_tweet:Tweet)<-[:REPLY_TO]-(reply_tweet:Tweet)<-[:WROTE]-(reply_user:User)
CREATE reply_user-[:REPLIED_TO]->(source_user)

And that should also be much faster because you're doing relationship traversals rather than looking up in the userId index.


text:
Q: How does the asset schema property work with img assets? I am trying to pass an image as an asset property type to some other component (so that either a #selector or a url(url) can be passed) but it seems to take in the entire html component, instead of just the url.
<!DOCTYPE html>

    <title>Hello, WebVR! - A-Frame</title>
    <meta name='description' content='Hello, WebVR! - A-Frame'>

Thought I might look to see how A-Frame handles this in the material component can't see where does the 'src' property on material come from?

Material component (can't see src): https://github.com/aframevr/aframe/blob/master/src/components/material.js
Thanks!
EDIT:
As per Piotr's discoveries below it looks like images are handed as a special case, as can be in the src code here with frame 0.8.0 where an image source is handed like this:
hash: function (data) {
    if (data.src.tagName) {
        // Since `data.src` can be an element, parse out the string if necessary for the hash.
        data = utils.extendDeep({}, data);
        data.src = data.src.src;
    }
    return JSON.stringify(data);
},

So basically if an image we the asset property will not handle image's properly and an additional step of grabbing the url from it via
data.src.src

OR
data.src.getAttribute('src');

A: Please correct me if i'm wrong, but i think it's not in the material schema.
I think the devil's in the component.js, which not only seems to allow you to assign a value to any given property, but also has the constructor for any component, and parses the schema.
That being said, the material does not need a src in the schema, as it seems to be a part of every component. Furthermore there are multiple parsers like the assetParse, or src-loader, checking whether an attribute is a html element, or even a video / image asset.

As for the material part, check out the dist source code, where
I think what you're looking for is:

module.exports.updateMapMaterialFromData

where you can see a-frame team uses the data.src for the material, and updates the texture with it. Just give it a ctrl+F (only 3 hits).

So when

module.exports.updateMapMaterialFromData('map', 'src', shader, data);

is called, with the given definition:
module.exports.updateMapMaterialFromData = function (materialName, dataName, shader, data) {
  var el = shader.el;
  var material = shader.material;
  var src = data[dataName];
  .......

makes src = data[src] => they make updates using a local variable src.

Also you can see the src-loader in action where the material system is registered, and when a src attribute is found out, the validateSrc function fires one of the two callbacks:

utils.srcLoader.validateSrc(src, loadImageCb, loadVideoCb);


text:
Q: K3s Allow Unauthenticated Access to OIDC Endpoints Goal
I want to allow unauthenticated access to the following OIDC endpoints in my K3s cluster (from other pods inside the cluster mostly but access from outside is also acceptable):

*

*https://kubernetes.default.svc/.well-known/openid-configuration

*https://kubernetes.default.svc/openid/v1/jwks
Problem
By default, Kubernetes requires an authorization token for accessing those endpoints and despite my efforts to enable unauthenticated access, I cannot seem to get the unauthenticated access to work.
What I have tried
According to the Kubernetes documentation on Service account issuer discovery, one must create a ClusterRoleBinding that maps the ClusterRole system:service-account-issuer-discovery to the Group system:unauthenticated.
I also found this helpful example for a different use-case but they're exposing the OIDC endpoints anonymously just like I want to do:
OIDC issuer discovery for Kubernetes service accounts
Based on both of those, I created my ClusterRoleBinding with:
kubectl create clusterrolebinding service-account-issuer-discovery-unauthenticated --clusterrole=system:service-account-issuer-discovery --group=system:unauthenticated

This results in the following spec:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  creationTimestamp: "2022-11-28T15:24:41Z"
  name: service-account-issuer-discovery-unauthenticated
  resourceVersion: "92377634"
  uid: 75402324-a8cf-412f-923e-a7a87ed082c2
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:service-account-issuer-discovery
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:unauthenticated

I also confirmed RBAC is enabled by running this which showed an entry:
kubectl api-versions | grep 'rbac.authorization.k8s.io/v1'

Unfortunately, despite creating that ClusterRoleBinding, it still seems to be requiring an authorization token to access the OIDC endpoints. For example, when I call from outside the cluster:
curl -vk https://my-cluster-hostname:6443/.well-known/openid-configuration

Output:
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "Unauthorized",
  "reason": "Unauthorized",
  "code": 401
}

Accessing from the Ingress controller inside the pod (by execing into it), I get the same error.
curl -vk https://kubernetes.default.svc/.well-known/openid-configuration

I am using K3s for this cluster... Is there something special about K3s that I have not accounted for? Do I need to do something to get this ClusterRoleBinding to take effect? Something else I missed?

A: The issue was that the --anonymous-auth api server setting is set to false by default.
I was able to adjust this with my already-installed K3s server nodes by editing the systemd unit for the k3s service. Step-by-step guide:
Edit the systemd unit with:
sudo vim /etc/systemd/system/k3s.service

You'll see the K3s unit:
[Unit]
Description=Lightweight Kubernetes
Documentation=https://k3s.io
Wants=network-online.target
After=network-online.target

[Install]
WantedBy=multi-user.target

[Service]
Type=notify
EnvironmentFile=-/etc/default/%N
EnvironmentFile=-/etc/sysconfig/%N
EnvironmentFile=-/etc/systemd/system/k3s.service.env
KillMode=process
Delegate=yes
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
TimeoutStartSec=0
Restart=always
RestartSec=5s
ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service'
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s \
    server \
        '--cluster-init' \
        '--disable=traefik' \
        '--write-kubeconfig-mode' \
        '644' \

Add the last two lines to the ExecStart:
ExecStart=/usr/local/bin/k3s \
    server \
        '--cluster-init' \
        '--disable=traefik' \
        '--write-kubeconfig-mode' \
        '644' \
        '--kube-apiserver-arg' \
        '--anonymous-auth=true' \

Reload the systemd unit:
sudo systemctl daemon-reload

Finally, restart the k3s service:
sudo systemctl restart k3s

References:

*

*Control Plane Execution and Arguments - You can see the default for K3s there

*API discovery roles - also mentions this flag at the top


text:
Q: Why is s3 event not trigger when having files without extension I have created s3 bucket and lambda function. I need to trigger lambda function when file upload to s3 bucket.I used S3 events. It's working fine when files having file extension.
But my issue is event not trigger when uploading files without file extension.
Lambda function created by using python 3.9
Do you have any idea to do this?
I added S3 trigger configuration suffix as . / .*.  All are not works
Or else is there a way to add a specific file extension in bucket side when uploading. I couldn't add file extension in my side. Because this upload is doing by AWS AppFlow through
Update
Below is the S3 event configuration currently having

Below are the S3 event triggered file names ( I have tried file names.)

*

*anyname.jpg

*data.json
Below is the file name I used without file extension. (For this file to event not triggered)

*

*data