text:
Q: Handler for dynamically created DOM nodes as they are inserted I enjoy running custom scripts on pages that I do not own or control.  Many times these pages have dynamically created content that I would like to apply a function to.
Is this possible?  If so, how can I do this?  Ideally I am looking for something live jQuery's live method, except instead of binding an event like click it would be more like an event that happens when the element is loaded in the DOM.  load event would work for some elements but I don't think for all...
For this question, assume that you cannot look at or change the code that is inserting the DOM nodes.  I would like a technique that I could use in a userscript or bookmarklet that could be used across multiple unrelated sites.
Edit: I am looking for something to use on my invert colors bookmarklet: JavaScript: Invert color on all elements of a page

A: If you don't have access to a library like jQuery, here is the syntax in only-JavaScript :
document.addEventListener('DOMNodeInserted', nodeInsert)

function nodeInsert () {
  event.srcElement.style.color = '#ffffff'
}

I think it should work in most browsers.

A: Here is one nice way to handle the node insertion event. set animations for the element that you are going to add using css.

#parent is the id for the div, in which i am going to append button's
  dynamically.

A: This is rather difficult to accomplish, because there is no viable event for reacting to DOM changes. I would rather stick to event delegation instead.
But there are some events that you may find useful or interesting. On Mozilla Developer Network's list of DOM events you can see eg.:

*

*DOMNodeInserted,

*DOMNodeInsertedIntoDocument,

*DOMNodeRemoved,

*DOMElementNameChanged,

All of them however are marked as W3C drafts.

A: Assuming you're running a browser like Firefox or Chrome, you could listen for the DOMNodeInserted event:
$(document).on('DOMNodeInserted', function(e) {
    $(e.target).css({ color : '#c00' });
});

$('body').append('
test
');

Fiddle: http://jsfiddle.net/VeF6g/ (probably fails in IE)
Update:
The event is deprecated. You should use a MutationObserver:
var observer = new MutationObserver(function(mutationList) {
    for (var mutation of mutationList) {
        for (var child of mutation.addedNodes) {
            child.style.color = '#c00';
        }
    }
});
observer.observe(document, {childList: true, subtree: true});

// ready? Then stop listening with
observer.disconnect();

More information here: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver

A: A generic way to detect node insertion is to use the DOMNodeInserted mutation event.

I am interested in every node actually. I am changing the colors of everything on the page.

For this purpose, a better solution is to inject a dynamic stylesheet, sufficed with the !important flag. If you only want to change colors, I recommend the Stylish extension (Stylish for Chrome) instead of GreaseMonkey.


text:
Q: Getting error while uninstalling java from command line wmic product where "name like 'Java%'" call uninstall? when i am running command wmic product where "name like 'Java%'" call uninstallto uninstall java it is killing all java.exe's but showing error at last.
`C:\Users\m1024193\Desktop>wmic product where "name like 'Java%'" call uninstall
Executing (\\B3MD18600\ROOT\CIMV2:Win32_Product.IdentifyingNumber="{26A24AE4-039
D-4CA4-87B4-2F83216029FF}",Name="Java(TM) 6 Update 29",Version="6.0.290")->Unins
tall()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 0;
};

ERROR:
Description = Generic failure`

redpajama_set_name: RedPajamaStackExchange


text:
Q: create a particular detail view i need help to formulate a query.
my models are this:
class Rider(models.Model):
    id_rider = models.IntegerField(default = 0,blank= True, primary_key=True)
    first_name = models.CharField(max_length = 256,blank= True)

[...]
        def str(self):
            return self.display_name
class Risultato(models.Model):
    TYPE_CHOICES = (('SR','sr'),('ITT', 'itt'),('HC', 'hc'),('1C','1c'),('TTT','ttt'))

    id_rider = models.ForeignKey(Rider,related_name='rider', on_delete=models.CASCADE)
    id_stage = models.ForeignKey(Stage,related_name='team', on_delete=models.CASCADE)
    type_ris = models.CharField(choices=TYPE_CHOICES,max_length = 256,blank= True)
    rank = models.IntegerField(default = 0,blank= True)
    punti = models.IntegerField(default = 0,blank= True)

    def __str__(self):
        return self.id_raider,self.id_stage,self.rank

i need to create a Detail View to details of riders, somethings like this:
-------------------------------------------

Rider: [display_name]
age : [age]
...
...
--------SCORE HISTORY-----
stage   sr/itt       ttt        hc      1c      tot
1        100    null    10    0    110
2         null     20   5     10   35
Thanks in advance!!
UPDATE
i add the view and the template, but i can't see the table
view.py:
class RiderDetails(DetailView):

    model = Rider
    template_name = 'game/rider_detail.html'

    def get_context_data(self, *args, **kwargs):
        context_data = super().get_context_data(**kwargs)
        context_data['risultato_qs'] = Risultato.objects.filter(id_rider=self.object)
        return context_data

rider_detail.html:
{% extends 'game/base.html'%}
{% block content %}

{{ rider.display_name }}

    {% for risultato in risultato_qs %}

            {{ risultato.stage }}
            {{ risutato.type_ris }}
            {{ risutato.punti }}
            ... etc ...

    {% endfor %}

{% endblock %}

screen page

A: A quick example might look like:
class RiderDetails(DetailView):

    model = Rider
    template_name = 'path_to_rider_template'

    def get_context_data(self, *args, **kwargs):
        context_data = super().get_context_data(*args, **kwargs)
        context_data['risultato_qs'] = Risultato.objects.filter(id_rider=self.object)
        return context_data

Then in your template you can, for example:
... Rider details here ...

    {% for risultato in risultato_qs %}

            {{ risultato.stage }}
            {{ risutato.type_ris }}
            ... etc ...

    {% endfor %}


text:
Q: Denying access to a specific url using .htaccess file I do not use any framework
I have a folder named 'uploads' and a sub-folder named images that i upload my images in
It's obvious that I want users to access some images, but if users try to load, for example, this URL:
'example.com/uploads/'
they have access to all my images
so my question is where should I upload my images?
or how can I deny access to a specific URL?

A: You can create a .htaccess file for the folder, which should have denied access with
Deny from  all


text:
Q: "The system cannot find the file specified" for .out and .in extensions I have a BufferedReader and BufferedWriter like this (commentor asked to see entire code) to test some training page:
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new FileReader("inputFile.in"));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("inputFile.out")));

        int N = Integer.parseInt(bf.readLine());

        int[] dayCount = {0, 0, 0, 0, 0, 0, 0}; //Line 19

        int day = 0;
        for (int year = 1990; year < 1990 + N; year++) {
            for (int month = 1; month <= 12; month++) {
                if (month == 2) {
                    if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
                        dayCount[(day + 13) % 7]++;
                        day += 29;
                    } else {
                        dayCount[(day + 13) % 7]++;
                        day += 28;
                    }
                }
                else if (month == 4 || month == 6 || month == 9 || month == 11) {
                    dayCount[(day + 13) % 7]++;
                    day += 30;
                }
                else {
                    dayCount[(day + 13) % 7]++;
                    day += 31;
                }
            }
        }
        for (int i = 0; i < 7; i++) {
            if (i < 6)
                pw.print(dayCount[(i + 6) % 7] + " ");
            else
                pw.print(dayCount[(i + 6) % 7]);
        }
        pw.println();
        pw.close();
    }

I'm currently using VS Code, and when I ran the code, there was a pop-up (which I don't know how to reproduce) that said something along the lines of "The Marketplace has an extension that helps with the .out file extension." I looked in the extensions and then Googled and couldn't find an extension for .in and .out files. The reason I want one is because of the error which is thrown, even though I have the files created in the current working directory. This is the error:
Exception in thread "main" java.io.FileNotFoundException: inputFile.in (The system cannot find the file specified)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:212)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:154)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:109)
        at java.base/java.io.FileReader.<init>(FileReader.java:60)
        at iotests.iotests.main(ioTests.java:19)

I have commented line 19 above.

A: This is because your filename extension is strange, VSCode don't know which program can open it, so, it just hint you to find some program in the marketPlace to open it, just that. so, stop use the name of 'inputFile.in', 'inputFile.out', '.in', '.out' is the
filename extensions, just '.txt'.


text:
Q: regex. group front and surname from the Pathstring with Python I need to extract the Names from the following strings (folder_names). I made them into raw strings.
some examples:
'.\\\\Jens, Jensen\\\\Rechnungen\\\\Rechnungen 2020\\\\somefoldername'
'.\\Harald, Hardraala\\Rechnungen 2017'
'.\\A - H\\Johan, Johanson\\Rechnungen 2017'
'.\\\\Jens-Haudraf, Johan\\\\Rechnungen\\\\Rechnungen 2020\\\\anotherfoldername'
'.\\A - H\\Funke, Felix'

I want the Names in one group. I can't do it. This is what I came up with
r'\\*(\w*\-{0,1},{0,1} {0,1}\w*)'

A: The following code will extract the names assuming the format remains the same i.e. one word name (possibly with hyphen) + comma + another one word name (possibly with hyphen).
import re
strings = ['.\\\\Jens, Jensen\\\\Rechnungen\\\\Rechnungen 2020\\\\somefoldername',
'.\\Harald, Hardraala\\Rechnungen 2017',
'.\\A - H\\Johan, Johanson\\Rechnungen 2017',
'.\\\\Jens-Haudraf, Johan\\\\Rechnungen\\\\Rechnungen 2020\\\\anotherfoldername',
'.\\A - H\\Funke, Felix']

matches = [ re.search("[\w-]+, [\w-]+",s).group() for s in strings ]

print(matches)
>>>
['Jens, Jensen', 'Harald, Hardraala', 'Johan, Johanson', 'Jens-Haudraf, Johan', 'Funke, Felix']

A: You could match a backslash followed by word characters with an optional hyphened part. Then match a space and again word characters.
The value is in the first capturing group.
Pattern
\\(\w+(?:-\w+)?, \w+)

In parts

*

*\\ Match \

*( Capture group 1

*

*\w+(?:-\w+)? Match 1+ word chars with an optional - and 1+ word chars

*, \w+ Match a comma, space and 1+ word chars

*) Close group 1

Regex demo | Python demo
Example code
import re

regex = r"\\(\w+(?:-\w+)?, \w+)"
strings = [
    '.\\\\Jens, Jensen\\\\Rechnungen\\\\Rechnungen 2020\\\\somefoldername',
    '.\\Harald, Hardraala\\Rechnungen 2017',
    '.\\A - H\\Johan, Johanson\\Rechnungen 2017',
    '.\\\\Jens-Haudraf, Johan\\\\Rechnungen\\\\Rechnungen 2020\\\\anotherfoldername',
    '.\\A - H\\Funke, Felix'
]

