text:
Q: Swift 4 JSONEncoder returns empty JSON array I have multiple Codeable classes that I want to convert to JSON strings.
class MyCodable: NSObject, Codable {

    override init() {

    }

    func encode(to encoder: Encoder) throws {

    }

}

class Category: MyCodable {

   required init(from decoder: Decoder) throws {
        let values = try decoder.container(keyedBy: CodingKeys.self);
        //... assign values and call super.init
    }

    override func encode(to encoder: Encoder) throws {

    }

    var categoyId: Int64;
    var categoryName: String;

    enum CodingKeys: String, CodingKey {
        case categoryId
        case categoryName
    }

}

class Product: MyCodable {

    required init(from decoder: Decoder) throws {
        //..assign values and call super.init
    }

    override func encode(to encoder: Encoder) throws {

    }

    var productId: Int64;
    var categoryId: Int64;
    var productName: String;

    enum CodingKeys: String, CodingKey {
        case productId
        case categoryId
        case productName
    }

}

I have a utility class that I am using for the conversion.
class JSONUtil: NSObject {

    public static func encode(objects: [MyCodable]) -> String {
        var json: String = "";
        do {
            let encoder = JSONEncoder();
            encoder.outputFormatting = .prettyPrinted;
            let jsonData = try encoder.encode(objects);
            json = String(data: jsonData, encoding: String.Encoding.utf8)!
        } catch let convertError { json = "[{error: '" + convertError.localizedDescription + "'}]"; }
        return json;
    }

    public static func toJson(object: MyCodable) -> String {
        var objects = [MyCodable]();
        objects.append(object);
        return encode(objects: objects);
    }

}

The return value is always "[{}]" no matter what is inside the array of MyCodable objects. While debugging, I can see the values of the Category object are populated.
Since MyCodable has no properties, is that why the JSONEncoder does not print out the Category properties?.. Or why doesn't it print the Category properties?
I am having the same issue with the Product object.
The goal is to avoid having to customize the JSON conversion for every class I want to print to JSON.

A: Your reasoning is correct, MyCodable has no properties, so there is nothing to read/write. You have actually stumbled across a bug of the swift JSON Encoder and Decoder. They do not handle inheritance well. So your Product and Category class become anonymous MyCodable class that have nothing to be encoded or decoded.
Looking at your code, I see no reason for the MyCodable class. Simply have Product and Category adhere to the Codable protocol. If you need the polymorphism of being able to refer to Product and Category in the same way, define a protoocl that adheres to Codable and have Product and Category adhere to the protocol you defined. In my eyes this is redundant however there could be use cases where it is a plausible solution.

A: Your mistake is that you're trying to use inheritance instead of generics. Your JSONUtil class should be look like this.
class JSONUtil: NSObject {

    public static func encode<T: Encodable>(objects: [T]) -> String {
        var json: String = "";
        do {
            let encoder = JSONEncoder();
            encoder.outputFormatting = .prettyPrinted;
            let jsonData = try encoder.encode(objects);
            json = String(data: jsonData, encoding: String.Encoding.utf8)!
        } catch let convertError { json = "[{error: '" + convertError.localizedDescription + "'}]"; }
        return json;
    }

    public static func toJson<T: Encodable>(object: T) -> String {
        return encode(objects: [object]);
    }

}

I'm not sure why you're creating classes inheriting from NSObject. You may be stuck in the old Objective-C ways  Prefer to use struct over class, unless you always need the object to be copied by reference.


text:
Q: Outlook 2007 Add-In - mailItem.To only available after hitting a breakpoint and looking at value manually I am making an outlook plugin in visual studio and part of it requires gathering the recipients/subject/body content. I am able to gather the subject and body without problem but accessing mailItem.To I always find it's blank.
body = mailItem.Body
subject = mailItem.Subject
Dim readtest As String = mailItem.To

Is the code I am using, and what makes it worse is that if I put a breakpoint in before trying to populate readtest and then I manually just look at the mailItem.To value and resume or step through the code it will work just fine.
Does anyone know how I can get this working properly?