for s in strings:
    matches = re.search(regex, s)
    if matches:
        print(matches.group(1))

Output
Jens, Jensen
Harald, Hardraala
Johan, Johanson
Jens-Haudraf, Johan
Funke, Felix


text:
Q: Ninject access instance resolution path What I have in mind is some sort of logging mechanism.
Most of my classes get an ILogger service by dependency injection.
What I'd like is to have some sort of "path" information automatically attached to the logging service. By "path" i mean something like "where was the Log()-calling instance injected", all the way up to the top-most scope.
Example:
class A
{
    public A(string name, B b, ILogger logger)
    {
        ...
    }
}

class B
{
    public B(string name, C c, ILogger logger)
    {
        ...
    }
}

class C
{
    public C(string name, ILogger logger)
    {
        logger.Log("Hello World");
    }
}

Then, when C is created, I want to get this output:
A[nameOfA] -> B[nameOfB] -> C[nameOfC]: Hello World
Any ideas how to achieve this in a generic way, i.e. without manual wiring each class? I already tried to access this information via ParentContext and ParentRequest inside the .ToMethod(..) binding, but didn't come up with a solution.
Best regards
Kc


text:
Q: Extend primitives without prototyping them I am working on a pretty ugly library that lets you do some strange things.
Having a graph you can map a set of collections in a chain-like style and when you alter a
value to be altered in the whole system.
The problem came when the end type is a JS primitive.
In my case after making the graph with the values and objects I can do something like this:
CHAIN.components[0].value = 20;

components is a filter function over the graph's nodes using setters and getters.
If there is only one node filtered in components the default value set by the user would be available without doing this:
    CHAIN.components.value = 20;
But rather this:
    CHAIN.components = 20;
Now the problem is that the node could have other methods or properties besides a default ( which in my case is set on value.
How can i use the setters and getters on Number object without hacking in the Number.prototype, because CHAIN.components is now a Number ( if it's not a primitive i've made it work in an unobtrusive way ), but when i want to call the CHAIN.components.func() there is a problem because i would have to append to the Number.prototype the func every time i make a set or get on the components and then delete it.
Do you have another idea for accomplishing this kind of behavior?
You wanted code so here it is:
/*jslint nomen: true, sloppy: true*/
GRID.modules.OHM || Object.extend(GRID.modules, ( function() {
    var Node, Nodes, Ohm, num_proto = Number.prototype.__clone(), str_proto = String.prototype.__clone();
    Node = function(uid) {
        var UID = uid;
        this.getUID = function() {
            return UID;
        };
    };
    Nodes = function() {
        var stack = [];
        this.add = function(id, val) {
            var n = new Node(stack.length);
            val.id = id;
            Object.extend(n, val);
            stack.push(n);
            return n.getUID();
        };
        this.getById = function(id) {
            return stack.filter(function(v) {
                var a = id || v.id;
                return (v.id === a);
            });
        };
        this.getByUID = function(UID) {
            return stack[UID];
        };
        this.get = function(callback) {
            !Object.isString(callback) || ( callback = [callback]);
            var f = Object.isFunction(callback) ? callback : (Object.isArray(callback) ? function(k) {
                return (callback.indexOf(k.id) >= 0);
            } : function(k) {
                return true;
            });
            return stack.filter(f);
        };
    };
    Ohm = function(n) {
        var graph = n || (new Nodes()), filters = {}, __nodes = {}, addGS = function(obj, name, conf, binder) {
            var alfa = {};
            Object.extend(alfa, conf);
            if (!alfa.get) {
                alfa.get = function() {
                    var a = this.g.getById(this.p);
                    return a.length === 1 ? a[0] : a;
                }.bind(binder);
            } else {
                alfa.get = alfa.get.bind(binder);
            }
            if (!alfa.set) {
                alfa.set = function(value) {
                    this.g.getById(this.p).forEach(function(k) {
                        Object.extend(k, value);
                        return true;
                    });
                }.bind(binder);
            } else {
                alfa.set = alfa.set.bind(binder);
            }
            Object.defineProperty(obj, name, alfa);
        }, add = function(id, node) {
            if (__nodes.hasOwnProperty(id)) {
                addGS(__nodes, id, {
                    enumerable : true
                }, {
                    t : this,
                    p : id,
                    g : graph
                });
            }
            return graph.add(id, node || {});
        };
        Object.extend(this, {
            add : function() {
                add.apply(this, arguments);
            },
            map : function(name, f, that) {
                var n = name, filterer = ['add', 'map', '__all'];
                n = Object.isFunction(n) ? name.apply(that, arguments.slice(3)) : n;
                if (filterer.indexOf(n.toLowerCase()) >= 0) {
                    console.log("You can't map over a basic property of object !!! Please read the freakin' manual.");
                    return null;
                }
                if (!filters.hasOwnProperty(n)) {
                    filters[n] = new Ohm(graph);
                    addGS(this, n, {
                        get : function() {
                            this.g.get(this.f).forEach(function(v, key, arr) {
                                var temp, binder;
                                if (arr.length !== 1) {
                                    if (!this.filt.hasOwnProperty(v.id)) {
                                        addGS(this.filt, v.id, {
                                            set : function(value) {
                                                this.t.g.getById(this.p).filter(this.t.f).forEach(function(k) {
                                                    Object.extend(k, value);
                                                });
                                            },
                                            get : function() {
                                                var a = this.t.g.getById(this.p).filter(this.t.f);
                                                return a.length === 1 ? a[0] : a;
                                            }
                                        }, {
                                            t : this,
                                            p : v.id
                                        });
                                        (key !== arr.length - 1) || Object.extend(this.filt, this.g.get(this.f));
                                    }
                                } else {
                                    if (Object.isFunction(v.__new__)) {
                                        v.__default = function() {
                                            return Object.extend((new this.__new__(arguments)), this);
                                        };
                                    }
                                    if (!Object.isUndefined(v.__default)) {
                                        temp = this.filt;
                                        this.filt = Object.isFunction(v.__default) ? v.__default.bind(v) : v.__default;
                                        if (Object.isNumber(this.filt) || Object.isString(this.filt)) {
                                            var prot = Object.isNumber(this.filt) ? Number : String;
                                            for (var i in temp) {
                                                if (temp.hasOwnProperty(i) && !prot.prototype.hasOwnProperty(i)) {
                                                    var bin = {
                                                        t : temp,
                                                        m : i,
                                                        p : prot,

                                                    };
                                                    Object.defineProperty(prot.prototype, i, {
                                                        set : function(value) {
                                                            Object.defineProperty(this.p.prototype, this.m, {
                                                                configurable : true, // defaults to false
                                                                writable : false,
                                                                value : 1
                                                            });
                                                            delete this.p.prototype[this.m];
                                                            this.t[this.m] = value;
                                                        }.bind(bin),
                                                        get : function() {
                                                            Object.defineProperty(this.p.prototype, this.m, {
                                                                configurable : true, // defaults to false
                                                                writable : false,
                                                                value : 1
                                                            });
                                                            delete this.p.prototype[this.m];
                                                            return this.t[this.m];
                                                        }.bind(bin),
                                                        enumerable : true,
                                                        configurable : true
                                                    });
                                                }
                                            }
                                        } else {
                                            Object.extend(this.filt, temp);
                                        }
                                    }
                                    if (Object.isNumber(this.filt) || Object.isString(this.filt)) {
                                        var prot = Object.isNumber(this.filt) ? Number : String;
                                        for (var i in v) {
                                            if (v.hasOwnProperty(i) && !prot.prototype.hasOwnProperty(i)) {
                                                var bin = {
                                                    t : v,
                                                    m : i,
                                                    p : prot,

                                                };
                                                Object.defineProperty(prot.prototype, i, {
                                                    set : function(value) {
                                                        Object.defineProperty(this.p.prototype, this.m, {
                                                            configurable : true, // defaults to false
                                                            writable : false,
                                                            value : 1
                                                        });
                                                        delete this.p.prototype[this.m];
                                                        this.t[this.m] = value;
                                                    }.bind(bin),
                                                    get : function() {
                                                        Object.defineProperty(this.p.prototype, this.m, {
                                                            configurable : true, // defaults to false
                                                            writable : false,
                                                            value : 1
                                                        });
                                                        delete this.p.prototype[this.m];
                                                        return this.t[this.m];
                                                    }.bind(bin),
                                                    enumerable : true,
                                                    configurable : true
                                                });
                                            }
                                        }
                                    } else {
                                        Object.extend(this.filt, v);
                                    }
                                }
                            }, this);
                            return this.filt;
                        },
                        set : function(value) {
                            this.g.get(this.f).forEach(function(k) {
                                Object.extend(k, value);
                            });
                        }
                    }, {
                        t : this,
                        f : f,
                        g : graph,
                        filt : filters[n]
                    });
                }
            }
        }, true, true);
        addGS(this, '__all', {
            get : function() {
                var a = this.g.getById();
                Object.extend(__nodes, a.length === 1 ? a[0] : a);
                return __nodes;
            },
            enumerable : true
        }, {
            t : this,
            p : null,
            g : graph
        });
    };
    window['Ω'] = Ohm;
    return {
        OHM : Ohm,
    };
}()));

And now the demo:
var c = new Ω();
c.add('ann', {
__default : 58,
blah : 98,
ceva : function()
{
    console.log('asd');
}
});
c.add('ann2',{
    __default: function(){
       console.log('hello');
    },
    abc: 78,
    dce: function(){
       console.log(' world');
    }
};
c.add('b2', {
__new__ : function() {
    this.init = function() {
        this.id = 86;
    };
    this.mer = function() {
        console.log(this);
    };
},
els : 'asadar'
});
c.map('b2', function(k) {
return k.id === 'b2';
});
c.map('ann', function(k) {
return k.id === 'ann';
});
c.map('ann2', function(k) {
return k.id === 'ann2';
});
console.log(c.ann); // returns 58 ( the __default value )
console.log(c.ann.blah); // returns 98
console.log(c.ann.blah.blah); // undefined
console.log(c.ann2);  // function()
c.ann2(); // prints out 'hello'
c.ann2.cde(); // prints out 'world'
c.ann2 = 60;
console.log(c.ann2); // 60
console.log(c.ann2.cde()); // prints out 'world'

This code works, but the part where i have to use the Number or String prototype bothers me. Do you have another way of doing this?
The reason is to do something that someone said it could be done in PHP but not JS, this guy had recently been working with me on WebGL shaders and hated that he had to write 700 lines of code to use multiple effect combined with FBO instead of 100 which would took him with a similar tool like this one which was written in PHP. So yes i KNOW the accessors on primitive prototypes is a hack but how can i make it different without having to use valueOf if the chain end object is a primitive?

A: OK, now I've read the attached code (but could not follow all of it). Lacks some comments, but I won't bitch about that, my own codes are not better as I don't expect anybody to read or understand them :-)
You are right, the part where you extend the native prototypes is scary. From what I understand, you define an accessor property on the Number or String prototype before returning a number / string. Both on getting and setting, the accessor property is overwritten by a data property (???), then the whole property is deleted, before you store / return the value. This seems to be a clever hack to allow custom properties on primitive values, yet:

*

*There is a high risk of collisions. It might be possible to lower that by using the this value as a key in a lookup table (to differentiate (5).x from (3).x), but it still can't be fully avoided.

*Properties that remove themselves on accessing / setting are extremely unintuitive. Avoid that.

*arbitrarily changing accessor properties on the prototype of primitives are costly. That's 4 performance-contras combined. No engine will be able to optimize this. And you seem to use them quite often.

If you really needed this (I still didn't get your reason), I'd use a variant with a lookup-table. It should reduce collisions (not sure how your code handled them), does not change the accessor properties ones they're defined and is therefore more persistent (though it might leak then):
// Let's call this
// PRIMITIVE PROXIES
// as they proxy real objects behind primitive values
var proxy = _.map( { // some map that works on Objects
    string: String.prototype,
    number: Number.prototype
}, function closure(type, proto) {
    var table = {};
    function setupProperty(prop) {
        if (prop in proto) return; // ah, we already proxied this kind of object
        Object.defineProperty(proto, prop, {
            configurable:true, // for deleting
            get: function getter() {
                // "this" is the primitive value
                if (!this in table)
                    return undefined;
                return table[this][prop]; // get prop from obj
            },
            set: function setter(val) {
                if (this in table)
                    table[this][prop] = val; // pass val to obj
            }
        });
    }
    return {
        create: function createProxy(prim, obj) {
            if (prim in table) // we already did create a proxy on this primitive
                return; // let's abort. You might continue to overwrite
            table[prim] = obj;
            Object.getOwnPropertyNames(obj).forEach(setupProperty);
            return prim; // the new "proxy"
        },
        move: function moveName(from, to) {
            if (to in table) return false;
            table[to] = table[from];
            delete table[from];
            return true;
        }
    };
});
proxy.create = function(prim, obj) {
    return proxy[typeof prim].create(prim, obj);
};
proxy.move = function(from, to) {
    return proxy[typeof from].create(from, to);
};
// USAGE:
// proxy.create works just like Object.extend
> var c = {ann: 58},
>     o = {blah: 98};
> proxy.create(c.ann, o);
> 58..blah
98
> c.ann.blah
98
> (58).blah = 60;
> o
{blah: 60}
> var num = c.ann; // 58
> c.ann.blah = function(){return "Hello"};
> num.blah()
"Hello"
> proxy.move(c.ann, c.ann = 78);
> c.ann
78
> (58).blah
undefined
> c.ann.blah()
"Hello"
> // getters/setters for properties are global:
> c.ann.blub = "something"; // does not work, there is no getter
> c.ann.blub
undefined
> proxy.create(58, {blub: "foo"})
> c.ann.blub // still returns
undefined
> c.ann.blub = "bar"; // but can be set now
> (58).blub + (78).blub
"foobar"
> // infinite lookup loops are possible:
> proxy.create("loop", {x:"loop"});
> "loop" === "loop".x
true
> "loop".x.x.x.….x
"loop"

However, there is one thing you will never be able to work around:

Unlike objects, primitive values are not unique; they have no identity.

You will never be able to distinguish c.ann from 58, or "loop" from "loop".x, and so both will have a property or not. This is not a good premise to build an API upon.
So, I still recommend to use Number and String objects. You don't need to subclass them (as shown in my previous answer), as you don't seem to have (m)any methods on them, so you can easily build them:
c.ann = new Number(58);
c.ann.blah = 98;
return c;

There should be hardly a difference, expect for the typeof operator. Could you maybe add some more examples that use the __default value?

but how can I make it different without having to use valueOf if the chain end object is a primitive?

To answer this simple question: That guy was right, it cannot be done in JavaScript without hacking native prototypes. And you are right, the hack is quite ugly :-)

A: Don't make it a primitive number, make it an object that behaves like a number. You could use a Number object and extend that with your custom properties (see https://stackoverflow.com/a/9338486/1048572), but why not subclass Number in general? It only needs to preserve a valueOf method that returns the number:
function MyNumber(n) {
    this.value = Number(n);
}
MyNumber.prototype = Object.create(Number.prototype, {constructor:{value:MyNumber}});
MyNumber.prototype.valueOf = function() {
    return this.value;
};
// OK, we have to overwrite those methods as they don't work on subclasses of Number
["toExponential", "toFixed", "toLocaleString", "toPrecision", "toString"].forEach(function(name) {
    MyNumber.prototype[name] = function() {
        return Number.prototype[name].apply(new Number(this.value), arguments);
    };
});

// now extend the prototype with other properties, e.g. chaining methods

Of course, you might need to make components a setter that transforms a given number (or Number) into a MyNumber:
var actualNumber = new MyNumber;
Object.defineProperty(MyFabulousChainingThing, "components", {
    get: function() { return actualNumber; },
    set: function(x) { actualNumber.value = Number(x); }
});


text:
Q: sequelize findOrCreate with include association Using sequelize, I have two models with associations:
var Assessment = sequelize.define("Assessment", {
  name: DataTypes.STRING
});

var User = sequelize.define("User", {
  sid: DataTypes.STRING
});

Assessment.belongsTo(User);
User.hasMany(Assessment);

After some application logic, I have a User:
User.findOrCreate( { where: {sid: "123"} } ).spread(function (user, created) {
  // user is a User
});

At this point, I cannot get sequelize to associate the User as part of a Assessment.findOrCreate.  This code will create a new Assessment record in the database (if one does not exist), but it will not include the User key as part of the record (instead it's just NULL):
Assessment.findOrCreate( {
  where: { },
  include: [ { model: User, where: user.primaryKeyValues } ]
} ).spread( function (assessment, created) {
  // ...
});

I have a workaround working by adding:
assessment.setUser(user).then( function(assessment) {
   ...
});

...however, this results in a SQL UPDATE that should just be part of creating the record.  I'm fairly certain there should be way to do this, but unable to find anything in the docs/so/etc.

A: Try this: You'd need to set the User primary key reference into the created assessment.
Assessment.findOrCreate( {
  where: { UserId: user.id },
  include: [ User ]
} ).spread( function (assessment, created) {
  // assessment should contain a User property with the previously found / created user
});


text:
Q: jasmine unit testing failing Here is the function I am testing:
Utilities.js
    exports.calculateAgeTimeStamp = function(timestamp) {

        //get year

        var userYear = new Date(timestamp * 1000);
        min = userYear.getFullYear();

        //get current year
        var curYear = new Date();
        max = curYear.getFullYear();

        //work out age from current year
        return Math.abs(max - min);
    };

It takes a timestamp and calculates age.
Here is my spec:
    //test to see if timestamp converts to age.
it("timestamp should be converted to age > 20503539200", function() {
    //matcher
    expect(utilities.calculateAgeTimeStamp("20503539200")).toBeNumber();
});

Here is the error:
 [INFO] :   .   - timestamp should be converted to age > 20503539200 (FAILED)
    [INFO] :   .   - - TypeError: 'undefined' is not a function (evaluating 'expect(utilities.calculateAgeTimeStamp("20503539200")).toBeNumber()') in file:///Users/iPhone%20Simulator/7.1-64/Applications/F0A42483-4497-4670-AFEE-839D81C2E075/specs/lib/utilities_spec.js (line 12)
    [INFO] :   .  ============================================================
    [ERROR] :  .  THERE WERE FAILURES!
    [ERROR] :  .  ============================================================
    [ERROR] :  .  Recap of failing specs:
    [ERROR] :  .  ------------------------------------------------------------
    [ERROR] :  .  utilities timestamp should be converted to age > 20503539200. - TypeError: 'undefined' is not a function (evaluating 'expect(utilities.calculateAgeTimeStamp("20503539200")).toBeNumber()')

I know this function works, because it is working fine in my app. Any idea why I am getting this error, cheers.


text:
Q: Defining seperate iteration (sprint) sets for teams within a project So after setting up my teams, I need to define separate sprints for each.  I notice that when I go under project settings > work > iterations, I see the default set defined for a new project.  The name that these default iterations fall under is the same name as the project.  So that leads me to ask
- Is the name Im looking at for a new project that has these default iterations, the name of the project or the default team?
In other words, Im looking at setting up my team/iteration structure like this, is there a better or best-practice approach (when using multiple teams within a single team project) ?
Below, I defined new children of the root node (again, is that the project name or default team with the same name?)
root-name-here
 |__Team1
    |__Sprint1
    |__Sprint2
    |__Sprint3
    |__Sprint4
    |__Sprint5
    |__Sprint6
 |__Team2
    |__Sprint1
    |__Sprint2
    |__Sprint3
    |__Sprint4
    |__Sprint5
    |__Sprint6
|__Sprint1
|__Sprint2
|__Sprint3
|__Sprint4
|__Sprint5
|__Sprint6

The "default" set of iterations that are now at the same level, can I simply remove them?

A: You can config different iterations based on different teams. Detail as below:
PS: I share the steps with New Navigation, if you want to turn on the New Navigation, set as below:
Click profile -> Preview features -> then turn on the New Navigation).
1.   Add iterations with the structure you need
In Project settings -> Project configurations -> Iterations Tab -> Add iterations as below (as you listed):

2.   Specify different iterations for different teams
In Project settings -> Team configurations -> select different iterations for different teams. Besides, you can also set default iteration and backlog iteration for different teams.
Such as:

*

*Select Git2\Sprint 1~6 to Git2 Team:

*Select Git2\team 1\Sprint 1~6 to teamA:

*Select Git2\team 2\Sprint 1~6 to second team:

Now when open backlogs for different teams, only the specified iterations are listed.

A: You can define the overall iterations for the project at the project level.
At the team level, you set the team's backlog iteration and what sprints belong to that team.
If the project level iteration is just for rolling up the progress of the individual teams, then yes, you can remove the project level iterations.


text:
Q: i want to convert dataframe into specific formated dataframe or list of lists this is the Dataframe
Year    Category    Performance
2014    Sales           1000
2014    Expenses        400
2014    Profit          200
2015    Sales           1170
2015    Expenses        460
2015    Profit          250
2016    Sales           660
2016    Expenses        1120
2016    Profit          300

And this is the expected output
 [
          ['Year', 'Sales', 'Expenses', 'Profit'],
          ['2014', 1000, 400, 200],
          ['2015', 1170, 460, 250],
          ['2016', 660, 1120, 300],
        ]

or if you could help me to convert this dataframe into this
Year Sales Expenses Profit
2014 1000  400       200
2015 1170  460       250
2016 660   1120      300

A: df = pd.pivot_table(df, index='Year', columns='Category', values='Performence').reset_index()


text:
Q: How can I convert float to integer in Java I need to convert a float number into an integer.
Can Java automatically convert float number into integers? If so, do normal rounding rules apply (e.g. 3.4 gets converted to 3, but 3.6 gets converted to 4)?

A: You have in Math library function round(float a) it's round the float to the nearest whole number.
int val = Math.round(3.6); \\ val = 4
int val2 = Math.round(3.4); \\ val2 = 3

A: It is a bit dirty but it works:
double a=3.6;
int b = (int) (a + 0.5);

See the result here

A: Math.round(3.6) would do that for you.


text: Q: Audiokit header file not found I started a new project and installed audiokit cocoa pods. I created a new h file. when I try to #import "AKAudioUnit.h" (or any other Audiokit h file) I get a "file not found" error.


text:
Q: Azure ARM template using utcNow not working properly Have tried to create an Azure ARM Template with a parameter that should have a datetime default value.
This is how I am using it:
"endTime": {
  "type": "string",
  "defaultValue": "[dateTimeAdd(utcNow('u'), 'PT1H', 'yyyy-MM-dd THH:mm:ss zzzz')]",
  "metadata": {
    "description": "The finishing date of the Lab. Ex: 2019-09-23T09:00:00"
  }
}

The parameter when its executed appears like text:
[dateTimeAdd(utcNow('u'), 'PT1H', 'yyyy-MM-dd THH:mm:ss zzzz')]

Anyone knows what the issue might be? I am executing the ARM template on Dev/Test Labs.

A: Basically the function is not evaluated when the parameters are requested for input... it's only evaluated once you deploy the template.
I wanted the function to set the default value with the evaluated value instead of the expression.


text:
Q: Send a file to a sever periodically with AlarmManager I want my app send a log file, to a server. I wrote a code, which gathers all info from Log. Then I want to send it at 22.00 PM to a server.
I can upload the file but pressing a button. But I want it do do by some deamon(AlarmManager)
How should I do that? What if there is no internet connection at this specific time? Is there any examples of such implementation?
And where I should create my alarm? While I create it in onCreate method it will create new alram every time onCreate method is called. I want it to be called only once
Thanks.

A: Use example from here:
https://github.com/commonsguy/cwac-wakeful
it is using AlarmManager which triggers broadcast that starts IntentService which exeuctes with wakelock. So it will work also in background. To check if internet connection is present, use below code :
   NetworkInfo networkInfo = getConnectivityManager().getActiveNetworkInfo();
    if (networkInfo != null) {
      return networkInfo.getState() == NetworkInfo.State.CONNECTED;
    }

inside your IntentService.


text:
Q: How do I map (local) to a non-standard named SQL Server? I installed SQL Server 2008 (SQL Server 2005 was already installed) on my XP box and name the local instance of the database so that it wouldn't clash with SQL Server 2005.
Now I want to change the mapping of (local) from SQL Server 2005 to my non-standard named SQL Server 2008 instance. Anybody know how to do this?

A: nope. you'll have to reinstall both.

A: I'm afraid Mladen is correct.

*

*You can move the db's from one
instance to another using
attach/detach or backup/restore.

*You can transfer all logins (if
needed) with this method.

*You can move SQL Agent scripts by
right-clicking on them on the existing server and selecting
generate script then running that
script on the new server.

.
You will have to do the following (Assuming you'd like to make 2008 your default instance):

*

*Install 2005 named instance.

*Move the default to the named using above method.

*Uninstall 2005 default instance.

*Install 2008 default instance.

*Move the named to the default using above method.

*Uninstall 2008 named instance.

Good luck!

A: Create an alias in the sql config manager.  Enable named pipes for your instance with surface area config and you will be in business.


text:
Q: Android Audio m3u8 Streaming - HOW TO As the title, how can I stream an m3u8 audio on Android without vitamio? (on Android 2.3+). I've seen that some app can stream my my link http://4metest1-view.4me.it/api/xpublisher/resources/weebopublisher/getContentDescriptor.m3u8?clientId=4metest1&contentId=b55f7d74-cd81-48ce-9390-d9ffd5c49281&channelType=STREAMHTTPIOS&v=4
like VLC or aqua Player, but i cannot setup mMediaPlayer to reproduce it.

A: Use a VideoView to play your audio with relaxing music :)
myVideoView = (VideoView)this.findViewById(R.id.myVideoView);
            MediaController mc = new MediaController(this);
            myVideoView.setMediaController(mc);
            urlStream = "http://4metest1-view.4me.it/api/xpublisher/resources/weebopublisher/getContentDescriptor.m3u8?clientId=4metest1&contentId=b55f7d74-cd81-48ce-9390-d9ffd5c49281&channelType=STREAMHTTPIOS&v=4";
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    myVideoView.setVideoURI(Uri.parse(urlStream));
                }
            });