A: You could try to get the same functionality with mailItem.Recipients property.
It returns IEnumerable. Recipient object have a Name member so basically you could do the following (It's in C# but i think you could figure it out with vb):
string recipients = string.Empty;
foreach (Outlook.Recipient r in mailItem.Recipients)
{
   recipients += r.Name + ";";
}

You should get the same result as if you use mailItem.To

redpajama_set_name: RedPajamaStackExchange


text:
Q: Device Token although notifications are disabled? I have a short question:
My App receives notifications, which is great. But I'm curios: When I disable all types of notifications for testing purposes, the debug console of Xcode still tells me my device token.
Is this a normal behavior? Or do I have to tell the App that I have turned off all notification types, so it doesn't ask for a token and therefore doesn't receive notifications anymore?
Information would be much appreciated...
Greetings from Switzerland,
Stephan


text:
Q: With javascript, please tell me how to get result array like below "resultList". It is similar to the UPDATE statement in SQL With javascript, please tell me how to get result array like below "resultList".  It is similar to the UPDATE statement in SQL.
const dataList = [
  { id: 1, xpstn: "10", ypstn: "11", value:{1,2,3,4}},
  { id: 2, xpstn: "20", ypstn: "21", value:{1,2,3,4}},
  { id: 3, xpstn: "30", ypstn: "31", value:{1,2,3,4}},
  { id: 4, xpstn: "40", ypstn: "41", value:{1,2,3,4}},
     ]
 const paramsList = [
  { id: 3, xpstn: "33", ypstn: "32", desc: "param"},
  { id: 4, xpstn: "44", ypstn: "42", desc: "param"},
  { id: 5, xpstn: "55", ypstn: "53", desc: "param"},
  { id: 6, xpstn: "66", ypstn: "62", desc: "param"},
];

let resultList = [
  { id: 3, xpstn: "33", ypstn: "11", value:{1,2,3,4}},
  { id: 4, xpstn: "44", ypstn: "21", value:{1,2,3,4}},
];

The condition is that the id is the same, and xpstn must be updated.
UPDATE X
SET X.xpstn = Y.xpstn
FROM dataList X
INNER JOIN paramsList Y
ON X.id = Y.id

A: hope this works for you.

const dataList = [
    { id: 1, xpstn: "10", ypstn: "11", value: [1, 2, 3, 4] },
    { id: 2, xpstn: "20", ypstn: "21", value: [1, 2, 3, 4] },
    { id: 3, xpstn: "30", ypstn: "31", value: [1, 2, 3, 4] },
    { id: 4, xpstn: "40", ypstn: "41", value: [1, 2, 3, 4] },
]
const paramsList = [
    { id: 3, xpstn: "33", ypstn: "32", desc: "param" },
    { id: 4, xpstn: "44", ypstn: "42", desc: "param" },
    { id: 5, xpstn: "55", ypstn: "53", desc: "param" },
    { id: 6, xpstn: "66", ypstn: "62", desc: "param" },
];

let resultList = [
    { id: 3, xpstn: "33", ypstn: "31", value: [1, 2, 3, 4] },
    { id: 4, xpstn: "44", ypstn: "41", value: [1, 2, 3, 4] },
];

/*
UPDATE X
SET X.xpstn = Y.xpstn
FROM dataList X
INNER JOIN paramsList Y
ON X.id = Y.id
*/

const update = (data = [], params = []) => {
    resultList = [];
    data = data.forEach(d => {
        if (params.some(p => p.id === d.id)) {
            r = {
                ...d,
                xpstn: params.find(p => p.id === d.id).xpstn
            }
            resultList.push(r);
        }
    });
    return resultList;
}

console.log("result", update(dataList, paramsList));

A: Solution with reduce:

const dataList = [{ id: 1, xpstn: "10", ypstn: "11", value: [1, 2, 3, 4] },{ id: 2, xpstn: "20", ypstn: "21", value: [1, 2, 3, 4] },{ id: 3, xpstn: "30", ypstn: "31", value: [1, 2, 3, 4] },{ id: 4, xpstn: "40", ypstn: "41", value: [1, 2, 3, 4] }];
const paramsList = [{ id: 3, xpstn: "33", ypstn: "32", desc: "param" },{ id: 4, xpstn: "44", ypstn: "42", desc: "param" },{ id: 5, xpstn: "55", ypstn: "53", desc: "param" },{ id: 6, xpstn: "66", ypstn: "62", desc: "param" }];

const resultList = dataList.reduce((acc, dataItem) => {
    const paramItem = paramsList.find(({ id }) => id === dataItem.id);
    if (paramItem) {
        const { xpstn } = paramItem;
        acc.push({ ...dataItem,  xpstn });
    }
    return acc;
}, []);

console.log(resultList)
.as-console-wrapper { max-height: 100% !important; top: 0 }


text:
Q: accessing div tag attributes in css to make elements invisible for the html tag

I'm trying to access the label and second-label attribute, but I don't know if my css is wrong or I'm not doing it properly.
.test[label="hello"] {
     visibility: hidden;
}

this doesn't seem to be doing anything. Would appreciate some help.

A: div elements aren't self close:

.test[second-label="world"] {
  color: red;
}

test

Despite this it works as it should.
edit:
You can use data- instead as @j08691 mention in his comment. custom data attributes
So in your example you can use:

.test[data-secondLabel="world"] {
  color: red;
}

test


text:
Q: Connect-SDK : Failed to connect to Google Cast device (Chromcast) I am developing a TV Remote control application. I am only discovering CastService and DIALService devices. After getting the devices list. I select a device and try to connect it with the below code.
connectableDevice.addListener(connectableDeviceListener)
connectableDevice.setPairingType(null)
connectableDevice.connect()

After a few seconds, I only receive a callback in onDeviceDisconnected() method. nothing else is happening. After some deep debugging, I found that the error states that

Failed to connect to Google Cast Device

I have no idea about what is going wrong here. Am I missing something ?


text:
Q: How to use MaterialUI's Mobile-Stepper in HypserStack? I try to use the mobile-stepper component (https://material-ui.com/demos/steppers/#mobile-stepper-progress) in Hyperstack but I get this error:
Failed prop type: Invalid prop `nextButton` supplied to `MobileStepper`, expected a ReactNode.
    in MobileStepper
It renders just the progress bar but no buttons.
Tried various ways i.e.:
Mui.MobileStepper( variant: "progress", steps: 6, position: "static",
                   nextButton: lambda { Mui.Button(size: "small") {'next'} },
                   backButton: lambda { Mui.Button(size: "small") {'back'} })

A: You want to pass a full ReactNode to the nextButton and backButton props. You also need to convert the component to native javascript. You can call to_n on any Hyperstack component to convert it to a native react class.
Mui.MobileStepper( variant: "progress", steps: 6, position: "static",
                   nextButton: Mui.Button(size: "small") {'next'}.to_n,
                   backButton: Mui.Button(size: "small") {'back'}.to_n)


text:
Q: How to set up a binary set (BS) attribute in DynamoDB I'm trying to add a binary set attribute to my DynamoDb Table. Each element in the set is an InternalImage proto.
@DynamoDBAttribute
@DynamoDBTypeConverted(converter = Converters.InternalImagesConverter::class)
var image_assets: Set<InternalImage>? = null

class InternalImagesConverter : DynamoDBTypeConverter<Set<ByteString>, Set<InternalImage>> {
  override fun convert(input: Set<InternalImage>?): Set<ByteString>? =
    input?.map { it.encodeByteString() }?.toSet()

  override fun unconvert(input: Set<ByteString>?): Set<InternalImage>? =
    input?.map { InternalImage.ADAPTER.decode(it) }?.toSet()
}

I get the following error when I try to access any element within unconvert:
ClassCastException: class java.lang.String cannot be cast to class okio.ByteString

Digging into this, it looks like DynamoDbMapper casts my ByteString into a String because the attributeType of my field is set to SS or "String Set" instead of "Binary Set". So, I tried specifying the type by adding an annotation.
@DynamoDBAttribute
@DynamoDBTyped(value = DynamoDBMapperFieldModel.DynamoDBAttributeType.BS)
@DynamoDBTypeConverted(converter = Converters.InternalImagesConverter::class)
var image_assets: Set<InternalImage>? = null

Error:
DynamoDBMappingException: ServiceItem[image_assets] could not be mapped for type Set<Object>
DynamoDBMappingException: type [class java.lang.Object] is not supported; no conversion from class java.nio.ByteBuffer

I've tried using ByteArray and ByteBuffer. I've also tried changing my converter to convert just ByteString/ByteArray/ByteBuffer to InternalImage thinking that maybe DynamoDbMapper handles the set part. All resulted in a similar error.
Has anyone successfully set up a binary set attribute in DynamoDb before? I'm not sure what else to try.


text:
Q: Contextual filter for hierarchal taxonomy with duplicate term names I have a taxonomy that has duplicate term names with different parents; for example
mens (tid=39) has child term shirts (tid=117) and
womens (tid=43) has child term shirts (tid=129)
The Contextual filter not working in this case but if change womens -> shirts to womens -> wshirts it start working. I tried all the possible combination for Contextual filter but nothing is working.
Found same issue on drupal [Drual Link][https://www.drupal.org/node/2641204] as well but no solution.


text:
Q: what am I doing wrong in regular expressions? please tell me what I'm doing wrong, I need to get the value
here is the part of the code that is responsible for:
my code:
dict_miner['model'] = re.search(r'SN: (\w+)', date.get('Name'))

result:
'model': <re.Match object; span=(14, 21), match='sn: abc123456'>

but I need the value of match to be written to the variable:
my code:
dict_miner['model'] = re.search(r'SN: (\w+).group(1)', date.get('Name'))

result:
'model': None,

as a result , why doesn 't it work .group(1)?
result = 'model': abc123456

or should I throw off the entire code ?

A: The group(1) invocation is Python code, not part of the regexp.
dict_miner['model'] = re.search(r'SN: (\w+)', date.get('Name')).group(1)

Note that this will happily crash if the data does not match; then re.search would return None, and you can't call group on None. You will need to do this in two steps, like so, to take care of that.
name_match = re.search(r'SN: (\w+)', date.get('Name'))
dict_miner['model'] = (name_match.group(1) if name_match else None)


text:
Q: Adobe ExtendScript layer Processing I am trying to create a script for processing layers with inversion. In Photoshop, this is done using ctrl +click on the layer. All the layers in my document are divided into groups. Because of this, an error occurs (photoshop is trying to invert the group). How can I skip groups in a loop or how can I fix it?
var doc = app.activeDocument;
var layers =activeDocument.layers;

for (var layerIndex = 0; layerIndex<doc.layers.length; layerIndex++)
{

    var layer = layers [layerIndex];
    doc.activeLayer = layer;
 var idChnl = charIDToTypeID( "Chnl" );

            var actionSelect = new ActionReference();
            actionSelect.putProperty( idChnl, charIDToTypeID( "fsel" ) );

            var actionTransparent = new ActionReference();
            actionTransparent.putEnumerated( idChnl, idChnl, charIDToTypeID( "Trsp" ) );

            var actionDesc = new ActionDescriptor();
            actionDesc.putReference( charIDToTypeID( "null" ), actionSelect );
            actionDesc.putReference( charIDToTypeID( "T   " ), actionTransparent );

            executeAction( charIDToTypeID( "setd" ), actionDesc, DialogModes.NO );

            var invert = doc.selection.invert(actionSelect);
            var clear = doc.selection.clear(invert);
            var des = doc.selection.deselect(clear);

          //При попытке выделить группу возникает ошибка, нужно сделать пропуск группы
  }

A: In Photoshop, for scripting purposes, normal layers are of type "ArtLayer" and groups are of type "LayerSet". A group (LayerSet) can be an array containing multiple layers (ArtLayer) or even multiple groups.

How can I skip groups in a loop?

So in your for loop, you want to know if the current layer is an actual layer or a group, by checking its typename:
...

var layer = layers [layerIndex];

if (layer.typename == "LayerSet") { //if current layer is a group
   continue; //skip to next loop element
}

doc.activeLayer = layer;

...

But, if all the layers in your document are divided into groups, your current for loop will not loop through the layers inside the groups, because your layers variable contains only the top level layers (activeDocument.layers).
Since these top level layers can be either a layer or a group, and the code above skips any groups, your loop will only go through any top level layers,if any, ignoring any layers inside groups (since groups are skipped).
In other words, if your document is structured such that ALL top level layers are groups, your loop will skip them all, and no layers will be processed.

How can I fix it?

You may want to fix your loop by checking whether the layer is a group, and if it is, loop through the group's layers also. There are many ways to go about it, depending on how complex you want to get with recursive functions, but to simplify, just create a nested for loop:
...

var layer = layers [layerIndex];

if (layer.typename == "LayerSet") { //if current layer is a group

    //if group, loop through its layers

    var groupLayers = layer.layers;

    for (var i = 0; i < groupLayers.length; i++) {
        var layer = groupLayers[i];
        doc.activeLayer = layer;

        // do your processing here

    } //end group layers loop
} //end if LayerSet

...

Since your processing code may apply in other cases also, like if you have top level layers outside of groups, it may be a good idea to extract it into its own function, rather than keeping it inside the for loop, and then simply call the function inside the loop or wherever else it may apply. So here's what your entire code could look like:
var doc = app.activeDocument;
var layers = doc.layers;

for (var layerIndex = 0; layerIndex < layers.length; layerIndex++)
{

    var layer = layers[layerIndex];

    if (layer.typename == "LayerSet") { //if layer is a group

        //if group, loop through its layers
        var groupLayers = layer.layers;

        /** Note that a group could also have nested groups,
        which is not accounted for in this scenario **/

        for (var i = 0; i < groupLayers.length; i++) {

            var layer = groupLayers[i];
            doc.activeLayer = layer;

            // do your processing here
            processLayer();

        } //end group layers loop

    } //end if LayerSet

} //end doc layers loop

//Function for inverting active layer (or whatever your function does)
function processLayer(){

    var idChnl = charIDToTypeID( "Chnl" );

    var actionSelect = new ActionReference();
    actionSelect.putProperty( idChnl, charIDToTypeID( "fsel" ) );

    var actionTransparent = new ActionReference();
    actionTransparent.putEnumerated( idChnl, idChnl, charIDToTypeID( "Trsp" ) );

    var actionDesc = new ActionDescriptor();
    actionDesc.putReference( charIDToTypeID( "null" ), actionSelect );
    actionDesc.putReference( charIDToTypeID( "T   " ), actionTransparent );

    executeAction( charIDToTypeID( "setd" ), actionDesc, DialogModes.NO );

    var invert = doc.selection.invert(actionSelect);
    var clear = doc.selection.clear(invert);
    var des = doc.selection.deselect(clear);

    return;

} //end processLayer()

FYI: It is a good idea to have a copy of the Photoshop Javascript Reference when developing Photoshop scripts. You can use the reference pdf to see all the properties and methods available for ArtLayer layers and LayerSets (groups) layers, like the name, opacity, whether it's visible, etc.


text:
Q: GCC save temporary output with extra information I want to analyze the assembly output of the C program that I am compiling.
To enable GCC save the temporary file I added -save-temps option while compiling.
In another link I found following GCC options to produce extra output in the assembly code. How to use this option in conjunction with -save-temps to produce more readable assembly output? I also want to be sure that assembly file that I am viewing corresponds to the binary produced by the GCC.

-a[sub-option...]    turn on listings
                 Sub-options [default hls]:
                 c      omit false conditionals
                 d      omit debugging directives
                 g      include general info
                 h      include high-level source
                 l      include assembly
                 m      include macro expansions
                 n      omit forms processing
                 s      include symbols
                 =FILE  list to FILE (must be last sub-option)

A: Related: How to remove "noise" from GCC/clang assembly output?: lots of ways to make compiler asm output easier to read.

-Wa,xyz=FILE makes an extra output file alongside the normal output.  It's orthogonal to -save-temps.  If you want it to go to a file, you do need an extra output filename on the command line.
e.g. in a Makefile pattern rule:
%.o : %.c
        $(CC) -c  $(CFLAGS) $(CPPFLAGS) -Wa,-adhln=$*.lst $< -o $@

Put that in a file called Makefile (with the indent being a real TAB, not spaces), then you can:
$ CFLAGS='-O3 -g -fverbose-asm' make rnd10.o
cc -c  -O3 -g -fverbose-asm  -Wa,-adhln=rnd10.lst rnd10.c -o rnd10.o

$ ll rnd10.*
-rw-rw-r-- 1 peter peter 912 Mar  3  2016 rnd10.c
-rw-rw-r-- 1 peter peter 25K Sep  6 08:23 rnd10.lst
-rw-rw-r-- 1 peter peter 12K Sep  6 08:23 rnd10.o

So both the .o and the listing were created by the same command.  If you used -save-temps, there's also be the preprocessed source, and the actual .s that was fed to the assembler, but there's probably not much point in saving those and a listing at the same time.  (I chose .lst because it's not in a format that will assemble)

You may be able to get away with just adding -Wa,-adhln=$*.lst to your CFLAGS, instead of overriding the pattern rule.  This will still only work for build systems that use Make, not alternatives that don't ultimately generate a Makefile (e.g. scons), because the $* expansion to the stem of the pattern rule is specific to Make.  It also only works for Make pattern rules, not explicit foo.o : foo.c foo.h style rules.
e.g.
$ rm Makefile
$ CFLAGS='-O3 -g -fverbose-asm -Wa,-adhln=$*.lst' make rnd10.o
cc -O3 -g -fverbose-asm -Wa,-adhln=rnd10.lst   -c -o rnd10.o rnd10.c

Fun fact: Make doesn't even work with spaces in filenames, but you can protect from shell expansion of anything else (like foo$(echo)_weirdname.c) with single quotes in the build command part of the rule, and in CFLAGS.  e.g. CFLAGS="-O3 -g "\'-Wa,-adhln=\$\*.lst\' make -B 'foo$(echo)weirdfil\\.o'


text:
Q: Installing Phusion Passenger as a dynamic Nginx module; module doesn't seem to load but no errors I'm trying to install Phusion Passenger as a dynamic module with Nginx installed from the repo. The process seems to be working but my Meteor app doesn't load and it looks like the Passenger module isn't running.
OS: RedHat 8
Nginx: 1.20.1
Passenger: Standalone 6.0.12
Meteor: 2.5.1
How I've built the module:

*

*Install Passenger standalone as per the tutorial

*Install passenger-devel
sudo dnf install passenger-devel.x86_64

*Check installation

sudo /usr/bin/passenger-config validate-install

This shows "Everything looks good"

*Check the Passenger module path

passenger-config --nginx-addon-dir

returns
/usr/share/passenger/ngx_http_passenger_module

and
sudo ls /usr/share/passenger/ngx_http_passenger_module

shows
config       ContentHandler.c  ngx_http_passenger_module.c  StaticContentHandler.h
ConfigGeneral    ContentHandler.h  ngx_http_passenger_module.h
Configuration.c  LocationConfig    README.md
Configuration.h  MainConfig    StaticContentHandler.c

*Install PCRE

sudo yum install pcre-devel

*Install Nginx from repo

sudo yum module list nginx
sudo yum module reset nginx
sudo yum module enable nginx:1.20
sudo yum install nginx
sudo systemctl enable nginx

*Download Nginx source code

wget https://nginx.org/download/nginx-1.20.1.tar.gz
tar zxf nginx-1.20.1.tar.gz
cd nginx-1.20.1/

*Check compile flags:

nginx -V

*Used the output of nginx -V to construct and then run the configure command (though as the output showed --wtih-compat I could probably have used ./configure --with-compat --add-dynamic-module=$(passenger-config --nginx-addon-dir) instead)

./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --add-dynamic-module=$(passenger-config --nginx-addon-dir)

*Build the Passenger module and copy it to where Nginx can find it

make modules
sudo cp objs/ngx_http_passenger_module.so /usr/share/nginx/modules/

*Tell Nginx to load the module

sudo nano /etc/nginx/nginx.conf

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
load_module "/usr/share/nginx/modules/ngx_http_passenger_module.so";
include /usr/share/nginx/modules/*.conf;

I also commented out the default server block.

*Configure my app (which is already unpacked in /var/www/myapp and I know from previous tests that it works with Nginx and Passenger installed from the repo)

sudo nano /etc/nginx/conf.d/myapp.conf

Extract from the conf file:
server {

    listen 80;

    server_name myserveraddress;

    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/myapp/bundle/public;

    # Turn on Passenger
    passenger_enabled on;

    passenger_startup_file main.js;

    passenger_app_root /var/www/myapp/bundle;
...

*Restart nginx

sudo service nginx restart

I now visit the web page but see a 404 not found page. In the logs I see only this:
"/var/www/myapp/bundle/public/index.html" is not found (2: No such file or directory)

There are no other errors, warnings or info.
This suggests to me that Nginx is loading my config file or it wouldn't be looking in /var/www/myapp/bundle. But it doesn't seem to have enabled Passenger, as it's still looking for public/index.html instead of main.js.
I can't find any way to inspect Nginx to see what dynamic modules are running, and I've tried setting the log level to debug. I'd be grateful for any suggestions how to find out what's going on / how to enable the Passenger module?

A: I worked it out; the issue was that I didn't realise that when you install Passenger as a dynamic module, you still need to do the same config as with a regular install. In particular, in your nginx.conf, you need to add this to the http block:
  passenger_root /usr/share/passenger-6.0.12;
  passenger_ruby /usr/bin/ruby;

passenger_root should be where your passenger is installed, which you can find by running:
passenger-config --root

And passenger_ruby is your ruby file.
I hadn't previously understood that in all configurations, Passenger must be installed and the module file ngx_http_passenger_module.so is just the glue to tell nginx how to talk to it. Without passenger_root, nginx will act as though the passenger module is not installed.


text:
Q: Proving a curve has no curve point I am trying to show that the curve $x^2 + y^2 - 3 = 0$ has no rational point, where a rational point is defined as a solution $(x,y) \in \mathbb{Q}^2$ to this equation.
My attempt was to proceed by contradiction. Assume there is such a point $(x,y) \in \mathbb{Q}^2$ and let $x = \frac{a}{b}$, $y = \frac{c}{d}$ for $a,b,c,d \in \mathbb{Z}$, $b,d \neq 0$ where we assume without loss of generality that these fractions are fully reduced. Then we substitute:
\begin{align*}
\frac{a^2}{b^2} + \frac{c^2}{d^2} - 3 = 0.
\end{align*}
Rearranging and finding a common denominator of $b^2 d^2$ on the left:
\begin{align*}
\frac{a^2 d^2 + b^2 c^2}{b^2 d^2} = 3.
\end{align*}
We multiply through by $b^2 d^2$:
\begin{align*}
a^2 d^2 + b^2 c^2 = 3b^2 d^2.
\end{align*}
At this point, I'm stuck. I could try to argue that $3$ divides the left-hand side and apply Euclid's lemma, but I can't figure out how to get a contradiction out of the assumption that $\frac{a}{b}$ and $\frac{c}{d}$ have no common factors.

A: You can rearrange the equality to get $a^2 d^2 = 3 b^2 d^2 - b^2 c^2 = b^2(3 d^2 - c^2)$ which means that $b^2 | a^2 d^2 \implies b | ad$, but $\gcd(a, b) = \gcd(c, d) = 1$ means that this implies $b | d$, and by a similar argument $d | b$, but that only happens if $b = d$.
From there, you can reduce your equation to $a^2 + c^2 = 3b^2$. Then you can prove that this requires both $a$ and $c$ to be multiples of 3 and you're just about home.

A: you want a solution to the equation:
$$x^2+y^2=3$$
you could try proving that if this is a point on a circle, it cannot have both coordinates be integer, so say:
$$x=\sqrt{3}\cos\theta,y=\sqrt{3}\sin\theta$$
for $x$ to even be rational $\cos\theta$ must be be a rational multiple of $\sqrt3$ and similar for $y$. Now show there exists no value $0\le\theta< 2\pi$ where both $\cos,\sin$ are multiples of $\sqrt3$


text:
Q: Why after migration from vSphere to Google Cloud caused slow upload limit to 0.60MBPS using CloudEndure? I recently migrated a VM from vSphere vmware to Google Cloud Compute Instance.
I used CloudEndure, and everything worked fine, the VM is identical. But there is one problem. The upload is super slow, under 1mbps (0.65mbps), while the download is just super fast 300-900 mbps.
I tried twice migration changed vNic, changed zone region, everything but no luck. The funny thing is I put a temporary VM provided by GCP to connect rdp in the same subnet, and that temp-VM works fine.
Did you have this experience ?
Appreciate your suggestions, thanks in advance.

A: To change your MTU setting in Windows Server 2003 or 2008 use the following steps:
Open regedit as an administrator account on the server in question.
Navigate to HKLM\System\CurrentControlSet\services\Tcpip\Parameters\Interfaces[Choose the interface in question] (Do this by checking the correct IP address is in the settings under this key for the adapter you are configuring)
Once you are in the correct key for your interface, right-click and select new DWORD value (32 bit).
Call it MTU
Give this a decimal value equal to the setting 1460 (measured in bytes).


text:
Q: Angular POST request not executed I have a POST request that doesn't seem to execute.
private loginBackend(): Observable<Response> {
const urlSearchParams = new URLSearchParams();
urlSearchParams.append('ticket', this.ticket.toString());
urlSearchParams.append('serviceURL', this.callbackURL);
this.loginEndPoint = (environment.backUri || window.location.origin) + environment.endpoints.login;
console.log("pass")
    return this.http
        .post(this.loginEndPoint, urlSearchParams, { withCredentials: true })
        .map((dt: any) => {
            this.isLoggedIn = true;
    this.isLogIn();
        })
        .catch(this.catchResponseError);
}

I'm trying to set a variable to true if the ticket is validated by the backend.
This is the call to the method :
 if (this.ticket) {
        // We try to autenticate
        return this.loginBackend()
 }

A: You need to use subscribe otherwise it wont get invoked
 if (this.ticket) {
        // We try to autenticate
        return this.loginBackend().subscribe(data=>
 }

A: When using the http client from Angular, you get an observable as a return. This observable has a source. In your case, the source of data is your http call. This source is actually created only when you subscribe to your observable.
So basically, you need to subscribe to your observable to actually make your http post request :
 if (this.ticket) {
    // We try to authenticate
    return this.loginBackend().subscribe(data => {
        // Do your stuff with your response
    )
 }

Hope that helps


text:
Q: 400 Bad Request: unknown field 'type' I've set up Solr 3.6.2 on Tomcat as described here.
Using the sunspot-rails gem and the embedded solr server I have no problems, but on my staging server I'm getting the response:

message ERROR: [doc=Foo 20] unknown field 'type'
description The request sent by the client was syntactically incorrect.

The request data looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<add>
  <doc>
    <field name="id">Foo 20</field>
    <field name="type">Foo</field>
    <field name="type">ActiveRecord::Base</field>
    <field name="class_name">Foo</field>
    <field name="name">test</field>
  </doc>
</add>

What's causing this?  Is there some configuration that should be set?  (I'm expecting something that allows for the type name to be used regardless of whether or not such a column exists.)

A: It turns out that the sunspot-solr gem expects a slightly different schema.xml than the default that is bundled with solr.
I replaced the file with the one that the gem uses (from here) and it works fine now.  This answer explains what the schema.xml file is.


text:
Q: Make a function wait for a call to finish before returning I used to have this code:
static generate() {
    var now = new Date();
    return {
        "date": now.getDate(),
        "day": now.getDay(),
        "hours": now.getHours(),
        "minutes": now.getMinutes(),
        "month": now.getMonth(),
        "seconds": now.getSeconds(),
        "time": now.getTime(),
        "timezoneOffset": now.getTimezoneOffset(),
        "year": now.getFullYear() - 1900,
    };
}

And this worked ok, but took date from the client, which was a bad thing, so I moved this code to a Node server so it looks like this now:
router.get('/generateTime', cors(), (req, res, next) => {
    var now = new Date();
    res.json({
        "date": now.getDate(),
        "day": now.getDay(),
        "hours": now.getHours(),
        "minutes": now.getMinutes(),
        "month": now.getMonth(),
        "seconds": now.getSeconds(),
        "time": now.getTime(),
        "timezoneOffset": now.getTimezoneOffset(),
        "year": now.getFullYear() - 1900,
    });
});

The generate() function looks like this now:
static async generate() {
    var now = await fetch('link/generateTime').catch(e => console.log(e));
    now = await now.json();
    return now;
}

Before that I was doing some firebase CRUD like this:
export function setLastActiveTime() {
    firebase.database().ref('Users').child(firebase.auth().currentUser.uid).child('lastActiveTime').set(Time.generate()).catch(e => console.log(e));
}

So now, I made it work using async await like this:
export async function setLastActiveTime() {
    await firebase.database().ref('Users').child(firebase.auth().currentUser.uid).child('lastActiveTime').set(await Time.generate()).catch(e => console.log(e));
}

But the problem is, I would need to change a lot of code, in other places for this way to work.
Is there a way to keep the old setLastActiveTime() function as it was, and only change the generate() function so it grabs the date from the server, and waits until the async call is done?


text:
Q: console.log/console.dir showing last state of object, not current I want to log how my array/object is changing with new steps of loop. Console.log does this bad. It shows only last state of object everywhere. For example:
var a = {};
console.log(a); // {bob1: 0, bob2: 0}
a.bob1 = 0;
console.log(a); // {bob1: 0, bob2: 0}
a.bob2 = 0;
console.log(a); // {bob1: 0, bob2: 0}

I found there, on so, another command: console.dir. It is working properly in same example. It shows states of object correcly.
Look this example. This command works perfect: http://jsfiddle.net/RLzVV/
Now, look my code pls. All output is in console. http://jsfiddle.net/3BDs7/4/
This is aStar algorithm. Take a look on this part (neighbor 3 loop <--- neighbor 3 start ---> this code is situated here <--- neighbor 3 stop -->) in console. Lanes, which output this to console are 105-113:
new openset length: 2
openset after adding new vertex
**shows 1 element, but length is 2**

It shows length is 2, but shows only 1 element. But! Seems to me algo is working correctly (it is popping another element, which is hidden on this step after). Why this bug appears? Did I did something wrong? Seems to me, everywhere only last state of array shown, not current:( help me please.

A: That's a known issue -- sounds like you are running under Chrome.
The easiest work-around is to JSON encode the value as you log in.
console.log(JSON.stringify(a));


text:
Q: Flutter pass User instance to another state and keep it updated I am trying to make a login/registration process and redirect user to a Dashboard view.
So I have this method:
Future _redirectToDashboard() async {
    var route = new MaterialPageRoute(
      builder: (BuildContext context) => new Dashboard(userID: userID),
    );
    Navigator.of(context).push(route);
  }

And then call it after login() is finished.
_register().whenComplete(() => _redirectToDashboard());

And then in Dashboard I do this:
class Dashboard extends StatefulWidget
{
  int userID;
  Dashboard({Key key, this.userID}) : super(key: key);
  @override
  _Dashboard createState() => _DashboardState();
}

And use it with:
Text('User ID: ${widget.userID}')

But then I cannot do this in Dashboard class:
Dashboard({Key key, this.userID, this.name, this.balance}) : super(key: key);

even though I set it in a function above as:
builder: (BuildContext context) => new Dashboard(userID: userID, name: name, balance: balance),

But it doesn't work. I get an error that name for example is not defined Why can I only pass one parameter? And is there a way how can I update the Dashboard with new data every time user opens this state?
I read that I should create a seperate User class with all properties. But how can I apply it to a dashboard?

A: I assume you only added constructor parameters, without adding the actual class members.
class Dashboard extends StatefulWidget
{
  final int userID;
  final String name;
  final String balance;
  Dashboard({Key key, this.userID, this.name, this.balance}) : super(key: key);
  @override
  _Dashboard createState() => _DashboardState();
}


text:
Q: Summing a formula containing a running total in Crystal 10 I have searched on other questions similar to this but none seem to be in the same situation.
I have a series of transactions in which I am using a running total named TranNumber which resets on the change of the account number. When I sort by descending transaction date this running total gives me the most recent transaction as 1.
I also have another formula which contains a list of transaction codes and their position on a workflow (done using a select case formula).
I have tried to sum the following formula as well as variations such as using variables and passing data into a sub report and back to 'trick' the software into not seeing it as a running total, still to no avail as I can then not sum a variable.
if {#TranNumber} = 1 then
if {@ProcCode} startswith "1 - " then 1 else 0

Ultimately I want a count of accounts in each position on the workflow to then put into a graphical form.
If anyone has tried to do this successfully or can suggest a way to only bring back the most recent transactions for each account to avoid having to use the above method it would be greatly appreciated :)
Thanks in Advance

A: Resolved this issue by using the formula above and assigning to a variable and placing a counter formula in the details which worked like the below
shared numbervar x;
If {#TranNumber} = 1 then
if {@ProcCode} startswith "1 - " then x := x + 1

I then placed this formula in the details and then simply output the variable in the report footer which gave me the number I was looking for.


text:
Q: Is there some way to remove the "hidden" attribute in all elements of a page? I've been trying to create a bookmarklet that unhides everything on a webpage, but it hasn't been working. Here's the code I have so far:
document.getElementsByTagName(*)[0].removeAttribute("hidden")

What do I have to do for it to unhide ALL elements?
Edit: I have found a line of code in the question linked below, thanks for helping!

Hi there

This is hidden p text

This is also hidden text with the bold tag

<button onclick="unhide()">Click Me</button>

A: Have a look at Find and remove attribute on all elements of a certain type

Best regards


text:
Q: How do I go from an array of pixel values to an image file in Java? I have some code that generates an image (a 2-d array of 8-bit grayscale values, but could be anything).
I want to export this image as a .png file.
Which path should I follow?
I'm really confused by javax.imageio and java.awt.Image.

A: Actually you need java.awt.image.BufferedImage as the image object, so you can use setRGB to set RGB value in a given (x,y) coordinate.
But to save you image as file you might want to use javax.imageio.ImageIO.
Here is a small example to emphasize how to use them both:
int[][] img = getImage();

int xLenght = img.length;
int yLength = img[0].length;

//java.awt.image.BufferedImage:
BufferedImage bi = new BufferedImage(xLenght, yLength, BufferedImage.TYPE_INT_BGR);

for(int x = 0; x < xLenght; x++) {
    for(int y = 0; y < yLength; y++) {
        int rgbPixel = (int)img[x][y]<<16 | (int)img[x][y] << 8 | (int)img[x][y];
                bi.setRGB(x, y, rgb);
    }
}
try {
    // javax.imageio.ImageIO:
    ImageIO.write(bi, "myImage", new File("myImage.png"));
} catch (IOException e) {
    e.printStackTrace();
}


text:
Q: Find if string exist in a vector of structs Good afternoon,
I'm here with a doubt that i am not able to overcome and i've tried a number of ways. I'm doing a program that among other things the user has to enter data about a product where the serial number has to be unique and of type char.  What is happening is that when i type the 1st product serial number the program returns that is already a product with this serial number despite being the 1st.
Here's the code I have:
#include <stdio.h>
#include <stdlib.h>

typedef struct
{
    char numeroserie;
    char descricao;
    float preco;
} stProduto;
/********************** Funcoes dos produtos *************************/
void inserirProduto(stProduto produtos[], int *contadorProdutos);
int procurarNumeroserie(stProduto produtos[], int contadorProdutos, char produtoAProcurar);

int main()
{
    stProduto produtos[500];
    int contadorProdutos=0;
    inserirProduto(produtos,&contadorProdutos);
    return 0;
}
void inserirProduto(stProduto produtos[], int *contadorProdutos)
{
    char string1;
    char posicao;
    do
    {
        printf("Introduza o numero de serie do produto:");
        scanf("%s",&string1);
        posicao =  procurarNumeroserie(produtos,*contadorProdutos, string1);
        if (posicao == 0)
        {
            printf("Ja existe um produto com esse numero de serie!!!\n");
        }
    }
    while(posicao == 0);
    strcpy(produtos[*contadorProdutos].numeroserie,string1);
    (*contadorProdutos)++;
}
int procurarNumeroserie(stProduto produtos[], int contadorProdutos, char produtoAProcurar)
{
   int i;
    char posicao;
    posicao = 0;
    for(i = 0 ; i < contadorProdutos ; i++)
    {
        if (strcmp(produtos[i].numeroserie, produtoAProcurar) == 0)
        {
            posicao=i;
            i=contadorProdutos;
        }
    }
    return posicao;
}

Someone help please !!I am already getting frustrated.
Thanks

A: You got it wrong, char is not a string type in c, it's an integer type.
A string is defined as a sequence of bytes non-nul that are followed by a nul byte.
They type char is 1 byte and hence a string can be an array of char, like the following
char string[6] = {'H', 'e', 'l', 'l', 'o', '\0'};
/*                                           ^ nul: it's mandatory
 *                                             for this to be a
 *                                             string
 */

The code you posted above seems to be Java originally with some fixes to make it compile, but if you enable compilation warnigs the compiler will really piss you off.
You can build a string from an array like I did above, or by using a pointer of char, in that case you need to point to an array or to dynamic memory allocated using malloc().
An example would be
char *hello;
hello = malloc(6);
if (hello == NULL)
    return ERROR; /* or whatever is need but do not continue */
strcpy(hello, "Hello");
/* do whatever you want with hello */
free(hello);

A: I have managed to put i to work:
#include <stdio.h>
#include <stdlib.h>

typedef struct
{
    char numeroserie[9];
    char descricao;
    float preco;
} stProduto;
/********************** Funcoes dos produtos *************************/
void inserirProduto(stProduto produtos[], int *contadorProdutos);
int procurarNumeroserie(stProduto produtos[], int contadorProdutos, char produtoAProcurar[9]);

int main()
{
    stProduto produtos[500];
    int contadorProdutos=0;
    inserirProduto(produtos,&contadorProdutos);
    return 0;
}
void inserirProduto(stProduto produtos[], int *contadorProdutos)
{
    char string1[9];
    char posicao;
    do
    {
        printf("Introduza o numero de serie do produto:");
        scanf("%s",&string1);
        posicao =  procurarNumeroserie(produtos,*contadorProdutos, string1);
        if (posicao == 0)
        {
            printf("Ja existe um produto com esse numero de serie!!!\n");
        }
    }
    while(posicao == 0);
    strcpy(produtos[*contadorProdutos].numeroserie,string1);
    (*contadorProdutos)++;
}
int procurarNumeroserie(stProduto produtos[], int contadorProdutos, char produtoAProcurar[9])
{
   int i;
    char posicao;
    posicao = 0;
    for(i = 0 ; i < contadorProdutos ; i++)
    {
        if (strcmp(produtos[i].numeroserie, produtoAProcurar) == 0)
        {
            posicao=i;
            i=contadorProdutos;
        }
    }
    return posicao;
}

Putting numeroserie [8]  i assure that the user just insert 8 characters ??
Thanks


text:
Q: How to find the average and instantaneous rate of change of $f(x)=3 \cdot x^2+5 \cdot x-4$ Let
                    $f(x)=3 \cdot x^2+5 \cdot x-4$
The average rate of change of $f$ between $x = 1$ and $x = 1.17$ equals...?
The instantaneous rate of change of $f$ at $x = 1$ equals...?
How can I answer these two questions?

A: $1.$ The average rate of change of $f(x)$ from $x=a$ to $x=b$ is
$$\frac{f(b)-f(a)}{b-a}.$$
In our case $a=1$, $b=1.17$, and $f(x)=3x^2+5x-4$.
We have $f(1.17)=3(1.17)^2 +5(1.17)-4$. I think this is $5.9567$. Also, $f(1)=4$.
Calculate.
$2.$ For the instantaneous rate of change at $x=1$, we need to compute $f'(1)$, the derivative of $f(x)$ at $x=1$.
The answers you get in ($1.$) and ($2.$) will not be equal, but will be fairly close to each other.


text:
Q: How can I use a proxy in a tool that doesn't have proxy options? I am using a command line tool that doesn't have proxy options, but I want to route its traffic through a proxy. How can I do that?

A: You can set up NetworkManager to route your system's traffic through your proxy. Click on the NetworkManager icon, then "Edit Connections...",  select the network you're connected to and click the cog icon. From there, click on the tab "Proxy" and enter the proxy information.


text:
Q: Azure TableQuery thread safety with Parallel.ForEach I have some basic Azure tables that I've been querying serially:
var query = new TableQuery<DynamicTableEntity>()
  .Where(TableQuery.GenerateFilterCondition("PartitionKey",
    QueryComparisons.Equal, myPartitionKey));

foreach (DynamicTableEntity entity in myTable.ExecuteQuery(query)) {
  // Process entity here.
}

To speed this up, I parallelized this like so:
Parallel.ForEach(myTable.ExecuteQuery(query), (entity, loopState) => {
  // Process entity here in a thread-safe manner.

  // Edited to add: Details of the loop body below:

  // This is the essence of the fixed loop body:
  lock (myLock) {
    DataRow myRow = myDataTable.NewRow();
    // [Add entity data to myRow.]
    myDataTable.Rows.Add(myRow);
  }

  // Old code (apparently not thread-safe, though NewRow() is supposed to create
  // a DataRow based on the table's schema without changing the table state):
  /*
    DataRow myRow = myDataTable.NewRow();
    lock (myLock) {
      // [Add entity data to myRow.]
      myDataTable.Rows.Add(myRow);
    }
  */
});

This produces significant speedup, but the results tend to be slightly different between runs (i.e., some of the entities differ occasionally, though the number of entities returned is exactly the same).
From this and some web searching, I conclude that the enumerator above is not always thread-safe. The documentation appears to suggest that thread safety is guaranteed only if the table objects are public static, but that hasn't made a difference for me.
Could someone suggest how to resolve this? Is there a standard pattern for parallelizing Azure table queries?

A: Your comment is correct: DataTable is not suitable for concurrent operations involving mutation and is the source of the duplicate entries. Locking the DataTable object for row modification operations will resolve the issue:
 lock (myTable)
 {
    DataRow myRow = myTable.NewRow();
    myRow.SetField<int>("c1", (int)value);
    myTable.Rows.Add(myRow);
 }

Putting NewRow() outside the lock will intermittently result in duplicate row entries in the table or "An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll" exceptions on the NewRow() line. For additional details and alternatives for concurrent DataTable usage see Thread safety for DataTable
To reproduce the error condition, use this code. Some runs will be clean, some will contain duplicate entries, and some will encounter exceptions.
   class Program
   {
      static DataTable myTable = GetTable();
      static ManualResetEvent waitHandle = new ManualResetEvent(false);

      static void Main(string[] args)
      {
         const int threadCount = 10;
         List<Thread> threads = new List<System.Threading.Thread>();
         for (int i = 0; i < threadCount; ++i)
         {
            threads.Add(new Thread(new ParameterizedThreadStart(AddRowThread)));
            threads[i].Start(i);
         }
         waitHandle.Set(); // Release all the threads at once
         for (int i = 0; i < threadCount; ++i)
         {
            threads[i].Join();
         }

         // Print results once threads return
         for (int i = 0; i < myTable.Rows.Count; ++i)
         {
            Console.WriteLine(myTable.Rows[i].Field<int>(0));
         }
         Console.WriteLine("---Processing Complete---");
         Console.ReadKey();
      }

      static void AddRowThread(object value)
      {
         waitHandle.WaitOne();
         DataRow myRow = myTable.NewRow(); // THIS RESULTS IN INTERMITTENT ERRORS
         lock (myTable)
         {
            //DataRow myRow = myTable.NewRow(); // MOVE NewRow() CALL HERE TO RESOLVE ISSUE
            myRow.SetField<int>("c1", (int)value);
            myTable.Rows.Add(myRow);
         }
      }

      static DataTable GetTable()
      {
         // Here we create a DataTable with four columns.
         DataTable table = new DataTable();
         table.Columns.Add("c1", typeof(int));
         return table;
      }
   }


text:
Q: IdentityUtil Class Definition Not Found Error in WSO2 API Manager 4.1 startup I am trying to run the wso2am-4.1.0 on Centos 7. And it cannot deploy these three webapps as follow.

*

*authenticationendpoint

*oauth2

*accountrecoveryendpoint

And it throws the Class org/wso2/carbon/identity/core/util/IdentityUtil not found error.
JAVA_HOME environment variable is set to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre
CARBON_HOME environment variable is set to /root/wso2am-4.1.0
Using Java memory options: -Xms256m -Xmx1024m
...

[2022-05-08 12:34:16,137]  INFO - EventProcessorDeployer Execution plan is deployed successfully and in active state  : carbon.super_sub_Unauthenticated
[2022-05-08 12:34:16,599] ERROR - [/accountrecoveryendpoint] Exception sending context initialized event to listener instance of class [org.wso2.carbon.identity.mgt.endpoint.util.listener.IdentityManagementEndpointContextListener]
java.lang.NoClassDefFoundError: org/wso2/carbon/identity/core/util/IdentityUtil
        at org.wso2.carbon.identity.mgt.endpoint.util.IdentityManagementServiceUtil.init(IdentityManagementServiceUtil.java:130) ~[org.wso2.carbon.identity.mgt.endpoint.util_5.18.248.jar:?]
        at org.wso2.carbon.identity.mgt.endpoint.util.listener.IdentityManagementEndpointContextListener.contextInitialized(IdentityManagementEndpointContextListener.java:34) ~[org.wso2.carbon.identity.mgt.endpoint.util_5.18.248.jar:?]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4768) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:303) ~[?:?]
        at org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:209) ~[?:?]
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleWebappDeployment(TomcatGenericWebappsDeployer.java:255) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleExplodedWebappDeployment(TomcatGenericWebappsDeployer.java:243) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleHotDeployment(TomcatGenericWebappsDeployer.java:173) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.deploy(TomcatGenericWebappsDeployer.java:140) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deployThisWebApp(AbstractWebappDeployer.java:224) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deploy(AbstractWebappDeployer.java:114) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.deployer.WebappDeployer.deploy(WebappDeployer.java:42) ~[org.wso2.carbon.webapp.deployer_4.11.3.jar:?]
        at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:153) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.synapse.Axis2SynapseController.deployMediatorExtensions(Axis2SynapseController.java:785) ~[synapse-core_2.1.7.wso2v271.jar:2.1.7-wso2v271]
        at org.apache.synapse.Axis2SynapseController.createSynapseEnvironment(Axis2SynapseController.java:403) ~[synapse-core_2.1.7.wso2v271.jar:2.1.7-wso2v271]
        at org.apache.synapse.ServerManager.start(ServerManager.java:187) ~[synapse-core_2.1.7.wso2v271.jar:2.1.7-wso2v271]
        at org.wso2.carbon.mediation.initializer.ServiceBusInitializer.initESB(ServiceBusInitializer.java:371) ~[org.wso2.carbon.mediation.initializer_4.7.131.jar:?]
        at org.wso2.carbon.mediation.initializer.ServiceBusInitializer.activate(ServiceBusInitializer.java:170) ~[org.wso2.carbon.mediation.initializer_4.7.131.jar:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_322]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_322]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_322]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_322]
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.wso2.carbon.inbound.endpoint.persistence.service.InboundEndpointPersistenceServiceDSComponent.activate(InboundEndpointPersistenceServiceDSComponent.java:50) ~[org.wso2.carbon.inbound.endpoint.persistence_4.7.131.jar:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_322]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_322]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_322]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_322]
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:529) ~[org.wso2.carbon.core_4.6.3.jar:?]
        at org.wso2.carbon.core.init.CarbonServerManager.removePendingItem(CarbonServerManager.java:305) ~[org.wso2.carbon.core_4.6.3.jar:?]
        at org.wso2.carbon.core.init.PreAxis2ConfigItemListener.bundleChanged(PreAxis2ConfigItemListener.java:118) ~[org.wso2.carbon.core_4.6.3.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:973) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