A: Your m3u8 is not a true HLS file. It is just a playlist pointer to a single MP3
http://4metest1-4me.weebo.it/ios/Dance_of_the_Yao_People_3_JIDMQ7.mp3

You can either use media player to stream from the source directly or parse the file m3u8 file in your code to pull out the idividual URL's
url url = new URL(" http://4metest1-view.4me.it/api/xpublisher/resources/weebopublisher/getContentDescriptor.m3u8?clientId=4metest1&contentId=b55f7d74-cd81-48ce-9390-d9ffd5c49281&channelType=STREAMHTTPIOS&v=4");

InputStream m3u8 = (InputStream) url.getContent();
BufferedReader br = new BufferedReader(new InputStreamReader(M3U8));
for(int i = 0; i < 2; ++i)
{
    br.readLine();
}|
readLine(); //this parses the third line of the playlist
br.close();
url = new URL(baseURL.concat(target));


text:
Q: У меня везде(сколько не исправляла) идет ошибка segmentation fault. Почему? #include <stdio.h>

#include <string.h>

void    *ft_memset(void *dest, int c, size_t n)
{
    char *str;

    str = (char*)dest;

    if (!str)
        return(NULL);
    while ((n-1) > 0)
    {
        *str = (char)(c);
        str++;
        n--;
    }
    *str = '\0';
    return(dest);
}

int main(void)
{
    char *dest = "uj";

    printf("%s", (char*)(ft_memset(dest, 4, 6)));
}

A: char * dest = "uj"; - указатель на строку, которая храниться в программе, и которую менять нельзя.
char dest[] = "uj"; - это уже будет новая строка в стеке, которую можно менять.


text:
Q: T4 GPU slows down automatically after sometime with power usage limited I had been using T4 GPU with 8 virtual CPUs and 30 GB RAM Virtual Machine for more than a month without any issues.
I have been running some deep learning training jobs on it.
But since yesterday, I have been trying some new models on a larger dataset and I noticed that in the beginning the training runs fast (like it always normally did).
But after one or two epochs, the GPU slows down considerably, taking five times more time per step!!!
On checking GPU usage with nvidia-smi, I noticed that initially the power usage fluctuates around 70 W (which is the limit) but then when GPU slows down, the power usage is also fluctuating around only 49 W.
It seems that the VM automatically throttles the GPU performance due to overheating/high power usage? I would like to know if I am doing something wrong that's getting me in to this situation. I couldn't find anything in the documentation on the subject.
Thanks


text:
Q: Difference between Xamarin.Forms and Xamarin Cross Platform I've been 2 years with Xamarin Environment and mostly I used Xamarin.Forms. But yet, I have no idea what Xamarin Cross Platform is? Can anyone provide some structural differences?

A: Xamarin has two ways of building mobile applications, Xamarin.Forms and Xamarin.Native.
Both ways let you write code cross platform.
Cross platform is just a concept. It means the code you write once can run in multiple platforms. Xamarin is cross platform (mainly Xamarin.Forms) because it allows you to write code that runs on multiple (across) platforms.

A: When we talk about Xamarin there are two approaches in development of native apps:

*

*Traditional Xamarin approach

*Xamarin.Forms

There is a good quote from Xamarin web site

Share code everywhere. Use the same language, APIs and data structures
to share an average of 75% of app code across all mobile development
platforms. Build user interfaces with Xamarin.Forms and share nearly
100%.

Important note is that these numbers can vary from project to project so this is some assumption for general usage of Xamarin.
And as you can see from the image below about "differences" between these two approaches. Traditional Xamarin approach (Xamarin.iOS and Xamarin.Android) they're both built on top of Mono, an open-source version of the .NET Framework. To develop those apps you use C# and there is an opportunity to share up to 75% of the codebase as you can see on the image bellow and from a quote from Xamarin.

Using Xamarin Traditional approach you can use a C# as a programming language to write your models, call web services, etc. So you are writing that code logic once and using/share it across the Xamarin.Android and Xamarin.iOS projects, and in those separate projects you are writing code that is specific for that platform and you have access to their APIs.
Also, there is a quote from Xamarin about the traditional approach:

Anything you can do in Objective-C, Swift, or Java can be done in C#
with Xamarin using Visual Studio.

And project structure with Xamarin traditional looks like this:

*

*Shared code project: Codebase that is common and reusable for your other projects.

*Xamarin.Android: Project for your Android app where you are writing code using Android-specific APIs, writing your UI code, etc.

*Xamarin.iOS: Project for your iOS app where you are writing code
using iOS specific APIs, writing your UI code, etc.

More info about Xamarin traditional here.
Now about Xamarin.Forms, the best definition is quoted from the Xamarin website:

Xamarin.Forms is a framework that allows developers to rapidly create
cross-platform user interfaces. It provides it's own abstraction for
the user interface that will be rendered using native controls on iOS,
Android, Windows, or Windows Phone. This means that applications can
share a large portion of their user interface code and still retain
the native look and feel of the target platform.

As you can conclude from the text above, Xamarin.Forms is a framework that allows you to write your UI using C# or with XAML with the opportunity to use MVVM... With Xamarin.Forms you can write your codebase and your UI which will be shared across the platforms.

Note: this is a very simple project structure, of course, you can add more project for different layers

*

*Shared code project: Holds your common code base and also because you are using Xamarin.Forms you can write code for your UI

*Xamarin.iOS and Xamarin.Android: Code for that specific platform, and some advanced topics such as Custom renderers and Dependency services.

Of course, there is some of the limitations if you are using Xamarin.Forms for example out of the box you can only use UI controls that are common across all platforms. You can read my blog post about Xamarin.Forms pros and cons here.
More info about Xamarin.Forms here.
I hope that this answer is not confusing for you and as a conclusion in one or two sentences... Using Xamarin Traditional you can share your code logic between platform-specific projects, and using Xamarin.Forms you can share code logic and also code for UI across your projects.
Note: For shared project and code sharing strategy you can use "Shared Project" and "PCL" this is a topic for another question... so in this answer, I was simplifying this and use shared project term for that type of project in Xamarin app solution.
UPDATE, Summer of 2020:
.NET Maui is announced in May of 2020, the question about the difference between MAUI and Xamarin.Forms could be found in the StackOverflow thread here: What is MAUI? and what are differences between MAUI and Xamarin

A: If you're talking about the Xamarin.iOS and Xamarin.Android (Xamarin Native), I'd say the main difference is that in Xamarin Forms, you share NOT ONLY the business logic, but also the UI. In Xamarin forms, you'll use basic components on all platforms (Button, Label, etc). That's the reason why it's called Xamarin.Forms, because it's suitable for basic forms.
But for Xamarin Native, you'll create a UI per platform (One for iOS, one for Android). You can do much more with Xamarin Native, because you'll use native components.
Hope it helps!

A: I think Xamarin Cross Platform refers to the technology that compiles shared code (your PCL or Shared Project) such that it can be used by the different platforms such as Xamarin.Android or Xamarin.IOS before finally being compiled to the native platforms.
So I'd say in a way Xamarin.Forms is one of the tools you use to build cross platform compatible code that can then be put together using the Xamarin Cross Platform Technology, makes sense?


text:
Q: How can I get a String from a PersistObjectId in yesod? From a higher level what I am trying to do is make a post via javascript that includes the ID to an object.
I am passing the 'PlayerId' to a widget that will create the jquery that will post.
  tableClickHandlerWidget :: String -> TableId -> PlayerId -> Maybe Int ->  Widget
  tableClickHandlerWidget elemId tid playerId seatId = do
    let seatNumber = if seatId == Nothing
                      then "null"
                      else show  $ fromJust seatId
    let pid = fromPersistToJS $ unKey playerId
    toWidget[julius|
        $(function() {
          $('#{show elemId}').click.post(
            '@{GamingSessionsR}',
            { player: '#{pid}', table: '#{show tid}', seat:'#{seatNumber}' },
            );
        });
        |]
    toWidget[hamlet|something<br/>|]

  fromPersistToJS :: PersistValue -> String
  fromPersistToJS p = do
   let (a) = fromPersistValue p
   case a of
      Left  l -> T.unpack l
      Right  r -> r

What i am getting back from fromPersistToJS is always an exception that object id cannot be made into a string.
But the URLs are essentially strings and have IDs inside them; so I am sure this must bepossible.
https://github.com/gdoteof/exodus/ is the whole repo and I am making this post at
https://github.com/gdoteof/exodus/commit/4daa0a25a9f44c69cbdc5c0bb4e8aa4f6433de45

A: the answer was very easy.
let playerIdAsText = toPathPiece playerId


text:
Q: OOP - instance of a class is created, a different class should be created , an array stores every new instance created I am having trouble understanding the following instructions in an exercise:

*

*Create another class Location which has two properties called coordinate and name.

*Each time an instance of Location is created,
a class Coordinate should be created that gets passed in the coordinates that should be given as arguments when creating Location.

*Further, you should create a return_location method that returns the name of the location.

*An array locations which is a class variable of Location stores every Location that is created.
So far I have this:
class Coordinate:
    def __init__(self,latitude,longitude):
        self.latitude = latitude
        self.longitude = longitude
    def return_coord(self):
        return self.latitude, self.longitude

class Location:
  locations = [0]

  def __init__(self,coordinate,name):
    self.coordinate = coordinate
    self.name = name
    locations.append(self) #store every location created on the array locations

  def return_location():
    return self.name

But I am not sure if I am indeed doing the second step correctly
and when trying to do the 4th step it shows me the error: NameError: Name ´locations´ is not defined, did you mean Location?

A: For the error you're receiving, you should be using Location.locations.append(self) rather than locations.append(self)

A: My understanding of step 2 is that Location.__init__() should receive latitude and longitude as separate arguments, and you need to create a Location instance from them.
There's no need to put 0 in the initial locations list. It should start out empty, and you append to it when you create new Location instances.
class Location:

  locations = []

  def __init__(self,lat, long,name):
    self.coordinate = Coordinate(lat, long)
    self.name = name
    locations.append(self) #store every location created on the array locations

  def return_location():
    return self.name

A: My understanding is this. Corrections include: locations = [0] replaced with locations = [], locations.append(self) replaced with Location.locations.append(self)
class Coordinate:
    def __init__(self,latitude,longitude):
        self.latitude = latitude
        self.longitude = longitude
    def return_coord(self):
        return self.latitude, self.longitude

class Location:
  locations = []

  def __init__(self,coordinate,name):
    self.coordinate = coordinate
    self.name = name
    Location.locations.append(self) #store every location created on the array locations

  def return_location(self):
    return self.name

l1 = Location(Coordinate(40.70, -74.04), 'NY')
l2 = Location(Coordinate(-22.90, -43.19), 'Rio')

for location in Location.locations:
  print(location.coordinate.return_coord(), location.return_location())

Hope this helps.


text:
Q: Pandas error when I try to do an Anova test so I have an excel sheet that I'm trying to do an ANOVA test on through pandas. It worked with several other spreadsheets, but with this one, using the exact same code, I get an error. Here's the code:
import pandas as pd
import statsmodels.api as sm
from statsmodels.formula.api import ols
import pingouin as pg
df = pd.read_excel('anovacogret.xlsx')
aov = pg.anova(data=df, dv='Cognitive Reattribution', between='Type', detailed=True)
aov

and the error I get:
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File /opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py:3621, in Index.get_loc(self, key, method, tolerance)
   3620 try:
-> 3621     return self._engine.get_loc(casted_key)
   3622 except KeyError as err:

File /opt/anaconda3/lib/python3.9/site-packages/pandas/_libs/index.pyx:136, in pandas._libs.index.IndexEngine.get_loc()

File /opt/anaconda3/lib/python3.9/site-packages/pandas/_libs/index.pyx:163, in pandas._libs.index.IndexEngine.get_loc()

File pandas/_libs/hashtable_class_helper.pxi:5198, in pandas._libs.hashtable.PyObjectHashTable.get_item()

File pandas/_libs/hashtable_class_helper.pxi:5206, in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'Cognitive Reattribution'

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
Input In [1], in <cell line: 6>()
      4 import pingouin as pg
      5 df = pd.read_excel('anovacogret.xlsx')
----> 6 aov = pg.anova(data=df, dv='Cognitive Reattribution', between='Type', detailed=True)
      7 aov

File /opt/anaconda3/lib/python3.9/site-packages/pingouin/parametric.py:926, in anova(data, dv, between, ss_type, detailed, effsize)
    923         return anovan(dv=dv, between=between, data=data, ss_type=ss_type, effsize=effsize)
    925 # Check data
--> 926 _check_dataframe(dv=dv, between=between, data=data, effects='between')
    928 # Drop missing values
    929 data = data[[dv, between]].dropna()

File /opt/anaconda3/lib/python3.9/site-packages/pingouin/utils.py:330, in _check_dataframe(data, dv, between, within, subject, effects)
    328     raise ValueError('DV and data must be specified')
    329 # Check that dv is a numeric variable
--> 330 if data[dv].dtype.kind not in 'fi':
    331     raise ValueError('DV must be numeric.')
    332 # Check that effects is provided

File /opt/anaconda3/lib/python3.9/site-packages/pandas/core/frame.py:3505, in DataFrame.__getitem__(self, key)
   3503 if self.columns.nlevels > 1:
   3504     return self._getitem_multilevel(key)
-> 3505 indexer = self.columns.get_loc(key)
   3506 if is_integer(indexer):
   3507     indexer = [indexer]

File /opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py:3623, in Index.get_loc(self, key, method, tolerance)
   3621     return self._engine.get_loc(casted_key)
   3622 except KeyError as err:
-> 3623     raise KeyError(key) from err
   3624 except TypeError:
   3625     # If we have a listlike key, _check_indexing_error will raise
   3626     #  InvalidIndexError. Otherwise we fall through and re-raise
   3627     #  the TypeError.
   3628     self._check_indexing_error(key)

KeyError: 'Cognitive Reattribution'

Can anyone help me figure this out? Thank you.


text:
Q: Error in computing outliers I'm trying to compute multivariate outliers with the mahalanobis distance in R, but I get a warning message when I try to plot my results.
Illustrated here,
# install.packages(c("mlbench"), dependencies = TRUE)
library(mlbench)
data(Glass)

mydata.numeric.scaled<-scale(Glass[,-10],center=T)
# install.packages(c("mvoutlier"), dependencies = TRUE)
library(mvoutlier)
alpha.value = 0.05
alpha.value.penalizado = 1 - ( 1 - alpha.value) ^ (1/nrow(mydata.numeric.scaled))
uni.plot(mydata.numeric.scaled,symb=FALSE, alpha = alpha.value.penalizado)

However, instead of a plot I get this error/warning:

Error in plot.window(...) :'ylim' needs finite values
In addition: Warning message:
  In covMcd(x, alpha = quan) :
    The 112-th order statistic of the absolute deviation of variable 8 is zero.
  There are 176 observations (in the entire dataset of 214 obs.) lying on the
  hyperplane with equation a_1*(x_i1 - m_1) + ... + a_p*(x_ip - m_p) = 0 with (m_1,
  ..., m_p) the mean of these observations and coefficients a_i from the vector a
  <- c(0, 0, 0, 0, 0, 0, 0, 1, 0)

What does it mean?

A: The error is on the amount of data that uses to calculate the covMcd. This can be solved by taking the entire dataset setting quan=1. By default quan=1/2 taking a half piece of the dataset.