Caused by: java.lang.ClassNotFoundException: org.wso2.carbon.identity.core.util.IdentityUtil
        at org.wso2.carbon.webapp.mgt.loader.CarbonWebappClassLoader.loadClass(CarbonWebappClassLoader.java:195) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1215) ~[tomcat_9.0.58.wso2v1.jar:?]
        ... 76 more
[2022-05-08 12:34:16,599] ERROR - StandardContext One or more listeners failed to start. Full details will be found in the appropriate container log file
[2022-05-08 12:34:16,600] ERROR - StandardContext Context [/accountrecoveryendpoint] startup failed due to previous errors
[2022-05-08 12:34:16,692] ERROR - CarbonTomcat Cannot stop context
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_stop]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/accountrecoveryendpoint]] in state [DESTROYED]
        at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:430) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:244) ~[tomcat_9.0.58.wso2v1.jar:?]
        at org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:321) ~[?:?]
        at org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:209) ~[?:?]
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleWebappDeployment(TomcatGenericWebappsDeployer.java:255) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleExplodedWebappDeployment(TomcatGenericWebappsDeployer.java:243) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleHotDeployment(TomcatGenericWebappsDeployer.java:173) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.deploy(TomcatGenericWebappsDeployer.java:140) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deployThisWebApp(AbstractWebappDeployer.java:224) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deploy(AbstractWebappDeployer.java:114) ~[org.wso2.carbon.webapp.mgt_4.11.3.jar:?]
        at org.wso2.carbon.webapp.deployer.WebappDeployer.deploy(WebappDeployer.java:42) ~[org.wso2.carbon.webapp.deployer_4.11.3.jar:?]
        at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:153) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254) ~[axis2_1.6.1.wso2v80.jar:?]
        at org.apache.synapse.Axis2SynapseController.deployMediatorExtensions(Axis2SynapseController.java:785) ~[synapse-core_2.1.7.wso2v271.jar:2.1.7-wso2v271]
        at org.apache.synapse.Axis2SynapseController.createSynapseEnvironment(Axis2SynapseController.java:403) ~[synapse-core_2.1.7.wso2v271.jar:2.1.7-wso2v271]
        at org.apache.synapse.ServerManager.start(ServerManager.java:187) ~[synapse-core_2.1.7.wso2v271.jar:2.1.7-wso2v271]
        at org.wso2.carbon.mediation.initializer.ServiceBusInitializer.initESB(ServiceBusInitializer.java:371) ~[org.wso2.carbon.mediation.initializer_4.7.131.jar:?]
        at org.wso2.carbon.mediation.initializer.ServiceBusInitializer.activate(ServiceBusInitializer.java:170) ~[org.wso2.carbon.mediation.initializer_4.7.131.jar:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_322]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_322]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_322]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_322]
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.wso2.carbon.inbound.endpoint.persistence.service.InboundEndpointPersistenceServiceDSComponent.activate(InboundEndpointPersistenceServiceDSComponent.java:50) ~[org.wso2.carbon.inbound.endpoint.persistence_4.7.131.jar:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_322]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_322]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_322]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_322]
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:529) ~[org.wso2.carbon.core_4.6.3.jar:?]
        at org.wso2.carbon.core.init.CarbonServerManager.removePendingItem(CarbonServerManager.java:305) ~[org.wso2.carbon.core_4.6.3.jar:?]
        at org.wso2.carbon.core.init.PreAxis2ConfigItemListener.bundleChanged(PreAxis2ConfigItemListener.java:118) ~[org.wso2.carbon.core_4.6.3.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:973) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