text:
Q: responsive navbar isnt showing all options when resized I'm in need of some web dev help.
i've created a responsive navbar and it works pretty well except on 2 occasions. I'll only mention the first problem for now though.
so the problem is i have 4 options in my navbar (might need to add another one later), and it shows normally when the browser is over 62 em but once under it turns into a drop down menu. It works... although it only shows 3 of the four options and i have no idea what m doing wrong. i've listed the code below for you guys to have a look at.
thank you :)

.header {
  background-color: #1B1B1B;
  box-shadow: 1px 1px 4px 0 rgba(0,0,0,.1);
  position: fixed;
  width: 100%;
  z-index: 3;
 top:0;
}
.header ul {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  background-color: #1B1B1B;
}

.header li a {
  display: block;
  padding: 20px 20px;
  border-right: 1px solid #1B1B1B;
  text-decoration: none;
}

.header li a:hover,
.header .menu-btn:hover {
  background-color: #1B1B1B;
}

.header .logo {
    display: block;
    float: left;
    font-size: 1.5em;
    padding: 10px 20px;
    text-decoration: none;
}

/* navbar */

.header .menu {
  clear: both;
  max-height: 0;
  transition: max-height .2s ease-out;
}

/* menu icon */

.header .menu-icon {
  cursor: pointer;
  float: right;
  padding: 28px 20px;
  position: relative;
  user-select: none;
}

.header .menu-icon .nav-icon {
  background: #333;
  display: block;
  height: 2px;
  position: relative;
  transition: background .2s ease-out;
  width: 18px;
}

.header .menu-icon .nav-icon:before,
.header .menu-icon .nav-icon:after {
  background: #333;
  content: '';
  display: block;
  height: 100%;
  position: absolute;
  transition: all .2s ease-out;
  width: 100%;
}

.header .menu-icon .nav-icon:before {
  top: 0;
}

.header .menu-icon .nav-icon:after {
  top: 0;
}

/* menu button */

.header .menu-btn {
  display: none;
}

.header .menu-btn:checked ~ .menu {
  max-height: 240px;
}

.header .menu-btn:checked ~ .menu-icon .nav-icon {
  background: transparent;
}

.header .menu-btn:checked ~ .menu-icon .nav-icon:before {
  transform: rotate(-45deg);
  top:0;
}

.header .menu-btn:checked ~ .menu-icon .nav-icon:after {
  transform: rotate(45deg);
  top:0;
}

/* media query for navbar */

@media (min-width: 62em) {
  .header li {
    float: left;
  }
  .header li a {
    padding: 20px 60px;
  }
  .header .menu {
    clear: none;
    float: right;
    max-height: none;
  }
  .header .menu-icon {
    display: none;
  }
}

            Introspect
            <input class="menu-btn" type="checkbox" id="menu-btn" />

HOME

PLANS

ABOUT

ENQUIRE

EDIT:
https://codepen.io/exoticpenguins/pen/PoqvgyJ
ive uploaded my page to codepen. check it out there :)

A: Your max-height is causing the last element to be clipped. Increasing that will show it.
.header .menu-btn:checked ~ .menu {
  max-height: 240px;
}

Try using your browser developer tools to inspect the elements, it's a good way to see this.


text:
Q: StackExchange.Redis Send Structs I am new to redis and I wonder how to send a class or a struct with StackExchange.Redis.
So lets assume I want to write
    var redis = ConnectionMultiplexer.Connect("localhost");
    var db = redis.GetDatabase();
    db.StringSet(key, value);

This is actually only possible if my value is primitive. So is there any other way to achieve sending complex types without serializing them as json?

A: Since Redis is not aware of your class or struct, you'll need to define how to store it. A recommended way is to store the object as a hash, where the key is the property name, and the value is the property value. Note that this does not support object graphs, e.g. nested collections or complex types.
As per the documentation on data types:

A hash with a few fields (where few means up to one hundred or so) is stored in a way that takes very little space, so you can store millions of objects in a small Redis instance.

Alternatively, you could serialize the object yourself and store it as a string/byte[]. Json is one format, which includes the property names in the data, which is great for versioning. E.g. if a new property is added, you wouldn't need to go and change all existing data. The downside is that it takes up a lot of space. You could use any other form of serialization as well, e.g. binary serialization.


text:
Q: Power Automate - Want to confirm whether "Recognize text in an image or a PDF document" connection is a premium connection I am finding a solution to recognize text from image in Power Automate. I found there is a "Recognize text in an image or a PDF document" connection and it works fine to extract text from an image but shortly the flow became premium version. And one of the used connection in the flow is "Microsoft Dataverse" which is stated premium.
I would like to know is it become a paid version in this case? Is there any built in solution which is free to use?


text:
Q: Jenkins builds existing jobs of repo when a new branch is pushed to repo I have a GitHub repository xxx with master, qa, and dev branches (among others).
I have corresponding Jenkins jobs that build when a commit is pushed to qa or dev.
If I create a new branch, i.e. feature/new (and merge dev into it), then push my feature/new branch to the repository, my existing Jenkins jobs for qa and dev (of this repository) are triggered for building.
Is there a way to prevent this?
I have no Jenkins job configured for the feature/new branch.
dev and qa of this repo are only supposed to build on pushes to dev or qa - "GitHub hook trigger for GITScm polling" is selected in these jobs. It normally works just fine, I am wondering why these jobs trigger on a new (unrelated?) branch push?
Here's what I see on the Jenkins build info page:
Success Build #71 (Aug 25, 2022 12:09:38 PM)
add description
    No changes.

* Started by GitHub push by special-monkey
    Revision:

    refs/remotes/origin/dev

*

Started on Aug 25, 2022 12:09:29 PM
Started by event from 140.82.115.111 ⇒ https://jenkins/github-webhook/ on Thu Aug 25 12:09:29 EDT 2022
Using strategy: Default
[poll] Last Built Revision: Revision 2b2902bfb82eb6f2bc55601c1151548e05c4feb4 (refs/remotes/origin/migration)
using credential Secret
 > git --version # timeout=10
using GIT_SSH to set credentials Secret
 > git ls-remote -h git@github.com:Org/xxx.git # timeout=10
Found 133 remote heads on git@github.com:Org/xxx.git
[poll] Latest remote head revision on refs/heads/dev is: 7a53bbdd2e4ae7670f6c439131bedc93eb07efe4
Done. Took 0.36 sec
Changes found

A: you need to verify the configurations of the Jenkins job to be sure if it's polling only for dev/qa branches or for all branches.


text:
Q: What is the SE version of Seven Dirty Words? Caution: R-rated language
Some words, when present in a comment, make it eligible for instant, automatic one-flag deletion. Out of the seven words you can never say on television, only

 shit and fuck

appear to work this way. But then there are other, Stack Exchange-specific dirty phrases:

*

*accept rate or accept-rate

*acceptance rate

*what have you tried

*whore
Are there other such words or phrases? Is there a complete list of them?

Some suspect words and phrases that do not suffice for automatic deletion:

 accept an/the answer, thank you, voting to close, piss, bitch, idiot, cunt (often found on Stack Overflow as a misspelling of "count").

A: This comment auto-deleted upon raising a "No longer needed" flag against it:

I have summarized our findings in an answer, which you can accept if you think it solves your initial question.

So I would suggest that accept (on its own) is also a dirty word.
Indeed, this comment on an answer to Are comments which respond to another comment deleted by single flag? would seem to back this theory up.

A: I initially read the OP as asking for what comments a moderator will delete right away when the first flag on it appears.  However, I misread the question, for he is actually asking about the specific magic words that are sometimes alluded to and which make one comment more easily flag-deleted than the next one.
I provided a list, but did not probe them for instaburnination™ because I did not realize that that was what was being requested.  Nonetheless, I appear to have accidentally gotten at least one right, the one about "What have you tried?" Flagging a comment containing "accept rate" or "accept-rate" also causes instant deletion on SO.
Pity that daily flag limits render dictionary-discovery methods infeasible for this sort of detection.  Back to the flagboard with me.
Original post follows
Presuming that you are talking about actual use, not mere mention, that still leaves the barn doors pretty wide open. Here I list only documented candidates:

*+1/–1 comments.

*Duplicated comments.

*

*Thank-you comments.

*Lemme-Goober-That-For-Yaz links, especially but not uniquely when hidden behind obfuscatory link-shortening.

*What have you tried? is getting old.

*Voting to close.

*Linking to Zalgo.


text:
Q: How to create "individual" objects my task is actually pretty simple. Maybe I'm too much used to c++ to not see my fault.
I have two classes and a list.
The list should include all objects made of class1, while class1 also includes a list for all objects of class2.
So we have:
All_Objects1 = []     # For class1 objects

class class1 (object):
    All_Objects2 = []  # For class2 objects

class class2 (object):
    name = ""
    number = 0

Now I do this:
# class1 objects:
obj1= class1()
obj2= class1()

# class2 objects
obj3 = class2()
obj3.name, obj3.number = "hello world", 10
obj4 = class2()
obj4.name, obj3.number = "hello europe", 20
obj5 = class2()
obj5.name, obj3.number = "hello asia", 30
obj6 = class2()
obj6.name, obj3.number = "hello africa", 40

# Attach object3 and object4 to object1
obj1.All_Objects2.append(obj3)
obj1.All_Objects2.append(obj4)

# Attach object5 and object6 to object2
obj2.All_Objects2.append(obj5)
obj2.All_Objects2.append(obj6)

# Attach obj1 and obj2 to the global list.
All_Objects1.append(obj1)
All_Objects1.append(obj2)

And finally I do a print for checking if everything is where it belongs:
print (len(All_Objects1[0].All_Objects2)) # Should be 2.
for i in All_Objects1[0].All_Objects2:
    print (i.name)                        # Should be world and europe.

print (len(All_Objects1[1].All_Objects2))     # Should be 2.
for i in All_Objects1[1].All_Objects2:        # Should be asia, africa.
    print (i.name)

Now the problem is, that every object2 is in every object1 and I have no clue why.
In my actual program I do something like this, what would actually work in c++:
#pseudo
for i in all_information:
    if (i==Keyword):
        currentObject = class1()
        All_objects.append(currentObject)

And then I will have some independent objects in my list. But in Python I think I somehow can't overwrite "currentObject".
Thank you so much for your help.