...

I tried on window environment with same jdk 1.8 version. There is no such error.
Could you please help any suggestion?

A: WSO2 seems to be rather "fragile" in this area. I had the same issue on wso2am-3.1.0 between two minor versions of GKE. It started to fail if the node ran 1.21.10-gke.2000 while it ran fine on a node running on 1.21.9-gke.1002.
Comparing the two versions of COS and all in between this is the diff:

*

*Fixed a privilege escalation vulnerability in fs_context in the Linux kernel. This resolves CVE-2022-0185.

*sysctl changes: fs.file-max: 814342 -> 814343

*fixed CVE-2022-0492 in the Linux kernel.

*fixed CVE-2022-23648 in containerd.

*fixed CVE-2022-0847 in the Linux kernel.

Nothing of this seems to be relevant to WSO2. I also found this old issue, which seems to be dead.
Solutions I've found for the issue on GKE:

*

*Downgrade to 1.21.9-gke.1002

*Upgrade to 1.21.11-gke.900
Why does that help? No, clue. But it might be worth trying updates on your Centos system, especially Kernel updates.


text:
Q: Copy/Paste Range from one sheet to another I am trying too simply copy the cells with data in col A of a worksheet to another worksheet at row 2. With the following script the source worksheet name is entered into row 1 of Ave RLD worksheet. If that is all I try to do it will loop through all the worksheets and place their names in the next col of Ave RLD. As soon as I try to copy the data from col A and paste it to Ave RLD I get a Run time error 1004. I left in all the commented lines of things I have been trying. What am I missing?
Dim WS_count As Long
Dim I As Long
Dim ws As Worksheet
Dim ColNum As Long
Dim wksName As String
Dim NumRows As Long

ColNum = 1

Sheets.Add Type:=xlWorksheet
ActiveSheet.Name = "Ave RLD"

For Each ws In ActiveWorkbook.Worksheets
    If Left(Trim(ws.Name), 3) = "RLD" Then
        wksName = ws.Name
        NumRows = ws.Range("A" & Rows.Count).End(xlUp).Row
        MsgBox NumRows
        With Worksheets("Ave RLD")
            .Cells(1, ColNum).Value = wksName
            ws.Range(Cells(1, 1), Cells(NumRows, 1)).Copy
            .Range(Cells(2, ColNum)).Paste.Values
            '.Range(Cells(2, ColNum)).Value = .Range(("A1"), Range("A1").End(xlUp))
            '.Range(Cells(2, ColNum)).Value = ws.Range("A" & Rows.Count).End(xlUp).Row
            'MsgBox ws.Cells(1, 26).Value
            '.Cells(2, ColNum).Value = .Worksheets(wksName).Cells(1, 26)
            '.Worksheets(wksName).Cells(1, 1).Copy
            'Worksheets(wksName).Range(.Cells(1, 1), .Cells(.Rows.Count, 1).End(xlUp)).Copy
            '.Cells(2, ColNum).Paste

            ColNum = ColNum + 1
        End With
    End If