A: In Python somethings could be making this error,  first which version×of Python are you using?
I have not tested on my console yet but I would guess that it's a initialization issue,  for how you are declaring the list, I would rather suggest to use a more Pythonic approach, I mean,  build a constructor and use keyword self for instance variables, if this works,  I can extend my answer explaining why this happened.
Create a method like this in class 1 and class 2:
def __init__(self, object_list=None) : # use corresponding classes attributes.
    if self.name_of_your_variable:
           self.name_of_your_variable= [] # or proper value

Adapt this to your classes and let me know, if it works,  as soon I get home I'll extend it

A: With Python, all class members declared outside any function are static members. So they are shared by each object instantiated from the class.
What you want is the following:
class class1 (object):
    def __init__(self):
        self.All_Objects2 = []  # For class2 objects

class class2 (object):
  def __init__(self):
        self.name = ""
        self.number = 0

A: You need just to initialized your class. init and you need only one All objects list. An example with class you can find below.
class firstA():
    def __init__(self):
        self.All_Objects = []

class secondB():
    def __init__(self):
        self.name ="None"
        self.number = 0

When you are calling the class the initialization will be done :-) That is very nice in python2/3.
Whatever you initialized outside the class will be considered as a static variable! So in your example the All_Objects1 list for instance.
Hope this clarify your doubts! Have a nice day.


text:
Q: I want to achieve the styling as done on this website to the header and nav I'm trying to get the styling of the navigation bar of this site. Can anyone explain how to do this?
I want to be able to reduce the size of the navigation on scroll and put the image behind the header as in the website.
Can anyone help me on this issue?
Your help is much appreciated.


text:
Q: How to distinguish negative number from subtraction? I want to create a very simple math calculator which could give me results of simple equations, like 5*(5-9).
In the first step I split the equation into meaningful tokens, eg.:
5
*
(
5
-
9
)

Now how can I (algorithmically) tell the difference between a negative number (eg. -5) and subtraction (x - 5)?
Edit: I won't have variables (like x) in my equations but I can have functions (like sin, abs).

A: At a high level, if the previous token is something that can be subtracted from then it will be subtraction, otherwise it is negation.

A: I think you could do something like this:
<?php
function splitEq($a) {
    $split = array();

    // count al the minuses:
    $c = substr_count($a, "-");

    // when 0, its save!
    if ($c == 0) {
        // split string in chars:
        for ($i = 0; $i < strlen($a); $i++) $split[] = substr($a, $i, 1);

        return $split;
    } else {
        // check them:
        $offset = 0;
        $good = 0;

        //  loop through the minuses:
        for ($i = 0; $i < $c; $i++) {
            $p = strpos($a, "-", $offset);

            // before there is a number == good
            if ($p > 0) {
                if (is_numeric(substr($a, $p - 1,1))) $good++;
            }
            $offset = $p + 1;
        }

        // everything is good, no negative numbers:
        if ($good == $c) {
            for ($i = 0; $i < strlen($a); $i++) $split[] = substr($a, $i, 1);

            return $split;
        } else {
            // split needs a bit of special attention:
            $split = array();
            $ex = explode("-", $a);

            // loop through all the parts

            // make the array:
            for ($y = 0; $y < strlen($a); $y++) $split[] = substr($a, $y, 1);

            // calculate the offset
            $o = strlen($ex[0]);
            for ($i = 1; $i < count($ex); $i++) {
                // if the previous $i is empty, then add it to the first item.
                if ($ex[$i - 1] == "") {
                    array_splice($split, 0,1);
                    $split[0] = "-" . $split[0];
                }

                // if the previous last char is not numeric
                $last = substr($ex[$i - 1], -1, 1);
                if (!is_numeric($last) AND $last) {
                    array_splice($split, $o, 1);
                    $split[$o] = "-" . $split[$o];
                }
                // update offset
                $o += strlen($ex[$i]);

            }
            return $split;
        }
    }
}

$ex[0] = "abs(5*-9)";
$ex[1] = "5*(1-9)";
$ex[2] = "-1*(5-9)";
$ex[3] = "5*(-1-9)";
$ex[5] = "-3+2(-5-9)";
$ex[6] = "5*3";
$ex[7] = "5*(-1-9)";

foreach($ex as $e) {
    echo "
" . $e . "
";
    echo "
";
    print_r(splitEq($e));
    echo "
";
    echo "
";
}

There are some limitations; you can't use double digits like 15 at this moment.


text:
Q: We are using the Java Applet technology in our product. Is there an alternative to Oracle's Java Web Plugin provided by another vendor? Oracle is planning to make its JRE paid from Jan 2019 onwards. We need to find another vendor that supplies the Java Web plugin for free. Do any of the OpenJDK vendors provide this plugin?
Oracle hosts the plugin on this link - https://www.java.com/en/download/

A: Certainly the OpenJDK has the java.applet.Applet and javax.swing.JApplet classes. That is all that is needed, technically, to enable applets. Of course, using them in a browser, at least for general consumption, is no longer an option.
But why use Java? Recent developments allow most traditional Java applets and Java applications (both) to be run in JavaScript. The process is still in beta, but it has been highly successful. Development is all in Java; deployment is in Java and JavaScript simultaneously. Minimal recoding is necessary, mainly to reconfigure threads to be "state-like" and not require wait() and notify(). And the same for dialogs. But our experience is that both of these issues are easily worked around. It's not perfect. Certainly there are limitations -- a few missing Swing classes, "not so long" long numbers. Speed 15-30% Java. Some pretty major applications have been converted. (Jmol was the first.)
For more information, see  https://github.com/BobHanson/java2script for details.