Next ws

A: Does this do what you want?
Lots on this at this site, but this line will error if ws is not the active sheet as you do not fully qualify all the ranges
ws.Range(Cells(1, 1), Cells(NumRows, 1)).Copy
And the other line commented below just needs Range or Cells, also your paste values syntax was off - recording a macro is one way to sort out such details.
Dim WS_count As Long
Dim I As Long
Dim ws As Worksheet
Dim ColNum As Long
Dim wksName As String
Dim NumRows As Long

ColNum = 1

Sheets.Add Type:=xlWorksheet
ActiveSheet.Name = "Ave RLD"

For Each ws In ActiveWorkbook.Worksheets
    If Left(Trim(ws.Name), 3) = "RLD" Then
        wksName = ws.Name
        NumRows = ws.Range("A" & Rows.Count).End(xlUp).Row
        MsgBox NumRows
        With Worksheets("Ave RLD")
            .Cells(1, ColNum).Value = wksName
            ws.Range(ws.Cells(1, 1), ws.Cells(NumRows, 1)).Copy 'fully qualify with ws
            .Cells(2, ColNum).PasteSpecial xlpasteValues 'just Cells
            ColNum = ColNum + 1
        End With
    End If
Next ws


text:
Q: Webpack: How to migrate CommonsChunkPlugin (wp3) to optimization.splitChunks (wp4)? I'm trying to migrate to webpack4 from 3 and I'm having a really hard time migrating CommonsChunkPlugin.
On WP3, I have the following simplified configuration:
const entries = {
  client: './src/index.js',
  common1: ['lodash'],
  common2: ['react', 'react-dom']
};

module.exports = {
  ...
  entry: entries,
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      names: ['common1', 'common2'],
      minChunks: Infinity
    })
  ]
};

On WP4 I've already tried multiple combinations using optimization.splitChunks but I just can't get it to properly bundle my modules in a way that they are sharing common dependencies, like it used to be on WP3.
Here is what I used on my last try, but the final bundles are much bigger in size:
// same entries object
const entries = { ... };

module.exports = {
  ...
  entry: entries,
  optimization: {
    splitChunks: {
    minChunks: Infinity,
    chunks: 'initial',
    cacheGroups: {
      common1: { test: 'common1' },
      common2: { test: 'common2' },
      // disables the default definition of these cache groups
      vendors: false,
      default: false
    }
  }
};

A: You can simply set enforce = true and this will "force" webpack to always create chunks for the cache group.
If you're doing code splitting (using import()) then you'll want to set chunks = "all", because with "initial" you're only grouping sync modules.
And finally, if the groups "common1" and "common2" are likely to share any modules, you might consider giving one cache group a higher priority over the other, for example if "common1" is likely to be loaded first, this should have a higher priority so that "common2" does not need to be downloaded as a dependency.
Some useful links to helpfully demystify this stuff:

*

*https://medium.com/dailyjs/webpack-4-splitchunks-plugin-d9fbbe091fd0

*https://webpack.js.org/plugins/split-chunks-plugin

*https://stackoverflow.com/a/49213048/2039244

module.exports = {
  ...
  entry: entries, // entries -> entry
  optimization: {
    splitChunks: {
      cacheGroups: {
        common1: {
          test: 'common1',
          chunks: 'all',
          enforce: true
        },
        common2: {
          test: 'common2',
          chunks: 'all',
          enforce: true
        },
        // disables the default definition of these cache groups
        vendors: false,
        default: false
      }
    }
};


text:
Q: How to know that a simple linear regression model is good enough if the independent variable is not normally distributed? I would like to start saying that I am knew to statistics therefore yet a lot ahead of me. I ask for apologies if something sounds trivial.
The problem
We have a sample of 30 Nitrogen and Carbon isotope observations each taken from hard parts from a fish population. Each sample undergoes a treatment that have two phases where each phase is treated with a substance. So:

*

*A is the sample of raw isotope values

*B is the sample of the isotope values after treatment 1 has been applied

*C is the sample of the isotope values after treatment 1 and 2 have been applied.

We want to know if we can use the isotope values in C after both treatment have been applied, and then infer back what the actual raw isotope values were with no treatment via. For that we propose the simple regression line as estimator.
Sample's distribution type
By using a Shapiro-Will normality test we have determined that A is non-parametric (p-value =0.0008 and 0.02 for Nitrogen and Carbon respectively)
Regression lines performed
When we run the linear models we get that the p-value for the slope coefficients are very very significant for both ~ 10 to -12. Not so for the intercepts though but this may have an explanation based on the chemistry of the substance applied. The R Square is ~ 0.88 roughly for both indicating great correlation between A and B. Between A and C the R square is ~0.85
My Questions
a) A for both N and C, the Shapiro-wilk test yielded that they may not be normalised. However the response variable (B and C) for Carbon and Nitrogen "behaves" differently. For the former the new sampled population does follow a normal distribution but not for Nitrogen. Reading What if residuals are normally distributed, but y is not? I see that it doesn't matter, what matters is that the response is normalised just from an optimal perspective. It could even not be normalised, apparently. Is this your conclusion too, please?
b) I was thinking about using another model to compare it to the actual simple linear regression and use AIC tests in order to "prove" that linear regression as a predictor performs better. This derive from the fact that our original samples are not normally distributed. For example, I could use GLM however I do not know what distribution fits best A and GLM can only be used with exponential distributions. Is this step necessary in order to show that the linear regression performs betters than others? Would you suggest another model to try please?
c) Should I try to check if the residuals are normally distributed, which is, I believe what matters here the most? The Residuals standard error is about ~ 0.2.
My problem is that in general I am not sure if enough is enough when it comes to evaluate if the regression line is a good predictor for our case beyond the statistics I showed here.


text:
Q: How to merge two array of objects containing different values of same key, and also push new object into the array? I have two arrays:
arr1 = [
  {
    "OwnershipNumber": 0,
    "ID": null,
    "Name": "Contractor LLC",
    "ContrEmployeeTypeId": 0,
    "ContactEmail": "",
    "ContactPhone": "",
    "VeteranEmployeeMilitaryAffiliation": "",
    "SocialSecurityNumber": "",
    "DrivingLicense": "",
    "DateOfBirth": null,
    "OwnershipPercentage": 0,
    "IsContractorActive": "Y",
    "VeteranFlag": "N",
    "VeteranEmployeeHireDate": null,
    "LegalIssueFlag": "N",
    "ActiveFlag": true,
    "TimeStamp": null
  },
  {
    "OwnershipNumber": 1878,
    "ID": null,
    "Name": "Greg Dawson",
    "ContrEmployeeTypeId": 2,
    "ContactEmail": "pra@abc.com",
    "ContactPhone": "455-455-6444",
    "VeteranEmployeeMilitaryAffiliation": null,
    "SocialSecurityNumber": "454534245",
    "DrivingLicense": "44524245",
    "DateOfBirth": "11/30/1968 12:00:00 AM",
    "OwnershipPercentage": 100,
    "IsContractorActive": "Y",
    "VeteranFlag": "N",
    "VeteranEmployeeHireDate": null,
    "LegalIssueFlag": "N",
    "ActiveFlag": true,
    "TimeStamp": null
  }
]