text:
Q: Tracing changes to window.location in JavaScript I have a webapp which is doing a weird, wrong, unexpected redirection through JavaScript (I checked that by disabling JavaScript in the browser. Redirection doesn't happen). I've also checked all the JavaScript code for window.location being set and put breakpoints on it, but it still didn't tell me who did the redirect.
I don't want to add processing before or after redirections, I need to know which code triggered the redirection so I can disabled it.

A: There's several methods to do navigation in Javascript. Check

*

*window.location or document.location

*window.navigate (only in some browsers)

*window.history

See e.g. https://developer.mozilla.org/en-US/docs/DOM/window.history or https://developer.mozilla.org/en-US/docs/DOM/Manipulating_the_browser_history on history, and https://developer.mozilla.org/en-US/docs/DOM/window.location on window.location


text:
Q: Can RF power measurement be done using a temperature probe? Can RF power (at HF frequencies in the range of 0 to 40 dBm into a 50 Ohm load) be measured by a thermometer or other temperature measurement device on the termination load?
If so, what kind of temperature probe should be used?  What might be the environmental considerations around the termination load?  And how might the accuracy of this method of power measurement compare to using a scope probe to estimate sinusoidal voltage (Vpp) across the load?

A: HP aka Keysight use to make rf power meters using thermocouple heads. You might search their app notes and see what they may have to say about construction of the probes. Outfits now make power meter probes connected to a PC via USB to measure power.

A:
Can RF power (at HF frequencies in the range of 0 to 40 dBm into a 50 Ohm load) be measured by a thermometer or other temperature measurement device on the termination load?

yes. Temperature measurement is one of the ways RF powers are measured – though that is an approach typically reserved to really large powers (or historically, very wide bandwidths, where everything else is complicated), or very nicely integrated systems that isolate the measurement device very much from the environments. 0-20 dBm is not really that regime, but the same principle still applies.
But: you need to calibrate this. You can theoretically calculate the thermal resistance (and hence the factor between difference to ambient temperature and load temperature) of a black-painted resistive load in a disturbance-free box, but honestly, that's more or less guessing, since you'd need to know the shape, air pressure, circulation, reflectivity of surroundings, thermal conductivity of your connections, and the environmental temperature (and I'm sure a lot of other things) to a high degree of accuracy if you want to do this with low powers.
So, honestly, this sounds way way more work than it's worth; if you can calibrate that chamber you need to build, then you could also calibrate an RTL dongle (or really, whatever receives your signal and is able to calculate power) with maybe external attenuators, and be done with it (you'd still want to control the temperature of the device, as that influences gain, but that control is much laxer than what you'd need to measure 5 dBm).
Other than that:

*

*My answer to "How to make an RF probe for accurate power measurement at QRP power levels?"


text:
Q: Signing iOS application the command line way goes wrong I need your help for some problem with the signature of my iOS application :

*

*When I do it by "Product > Archive > Distribute" all is fine, my ipa is created and installation via iTunes works perfectly. (the ipa file weight 630Ko)

*So I try to do it by command line and I encountered several problems (I tried this tutorials : here, here, here and here) :
1 - My path to the ".app" folder  is really long and could be false because when I choose "show in finder" in Xcode it shows me "Debug-iphoneos" folder instead of "Release-iphoneos" folder.
2 - The .ipa file is smaller (550-557Ko according to the tutorial).
3 - When I install it throught iTunes, the icon stay dark and when I click on it the text change to "installation..." and nothing more happens.
Did someone ever ran into this situation and found a miracle solution ?

A: Use this GEM to generate builds by the terminal: https://github.com/nomad/shenzhen
It handles most of the pain for you, but the problem your are reporting should be related with the provision profile. Check if the uuid of the device is in the provision profile and if the provision profile stills valid.


text:
Q: Python Scientific Notation Format I have a large set of data with small values in the order of 10^-3. However they're written without the "e"; for example, 9.993e-3 is written as 9.993-3 in the file. This creates problems in numpy. How can I add that "e" in between the last digit and the negative sign?
Some notes: The data set is contained in a file with no delimiters (number occupies a fixed width) and some of the data aren't necessarily in the order of 10^-3.
Small snippet of data:
11.752811.950003-6.973-3
11.772591.950003 -.00636
11.792371.950002-5.746-3

A: Here's a solution for what I understand the format of your data to be. Please confirm exact format if I've misunderstood.
data = '11.752811.950003-6.973-311.772591.950003 -.0063611.792371.950002-5.746-3'
fixed_width = 8

numbers = []
for i in range(0, len(data), fixed_width):
    num = data[i:i+fixed_width]
    num = float(num[:2] + num[2:].replace('-', 'E-'))
    numbers.append(num)

A: s='9.993-3'
s1=s[:s.index('-')] + 'e' + s[s.index('-'):]
print(s1)

A: When you reference the data you can just use:
str.replace("-", "e-")

Or if you have some negative data values use regex:
import re
for line in some_file:
    line = re.sub(r'(?<=[1-9]{1,})(-)', 'e-', line)

A: import re

data = '11.752811.950003-6.973-311.772591.950003 -.0063611.792371.950002-5.746-3'

1. create list of 8-digit numbers

dataList = re.findall(r'.{8}', data)

2. add e to the numbers that need it

>>>[re.sub(r'(-\d)$', r'e\1',number) for number in dataList]

['11.75281', '1.950003', '-6.973e-3', '11.77259', '1.950003', ' -.00636', '11.79237', '1.950002', '-5.746e-3']


text:
Q: Error from server (BadRequest): container "grafana" in pod is waiting to start: PodInitializing Recently worked on a deployment for grafana instance which I edited the replicas within the spec: block from "1" to "0" --- intention was to scale down the replicas of the deployment but did something totally different which caused things to end up in the following state:

*

*container "grafana" in pod "grafana-66f99d7dff-qsffd" is waiting to start: PodInitializing

Even though, I brought back the replicas to their initial state with the default value, the pod's state still stays on PodInitializing
Since then, I have tried the following things:

*

*Rolling Restart by running kubectl rollout restart deployment [deployment_name]

*Get logs by running kubectl logs [pod name] -c [init_container_name]

*Check if nodes are in healthy state by running kubectl get nodes

*Get some additional logs for the overall health of the cluster with kubectl cluster-info dump
Here is an output of the yaml for the grafana deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: "2019-08-27T11:22:44Z"
  generation: 3
  labels:
    app: grafana
    chart: grafana-3.7.2
    heritage: Tiller
    release: grafana
  name: grafana
  namespace: default
  resourceVersion: "371133807"
  selfLink: /apis/apps/v1/namespaces/default/deployments/grafana
  uid: fd7a12a5-c8bc-11e9-8b38-42010af0015f
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: grafana
      release: grafana
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        checksum/config: 26c545fd5de1c9c9af86777a84500c5b1ec229ecb0355ee764271e69639cfd96
        checksum/dashboards-json-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
        checksum/sc-dashboard-provider-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
        checksum/secret: 940f74350e2a595924ed2ce4d579942346ba465ada21acdcff4916d95f59dbe5
      creationTimestamp: null
      labels:
        app: grafana
        release: grafana
    spec:
      containers:
      - env:
        - name: GF_SECURITY_ADMIN_USER
          valueFrom:
            secretKeyRef:
              key: admin-user
              name: grafana
        - name: GF_SECURITY_ADMIN_PASSWORD
          valueFrom:
            secretKeyRef:
              key: admin-password
              name: grafana
        - name: GF_INSTALL_PLUGINS
          valueFrom:
            configMapKeyRef:
              key: plugins
              name: grafana
        image: grafana/grafana:6.2.5
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 10
          httpGet:
            path: /api/health
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 30
        name: grafana
        ports:
        - containerPort: 80
          name: service
          protocol: TCP
        - containerPort: 3000
          name: grafana
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /api/health
            port: 3000
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/grafana/grafana.ini
          name: config
          subPath: grafana.ini
        - mountPath: /etc/grafana/ldap.toml
          name: ldap
          subPath: ldap.toml
        - mountPath: /var/lib/grafana
          name: storage
      dnsPolicy: ClusterFirst
      initContainers:
      - command:
        - chown
        - -R
        - 472:472
        - /var/lib/grafana
        image: busybox:1.30
        imagePullPolicy: IfNotPresent
        name: init-chown-data
        resources: {}
        securityContext:
          runAsUser: 0
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/grafana
          name: storage
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext:
        fsGroup: 472
        runAsUser: 472
      serviceAccount: grafana
      serviceAccountName: grafana
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          name: grafana
        name: config
      - name: ldap
        secret:
          defaultMode: 420
          items:
          - key: ldap-toml
            path: ldap.toml
          secretName: grafana
      - name: storage
        persistentVolumeClaim:
          claimName: grafana

And this is the output of the yaml with kubectl describe for the pod
Name:           grafana-66f99d7dff-qsffd
Namespace:      default
Priority:       0
Node:           gke-micah-prod-new-pool-f3184925-5n50/10.1.15.208
Start Time:     Tue, 16 Mar 2021 12:05:25 +0200
Labels:         app=grafana
                pod-template-hash=66f99d7dff
                release=grafana
Annotations:    checksum/config: 26c545fd5de1c9c9af86777a84500c5b1ec229ecb0355ee764271e69639cfd96
                checksum/dashboards-json-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
                checksum/sc-dashboard-provider-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
                checksum/secret: 940f74350e2a595924ed2ce4d579942346ba465ada21acdcff4916d95f59dbe5
                kubectl.kubernetes.io/restartedAt: 2021-03-15T18:26:31+02:00
                kubernetes.io/limit-ranger: LimitRanger plugin set: cpu request for container grafana; cpu request for init container init-chown-data
Status:         Pending
IP:
IPs:            <none>
Controlled By:  ReplicaSet/grafana-66f99d7dff
Init Containers:
  init-chown-data:
    Container ID:
    Image:         busybox:1.30
    Image ID:
    Port:          <none>
    Host Port:     <none>
    Command:
      chown
      -R
      472:472
      /var/lib/grafana
    State:          Waiting
      Reason:       PodInitializing
    Ready:          False
    Restart Count:  0
    Requests:
      cpu:        100m
    Environment:  <none>
    Mounts:
      /var/lib/grafana from storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from grafana-token-wmgg9 (ro)
Containers:
  grafana:
    Container ID:
    Image:          grafana/grafana:6.2.5
    Image ID:
    Ports:          80/TCP, 3000/TCP
    Host Ports:     0/TCP, 0/TCP
    State:          Waiting
      Reason:       PodInitializing
    Ready:          False
    Restart Count:  0
    Requests:
      cpu:      100m
    Liveness:   http-get http://:3000/api/health delay=60s timeout=30s period=10s #success=1 #failure=10
    Readiness:  http-get http://:3000/api/health delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:
      GF_SECURITY_ADMIN_USER:      <set to the key 'admin-user' in secret 'grafana'>      Optional: false
      GF_SECURITY_ADMIN_PASSWORD:  <set to the key 'admin-password' in secret 'grafana'>  Optional: false
      GF_INSTALL_PLUGINS:          <set to the key 'plugins' of config map 'grafana'>     Optional: false
    Mounts:
      /etc/grafana/grafana.ini from config (rw,path="grafana.ini")
      /etc/grafana/ldap.toml from ldap (rw,path="ldap.toml")
      /var/lib/grafana from storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from grafana-token-wmgg9 (ro)
Conditions:
  Type              Status
  Initialized       False
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      grafana
    Optional:  false
  ldap:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  grafana
    Optional:    false
  storage:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  grafana
    ReadOnly:   false
  grafana-token-wmgg9:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  grafana-token-wmgg9
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason       Age                    From     Message
  ----     ------       ----                   ----     -------
  Warning  FailedMount  19m (x82 over 169m)    kubelet  MountVolume.SetUp failed for volume "ldap" : secret "grafana" not found
  Warning  FailedMount  9m24s (x18 over 167m)  kubelet  Unable to attach or mount volumes: unmounted volumes=[ldap], unattached volumes=[grafana-token-wmgg9 config ldap storage]: timed out waiting for the condition
  Warning  FailedMount  4m50s (x32 over 163m)  kubelet  Unable to attach or mount volumes: unmounted volumes=[ldap], unattached volumes=[storage grafana-token-wmgg9 config ldap]: timed out waiting for the condition

As I am still exploring and trying to research how to approach this, any advice, or even probing Qs are more than welcome to think through this.
Appreciate your time and effort!


text:
Q: Unable to load shared library while running the program I am facing strange issue while loading shared library in a cpp program. When the make file is executed then it works fine -
LIB_RELEASE = $(LIB)-lopencv_highgui -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lmmcheng_github -lgomp

But when I run this using the output file which is generated as a result of this make file, it gives me error as -
./bin/mmcheng_densecut: error while loading shared libraries: libmmcheng_github.so: cannot open shared object file: No such file or directory

PS I have placed the libmmcheng_github.so in the folder /usr/local/lib
Error Screenshot -
Thanks

A: Try setting LD_LIBRARY_PATH environment string, read here
Although this is discouraged practice but at least it will help you make one step forward...
also, read this question and answer


text:
Q: Jenkins configuration for a project with local project dependencies I have a automation project which makes use of .jar of a util project. I am very new to Jenkins so can somebody guide me as to how to create a jenkin job and handle local project jar dependencies aswell.

A: Since this is jenkins pipeline you need to do the following.

*

*Create a repo with a jenkinsfile*

*Create a multi branch pipeline job in jenkins and point to your repo.
When a build is started it will interpret your jenkinsfile and execute all the defined steps.

By making use of a .jar what do you mean? Is it an executable on the same machine? In that case add it to your path and use it when executing a shell or a bat script in the jenkinsfile.
More info here: https://www.jenkins.io/doc/book/pipeline/
*Example jenkinsfile:
pipeline {
agent any

options {
    //Discard old builds, not necessary but nice to have
    buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '20'))
}

environment {
    // Example of how to retrieve credentials and set them as environment variables
    EXAMPLE_CREDENTIAL= credentials('EXAMPLE_CREDENTIAL')
}

stages {
    stage('A build step') {
        steps {
          // do your stuff here, this can also be divided into several stages like one for building the code and one for executing it

        }
    }
}

// Post build actions, e.g archiving, clean up etc
 post {
    always {
        archiveArtifacts artifacts: '**/*.*', fingerprint: true
        deleteDir()
    }
}

}

A: I would not build in dependencies to local projects. If it's just an executable .jar file you can add it as a secret file the same way you add credentials and while executing the job copy it to your workspace like this:
environment {
    FILE = credentials('my_file')
}

stages {
    stage('Preperation'){
        steps {
            // Copy your fie to the workspace
            sh "cp ${FILE} ${WORKSPACE}"
            // Verify the file is copied.
            sh "ls -la"
        }
    }
}

An alternative could be adding the file to your path and access the executable via the command line when executing the job.
If you want the whole project I would definitely check that out. I.e you need to add a a shell command for checking the project out.

A: Thanks Jan for your direction. I achieved output with the following code:
pipeline
agent any

stages {

    stage('Building dependent project') {

        steps {

            echo "Building dependent project"

    git (

             url: 'https:**********.git',
   credentialsId: '***********************',
   branch: "master"
  )

  sh "mvn clean install -DskipTests"

        }
    }
    stage('Building and testing main Project') {
        steps {
              git (
             url: 'https://************.git',
   credentialsId: '******************',
   branch: "exp3"
  )
  sh "mvn clean install -Dapp=${App} -Denv=${Envir} -Dversion=${Version}"
        }
    }
}

}