arr 2 = [ {"OwnershipNumber": 1878, "ContactPhone": "111-222-6444"},
 {
    "OwnershipNumber": null,
    "ID": 3,
    "SocialSecurityNumber": "465464654",
    "DrivingLicense": "464654654654",
    "DateOfBirth": "1998-12-12T18:30:00.000Z",
    "VeteranEmployeeHireDate": "1970-01-01T00:00:00.000Z",
    "Name": "Tom Hanks",
    "ContrEmployeeTypeId": 1,
    "IsContractor": "N",
    "ContactEmail": "tom@gmail.com",
    "ContactPhone": "564-465-4654",
    "OwnershipPercentage": 100
  }
]

I am trying to accomplish this after merging and pushing:
arr3 = [
      {
        "OwnershipNumber": 0,
        "ID": null,
        "Name": "Contractor LLC",
        "ContrEmployeeTypeId": 0,
        "ContactEmail": "",
        "ContactPhone": "",
        "VeteranEmployeeMilitaryAffiliation": "",
        "SocialSecurityNumber": "",
        "DrivingLicense": "",
        "DateOfBirth": null,
        "OwnershipPercentage": 0,
        "IsContractorActive": "Y",
        "VeteranFlag": "N",
        "VeteranEmployeeHireDate": null,
        "LegalIssueFlag": "N",
        "ActiveFlag": true,
        "TimeStamp": null
      },
      {
        "OwnershipNumber": 1878,
        "ID": null,
        "Name": "Greg Dawson",
        "ContrEmployeeTypeId": 2,
        "ContactEmail": "pra@abc.com",
        "ContactPhone": "111-222-6444",
        "VeteranEmployeeMilitaryAffiliation": null,
        "SocialSecurityNumber": "454534245",
        "DrivingLicense": "44524245",
        "DateOfBirth": "11/30/1968 12:00:00 AM",
        "OwnershipPercentage": 100,
        "IsContractorActive": "Y",
        "VeteranFlag": "N",
        "VeteranEmployeeHireDate": null,
        "LegalIssueFlag": "N",
        "ActiveFlag": true,
        "TimeStamp": null
      },
{
    "OwnershipNumber": null,
    "ID": 3,
    "SocialSecurityNumber": "465464654",
    "DrivingLicense": "464654654654",
    "DateOfBirth": "1998-12-12T18:30:00.000Z",
    "VeteranEmployeeHireDate": "1970-01-01T00:00:00.000Z",
    "Name": "Tom Smith",
    "ContrEmployeeTypeId": 1,
    "IsContractor": "N",
    "ContactEmail": "tom@gmail.com",
    "ContactPhone": "564-465-4654",
    "OwnershipPercentage": 100
  }
    ]

The first array (arr1) is the master array, the second array (arr2) contains only the changes that has been done with respect to the first array (in this example you can see ownership number 1878 has a change in ContactPhone field, therefore ContactPhone along with OwnershipNumber is present in arr2, it can also include a new object like the one with name field Tom Smith (this one doesn't exist in arr 1), I am trying to merge the the change on basis of OwnershipNumber and ContactEmail  and add the new element i.e. the object which has the name field Tom Smith into the new array (arr3)). The change and inclusion of new elements is optional which means there is a case where arr 2 maybe blank. Please help me out on this.

A: I assuming the OwnerdhipNumber is a unique key to know on which object you want to make changes (or add, if this number not exist yet). In this case the below code meight work for you:

const arr1 = [{"OwnershipNumber": 0,"ID": null,"Name": "Contractor LLC","ContrEmployeeTypeId": 0,"ContactEmail": "","ContactPhone": "","VeteranEmployeeMilitaryAffiliation": "","SocialSecurityNumber": "","DrivingLicense": "","DateOfBirth": null,"OwnershipPercentage": 0,"IsContractorActive": "Y","VeteranFlag": "N","VeteranEmployeeHireDate": null,"LegalIssueFlag": "N","ActiveFlag": true,"TimeStamp": null},{"OwnershipNumber": 1878,"ID": null,"Name": "Greg Dawson","ContrEmployeeTypeId": 2,"ContactEmail": "pra@abc.com","ContactPhone": "455-455-6444","VeteranEmployeeMilitaryAffiliation": null,"SocialSecurityNumber": "454534245","DrivingLicense": "44524245","DateOfBirth": "11/30/1968 12:00:00 AM","OwnershipPercentage": 100,"IsContractorActive": "Y","VeteranFlag": "N","VeteranEmployeeHireDate": null,"LegalIssueFlag": "N","ActiveFlag": true,"TimeStamp": null}];
const arr2 = [ {"OwnershipNumber": 1878, "ContactPhone": "111-222-6444"},{"OwnershipNumber": null,"ID": 3,"SocialSecurityNumber": "465464654","DrivingLicense": "464654654654","DateOfBirth": "1998-12-12T18:30:00.000Z","VeteranEmployeeHireDate": "1970-01-01T00:00:00.000Z","Name": "Tom Hanks","ContrEmployeeTypeId": 1,"IsContractor": "N","ContactEmail": "tom@gmail.com","ContactPhone": "564-465-4654","OwnershipPercentage": 100}];
arr2.forEach(t => {
  for(const [idx, obj] of arr1.entries()){
    if(obj.OwnershipNumber === t.OwnershipNumber) {
      // The object exist in arr1, need to update the existing object
      arr1[idx] = {...arr1[idx], ...t};
      return;
    }
  }
  // The object not already exist. we should add it to the array
  arr1.push(t);
});
console.log(arr1);

A: There must be a unique key in order to group your data. Here I think it could OwnershipNumber your unique key. Now coming to the solution, we can make use of reduce() to group the data:

const arr1 = [{"OwnershipNumber": 0,"ID": null,"Name": "Contractor LLC","ContrEmployeeTypeId": 0,"ContactEmail": "","ContactPhone": "","VeteranEmployeeMilitaryAffiliation": "","SocialSecurityNumber": "","DrivingLicense": "","DateOfBirth": null,"OwnershipPercentage": 0,"IsContractorActive": "Y","VeteranFlag": "N","VeteranEmployeeHireDate": null,"LegalIssueFlag": "N","ActiveFlag": true,"TimeStamp": null},{"OwnershipNumber": 1878,"ID": null,"Name": "Greg Dawson","ContrEmployeeTypeId": 2,"ContactEmail": "pra@abc.com","ContactPhone": "455-455-6444","VeteranEmployeeMilitaryAffiliation": null,"SocialSecurityNumber": "454534245","DrivingLicense": "44524245","DateOfBirth": "11/30/1968 12:00:00 AM","OwnershipPercentage": 100,"IsContractorActive": "Y","VeteranFlag": "N","VeteranEmployeeHireDate": null,"LegalIssueFlag": "N","ActiveFlag": true,"TimeStamp": null}];
const arr2 = [ {"OwnershipNumber": 1878, "ContactPhone": "111-222-6444"},{"OwnershipNumber": null,"ID": 3,"SocialSecurityNumber": "465464654","DrivingLicense": "464654654654","DateOfBirth": "1998-12-12T18:30:00.000Z","VeteranEmployeeHireDate": "1970-01-01T00:00:00.000Z","Name": "Tom Hanks","ContrEmployeeTypeId": 1,"IsContractor": "N","ContactEmail": "tom@gmail.com","ContactPhone": "564-465-4654","OwnershipPercentage": 100}];

var result = Object.values([...arr1, ...arr2].reduce((acc, {OwnershipNumber, ...rest})=>(
   acc[OwnershipNumber] = {...(acc[OwnershipNumber] || {}), ...{OwnershipNumber, ...rest}},
   acc
),{}));

console.log(result);


text:
Q: Why can't vb catch a query error This is my current code:
Dim query As String = "SELECT * FROM tblPiglets WHERE Week=@week AND SowOrder=@so AND PigletNumber=@pig"

    Using cmd As New OleDbCommand(query, con)
        With cmd.Parameters
            .AddWithValue("@week", txtWeek.Text)
            .AddWithValue("@so", txtSo.Text)
            .AddWithValue("@pig", txtPiglet.Text)
        End With
        Dim dr As OleDbDataReader = cmd.ExecuteReader()
        While dr.Read
            Dim loc As String
            loc = dr("CurrentLocation").ToString()
            If loc = ComboBox1.Text Then
                confirmed()
            Else
                invalid()
            End If
        End While
    End Using

First user is oblige to input a unique id, which is week, sow order and number. Then it will check if the selected item's CurrentLocation field is the same to ComboBox1.Text. If yes, go on, if not, error.
However, Nothing happens when the user inserted a not existing data. Say, I have 3 data (unique "id's").

*

*1-1-0

*1-1-1

*2-1-0

If I try to input 2-1-1, which is not existent, nothing happens. I would like to catch this, so the user will know that its an invalid input.

A: You need to check whether there are any results yourself. For an SQL query, it is not an error if it does not return any rows.
The following code is an example for such a check:
Dim dr As OleDbDataReader = cmd.ExecuteReader()
If dr.Read() Then
    Do
       Dim loc As String
       loc = dr("CurrentLocation").ToString()
       If loc = ComboBox1.Text Then
           confirmed()
       Else
            invalid()
        End If
   Loop While dr.Read()
Else
    ' Add code for no records here
End If

Note that if you want to check for an invalid id specifically, you'd need to add a special check for that. The above sample only checks whether any rows were returned. The reason for this could also be that there are no data for week or soworder.

A: Add some code that checks that the dr is not null.
If Not IsNothing(dr) Then
   While dr.read....

Else
  'No records
End If