text:
Q: Considering SSD upgrade for 13" Mid-2012 MacBook Pro My Macbook's HDD is starting to show signs of age and I'm considering replacing it with a Samsung 850 EVO 500GB SSD. I know and am comfortable with the actual hardware replacement, but I heard that the newest Mac; OS El Capitan, has some "feature" to prevent using third party SSDs. Something to do with TRIM if I remember right. I would like to know if that is an actual problem or if I can go ahead and make the purchase.
Thank you very much!
P.S. I'd like to point out that this will be a fresh install.

A: OS X 10.11, El Capitan, does not include specific code to prevent the use of a third party Solid State Disk (SSD).
I have replaced my MacBook Pro's Hard Disk Drive (HDD) with a Samsung SSD; the MacBook is running OS X 10.11.
With regard to TRIM support on non-Apple installed drives, see Should I enable TRIM with a third party (non-Apple) SSD?

A: Apple's SSDs are officially supported in OS X and TRIM feature is enabled by default for them. But for third party SSDs there is native builtin command to enable TRIM support. I followed this tutorial to add and SSD to my MacBook Pro with HD caddy. Although now I realized that I don't use previous HDD day to day.
There is no problem for me since I started to use the new third party Samsung 850 EVO SSD. I used this tutorial to enable TRIM support:
sudo trimforce enable


text:
Q: How to grab image from blob:http localhost url using either jquery or angularjs or webgl I would like to know that how can I grab the image(using either jquery or angularjs or WebGL) from the localhost url that is I can get the url of uploaded image file like: blob:http%3A//localhost%3A9000/87424398-8ee0-4db1-a653-bc18838d6b24, so I need to display the image from this url on my <div> element. For me it is showing the error like on displaying it:
Unknown number of bits allocated - using default: 32 bits
Uncaught TypeError: Cannot read property 'set' of null
    X.parserDCM.parse @ parserDCM.js:362
    (anonymous function) @ loader.js:295

For your reference you can look into at: http://slicedrop.com/ .
Please help me in this regard. Thanks in advance.

A: i'm not sure these are the droids your looking for, but:
var a = document.getElementById('file').files[0];
var tmppath = URL.createObjectURL(a);
var img = new Image();
img.src = tmppath ;
img.crossOrigin = '';

// after image loading
img.onload = function (): void { //something }

redpajama_set_name: RedPajamaStackExchange


text:
Q: jQuery Validation plugin "a.validator.methods[d] is undefined" I want to know how to validate a file size, type and extension using the plugins from http://jqueryvalidation.org.
I'm trying to make the <input type="file" name="file"> not required but I get a a.validator.methods[d] is undefined in my console.Everything works fine if file:{required: is true. But in my case, a file is not required.
I have these files included:
<script src="../javascripts/jquery.validation.js"></script>
<script src="../javascripts/jquery.validation.additional.js"></script>

$('#message').validate({
    ignore: "",
    rules: {
        message:{ required: true },
        file:{ required:false, accept: "png|jpe?g|gif", filesize: 1048576 }
    },
    messages:{
        message:"Please type your message",
        file:{ required:"File is required", accept: "Hello" },
    }
});

UPDATE:
I tried using ignore: ".ignore" with file:{required:true and <input type="file" name="file" class="ignore">. It still validates on submit. And if I set file:{required: to false then I still get a a.validator.methods[d] is undefined error in console.

A: Take a look at Ignore from Documentation.
http://jqueryvalidation.org/validate


text:
Q: Are variable length arrays there in c++? I had always thought that variable length arrays were  not allowed in c++(Refer :Why aren't variable-length arrays part of the C++ standard?) .But than why does this code compile and work?
#include <iostream>
using namespace std;

int main () {

    int n;
    cin >> n;

    int a[n];

    for (int i=0; i<n; i++) {
        a[i] = i;
    }

    for (int i=0; i<n; i++) {
        cout << a[i] << endl;
    }
}

A: The current C++ standard does not require that compilers support VLAs. However, compiler vendors are permitted to support VLAs as an extension. GCC >= 4.7, for example, does.
It was originally proposed that VLAs would appear in C++14, however the proposal did not succeed. They also, ultimately, did not appear in C++17.

A: C99 permits VLA, but C++ never permits that, because the performance of VLA is so unfriendly. And in C11, VLA becomes an optional feature.
Before, it's said that VLA would appear at C++17. But now C++17 is published, and no VLA, either. (And it seems C++20 won't have VLA. The recent documents haven't talk about it at all.)
Although the standard doesn't support it, GNU compiler supports it as an extension.


text:
Q: What are the exit codes used by RASPHONE.exe? Due to a major time constraint, need to stick with invoking rasphone.exe from my c program, rather than best approach of using RAS API's. From my code, when the rasphone pop's up a dialler window to the user, if the user click's on cancel button, i have to stop blocking another set of code.
Ultimately, i need to handle the rasphone returns to control my code flow based on the Success/Failure-Cancel. How to do this? Also, is there any other possibility for silent dialling without any popup?I hope no, as its discussed.


text:
Q: #define in #define; what happens in the preprocessor? If I have:
#define X 5
#define Y X

what happens in the preprocessor for that kind of thing?
Is it going through the whole file and changes every X to 5,
then comes back up to the next define and then changes every Y to 5 (because in the previous iteration Y got 5) ?

A: The C standard has a special terminology for how macros are expanded.
Macro names are, in effect, stored in a big table of "all macros defined at this time".  Each table entry "macro name" on the left (and any arguments in the middle) and "expansion token-stream" on the right.
When a macro is to be expanded (because it occurs in some non-preprocessor line, or in a position in a preprocessor line in which it must be expanded -- e.g., you can #define STDIO <stdio.h> and then #include STDIO), the table entry is "painted blue", and then the replacement token-stream is read (with argument expansion as also dictated by the standard).
If the replacement token-stream contains the original macro name, it no longer matches, because the "blue paint" covers up the name.
When the replacement token-stream has been fully handled, the "blue paint" is removed, re-exposing the name.
Thus:
#define X 5

adds X: (no arguments), 5 to the table.
Then:
#define Y X

adds: Y: (no arguments), X to the table.
Somewhere later in the file, you might have an occurrence of the token Y.  Assuming neither of the above have been #undefed (removed from the table), the compiler must first "paint the table entry for Y blue" and replace the token Y with the token X.
Next, the compiler must "paint the table entry for X blue" and replace the token X with the token 5.
The token 5 is not a preprocessor macro name (it can't be by definition) so the token 5 passes beyond the reach of the preprocessing phase.  Now the "blue paint" is removed from the X table entry, as that's done; and then the "blue paint" is removed from the Y entry, which is also done.

If you were to write instead:
#define Y Y, Y, Y, the letter is called Y!

then the sequence, on encountering a later token Y, would be:

*

*paint entry for Y blue

*drop in replacement token sequence: Y , Y , Y , the letter is called Y !

*check each replacement token in the table -- since Y is painted blue those don't match, and , cannot match, so those are all passed on to the rest of the compiler; the, letter, is, and called must be checked but are probably not in the table and hence passed on; Y is still painted blue so does not match and is passed on, and ! cannot match and is passed on.

*remove blue paint, restoring the expansion


text:
Q: Creating "barriers" around the viewing area of a tkinter canvas object Okay, so I have sort of a unique situation here, so bear with me. I want to be able to create so called "barriers" around the viewing area (the part of the canvas visible to the user) of a tkinter canvas object. For example, take a look at the screenshots below (based on the MCVE at the end):

As you can see in the image above, the line currently goes outside the viewing area of the canvas when the user reaches the end. However, that is not what I want. Instead, I want that whenever the user reaches the end of the canvas's visible area, a "barrier" gets hot, and upon contact, a carriage return occurs, and the line(s) continue(s) on from there. So instead of the above, what I really want is this:

Here is the MCVE I used to take the above screenshots:
import tkinter as TK

xold = None
yold = None

class canvas(TK.Frame):
    def __init__(self, root, *args, **kwargs):
        # Initialize a tkinter frame widget
        TK.Frame.__init__(self, root, width = 800, height = 850, *args, **kwargs)
        self.root = self.winfo_toplevel()
        self.bg = "white"
        self.width, self.height = 850, 800
        self.canvwidth, self.canvheight = 10000, 10000
        # Set up the canvas and its corresponding scrollbars
        self.canvas = TK.Canvas(root, width=850, height=800,
                                 bg=self.bg, borderwidth=0, highlightthickness = 5, highlightbackground = 'brown', highlightcolor = 'brown')
        self.hscroll = TK.Scrollbar(root, command=self.canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(root, command=self.canvas.yview)
        self.canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        # Add the scrollbars into the root window
        self.canvas.grid(padx=1, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky = 'news')
        self.vscroll.grid(padx=1, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        # Call the `reset` method of the canvas class
        self.reset()
        # Bind the `line` method to the 'l' key of the users keyboard (as an example of what I want)
        self.root.bind('<l>', self.line)

    def reset(self, canvwidth=None, canvheight=None, bg = None):
        ###############################################################################################################################
        # This adds the scrollbars themselves to the canvas and adapts them to the canvas's size (in this case, 10000 x 10000 pixels) #
        ###############################################################################################################################

        if canvwidth:
            self.canvwidth = canvwidth
        if canvheight:
            self.canvheight = canvheight
        if bg:
            self.bg = bg
        self.canvas.config(bg=bg,
                        scrollregion=(-self.canvwidth//2, -self.canvheight//2,
                                       self.canvwidth//2, self.canvheight//2))
        self.canvas.xview_moveto(0.5*(self.canvwidth - self.width + 30) /
                                                               self.canvwidth)
        self.canvas.yview_moveto(0.5*(self.canvheight- self.height + 30) /
                                                              self.canvheight)

    def line(self, event):
        ########################################################################################################
        # Create a short, horizontal, black line on every press of the user's 'l' key (as an example to go by) #
        ########################################################################################################
        global xold, yold
        if xold != None and yold != None:
            pass
        else:
            xold, yold = 0, 0
        self.canvas.create_line(xold, yold, xold+30, yold, smooth = TK.TRUE, width = 1, capstyle = TK.ROUND, joinstyle = TK.ROUND, fill = 'black')
        xold = xold+30
        yold = yold

if __name__ == '__main__':
    # Create a window, and provide that window to the canvas class as the root window
    root = TK.Tk()
    root.geometry('900x850')
    canvas(root)
    root.mainloop()

Is it possible to add this ability to the MCVE above using tkinter? If so, how would I get started on trying to implement it?

A: I am not sure what you are actually trying to do (especially trying to constrain drawing in the displayed region while you provide a very large canvas with scrollbars).
For the simplest case, all you need is a bound value and to test xold against it
if xold > 440:
    xold = -410
    yold += 30

If you want to take into account the current displayed area, you have to combine information from canvas scrollregion and xview methods. The first return the bounds of the canvas and former the relative position of the displayed aera in the scrollregion.
    scroll = list(map(int,self.canvas["scrollregion"].split()))
    xview = self.canvas.xview()
    leftbound = scroll[0] + xview[1] * (scroll[2]-scroll[0])
    if xold > leftbound:
        rightbound = scroll[0] + xview[0] * (scroll[2]-scroll[0])
        xold = rightbound
        yold += 30


text:
Q: Excel INDIRECT returns with REF error I don't understand why my INDIRECT function does not work. I'm dynamically changing D2 value from a list.
=INDIRECT("'G:\Production\OPH 2015\"&D2&"'!"&"G4")

where
D2 = [Spreadsheet.xslx]Sheet1
G4 would be the value I want the formula to return with.
The same formula on its own returns the value 72.2% and looks like this:
='G:\Production\OPH 2015\[Spreadsheet.xlsx]Sheet1'!G4

A: It isn't your formula that is incorrect, the INDIRECT formula will return #REF! if the workbook is closed.
I haven't tried this, but I believe this add-in will solve your problem: http://www.ashishmathur.com/tag/indirect-ext/

A: Q: "I don't understand why my INDIRECT function does not work"
A: From the MS Office Support Article for INDIRECT():

*

*If ref_text refers to another workbook (an external reference), the other workbook must be open. If the source workbook is not open, INDIRECT returns the #REF! error value.


text:
Q: Inline Notation for the Diagonal of a Matrix? Is there a LaTeX command to indicate one is referring to the elements of a matrix diagonal?  Something like \diag{X}?  It seems like this must exist but I cannot find it (search terms too common in multiple contexts).
Note: I don't want to display the matrix in any way, just refer to the diagonal.

A: One thing that one always can do is to define the math operators one needs using \DeclareMathOperator. For example, for \diag one could use
\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\diag}{diag}
\begin{document}
$A=\diag(a_1,\dots,a_n)$
\end{document}

P.S. I personally would hesitate to load a package just in order to avoid defining one operator. In particular, I do not recommend the physics package (yet this one does not seem to define \diag anyway).


text:
Q: PyQt - how to get top level parent from the given widget? How can given widget access it's oldest parent, which is top level widget.
I need to .showMinimized() it.
Now I am using
self.parent().parent().parent().showMinimized()

But it seem not to be the best way for this.
If it it moved, I need to change number of parent manually.
Is there a way to access top level widget?

A: If you're just trying to get to the window widget, there's QWidget.window().
self.window().showMinimized()


text:
Q: Looping through an object then through a nested array of objects--javascript react/redux I am trying to loop through an array to pull one piece of info from an object. Got it! However, I need to loop through an array within that same object after having gotten the first piece of data to pull more data from the nested array of objects. Any clue how I could make this work? I have tried multiple ways. I am now stuck at trying to run two if statements in this render function which react/redux is not "liking". I.e. it will not execute the 2nd if statement. Any help is appreciated. There is a sample of my data structure at the bottom Thanks!
    render(){
    let takePoll;
    let choices;
        if(this.props.polls.length > 0){
            takePoll =  this.props.polls.map( poll => {
                if (this.props.pollId === poll.id){
                    return (

{poll.text}

                    )
                }
            })
        }

        if(this.props.polls.length > 0){
            let choices = this.props.polls.map(poll => {
                if (this.props.pollId === poll.id){
                    return poll.choices.map(obj => {
                        return (

{obj.choice}

                        )
                    })
                }
            })
        }
    return (

            {takePoll}
            {choices}

    )
}

//DATA STRUCTURE BELOW:

{
"id": "596dfbbc02c10a41e05a82d5",
"text": "which summer was hotter?",
"choices": [
    {
        "choice": "2017",
        "vote": "0"
    },
    {
        "choice": "2004",
        "vote": "0"
    }
],
"date": "2017-07-18T12:14:52.791Z" }

A: Two if() statements that have the same exact variable/value check should not be your fix. Given what @Anamul suggested, you may want to try something like this:
render() {
  let takePoll;
  let choices;
  if (this.props.polls.length > 0) {
    takePoll = this.props.polls.map(poll => {
      if (this.props.pollId === poll.id) {
        return (

{poll.text}

        )
      }
    })
    choices = this.props.polls.map(poll => {
      if (this.props.pollId === poll.id) {
        return poll.choices.map(obj => {
          return (

{obj.choice}

          )
        })
      }
    })
  }
  return (

      {takePoll}
      {choices}

  )
}

A: well if I were you, I will do it in one loop
render(){
let takePoll = [];
let choices = [];

for(let i = 0; i < this.props.polls.length; i++) {
  let poll = this.props.polls[i]
    if (this.props.pollId === poll.id){
        takePool.push(

{poll.text}

        )
        choices.concat(poll.choices.map(obj => {
            return (

{obj.choice}

            )
        }))
    }
})

return (

        {takePoll}
        {choices}

)}

note that I have tested the code yet


text:
Q: How to compare two TStringLists? I am currently trying to compare two TStringList and whether one containts items of another.
As an example.
sl1 := TStringList.Create;
for i := 0 to record.count - 1 do
  sl.add(record[i]);

This gets executed on the start of the program and is not updated until the program starts again. Note that the record is a string and can be more than one word. (e.g. jack, thomas lember, lester,...)
Then I have a timer which looks like this.
sl2 := TStringList.Create;
for i := 0 to record.count - 1 do
  sl2.add(record[i]);

if sl1 item is not in sl2 then  <-- stuck here
  s := s + record[i];

I want to compare both lists and then create a string of what is missing. This should be easy, but the position of strings can change. What is in sl1[2] can now be in sl2[7]. To the s string I want to add only items that are missing and didn't change the position.

A: You need to compare each item of the sl1 with each item of the sl2.
for i := 0 to sl1.count - 1 do
begin

   found := false;

   for j := 0 to sl2.count - 1 do
   begin
      if sl1[i] = sl2[j] then
      begin
         found := true;
         break;
      end;

   end;

   if not Found then
      slMissing.add(sl1[i])

end;

You can use TStringList.IndexOf instead of the inner loop if you want.

A: That's easy:

if sl1 item is not in sl2 then  <-- stuck here

You can use sl2.IndexOf() like this:
if sl2.IndexOf(sl1[i]) < 0 then

But if both lists are and remain sorted, you can probably skip a few items, as the index in one list can never be lower than that in the other.

A: Just loop thru both stringlists and compare each with each until you found a match
sl1.Add('one');
sl1.Add('two');

sl2.Add('two');
sl2.Add('one');

i := 0;
j := 0;
found := FALSE;

while (i < sl1.Count) and not found do
begin
  j := 0;
  while (j < sl2.Count) and not found do
  begin
    found := sl1[i] = sl2[j];
    inc(j);
  end;
  inc(i);
end;

if found then
  ShowMessage('found: item ' + IntToStr(i) + ' was on ' + IntToStr(j) + ' in the second list')
else
  ShowMessage('Not found');

Alternative solution
i := 0;
found := FALSE;

while (i < sl1.Count) and not found do
begin
  j := sl2.IndexOf(sl1[i]);
  Found := j >= 0;

  inc(i);
end;


text:
Q: Problem in removing MySql from ubuntu I want to completely remove mysql from ubuntu and decided to follow some steps found in link :
I executed the following commands in order:
sudo -i
service mysql stop
killall -KILL mysql mysqld_safe mysqld
apt-get --yes purge mysql-server mysql-client
apt-get --yes autoremove --purge
apt-get autoclean
deluser --remove-home mysql
delgroup mysql
rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld
updatedb
exit
rm ~/.mysql_history
awk -F : '{ print($6 "/.mysql_history"); }' /etc/passwd | xargs -r -d '\n' -- sudo rm -f --
sudo find / -name .mysql_history -delete

Well I should have a little more attention with the commands, the problem is that now any install command or even the upgrade returns faults. Ex executing command :
# apt-get upgrade

It results in the following errors :
Lendo listas de pacotes... Pronto
Construindo árvore de dependências
Lendo informação de estado... Pronto
Calculando atualização... Pronto
0 pacotes atualizados, 0 pacotes novos instalados, 0 a serem removidos e 0 não atualizados.
7 pacotes não totalmente instalados ou removidos.
Depois desta operação, 0 B adicionais de espaço em disco serão usados.
Você quer continuar? [S/n] s
Configurando mysql-common (5.7.19-0ubuntu0.16.04.1) ...
update-alternatives: erro: o caminho /etc/mysql/my.cnf.fallback da alternativa não existe
dpkg: erro ao processar o pacote mysql-common (--configure):
 sub-processo script post-installation instalado retornou estado de saída de erro 2
dpkg: problemas com dependências impedem a configuração de mysql-client-5.7:
 mysql-client-5.7 depende de mysql-common (>= 5.5); porém:
  Pacote mysql-common não está configurado ainda.

dpkg: erro ao processar o pacote mysql-client-5.7 (--configure):
 problemas de dependência - deixando desconfigurado
dpkg: problemas com dependências impedem a configuração de mysql-server-5.7:
 mysql-server-5.7 depende de mysql-client-5.7 (>= 5.7.19-0ubuntu0.16.04.1); porém:
  Pacote mysql-client-5.7 não está configurado ainda.
 mysql-server-5.7 depende de mysql-common (>= 5.6.22-1~); porém:
  Pacote mysql-common não está configurado ainda.
 mysql-server-5.7 depende de mysql-common (>= 5.5); porém:
  Pacote mysql-common não está configurado ainda.

dpkg: erro ao processar o pacote mysql-server-5.7 (--configure):
 problemas de dependência - deixando desconfigurado
dpkg: problemas com dependências impedem a configuração de mariadb-common:
 mariadb-common depende de mysql-common (>= 5.6.2Nenhum relatório apport escrito pois a mensagem de erro indica que é um erro de seguimento de um erro anterior.
                                                                               Nenhum relatório apport escrito pois a mensagem de erro indica que é um erro de seguimento de um erro anterior.
                              Nenhum relatório apport escrito pois MaxReports já foi atingido
             Nenhum relatório apport escrito pois MaxReports já foi atingido
                                                                            Nenhum relatório apport escrito pois MaxReports já foi atingido
                                                           Nenhum relatório apport escrito pois MaxReports já foi atingido
                                          5); porém:
  Pacote mysql-common não está configurado ainda.

dpkg: erro ao processar o pacote mariadb-common (--configure):
 problemas de dependência - deixando desconfigurado
dpkg: problemas com dependências impedem a configuração de mysql-server:
 mysql-server depende de mysql-server-5.7; porém:
  Pacote mysql-server-5.7 não está configurado ainda.

dpkg: erro ao processar o pacote mysql-server (--configure):
 problemas de dependência - deixando desconfigurado
dpkg: problemas com dependências impedem a configuração de mysql-testsuite-5.7:
 mysql-testsuite-5.7 depende de mysql-client-5.7 (= 5.7.19-0ubuntu0.16.04.1); porém:
  Pacote mysql-client-5.7 não está configurado ainda.
 mysql-testsuite-5.7 depende de mysql-server-5.7 (= 5.7.19-0ubuntu0.16.04.1); porém:
  Pacote mysql-server-5.7 não está configurado ainda.

dpkg: erro ao processar o pacote mysql-testsuite-5.7 (--configure):
 problemas de dependência - deixando desconfigurado
dpkg: problemas com dependências impedem a configuração de mysql-testsuite:
 mysql-testsuite depende de mysql-testsuite-5.7; porém:
  Pacote mysql-testsuite-5.7 não está configurado ainda.

dpkg: erro ao processar o pacote mysql-testsuite (--configure):
 problemas de dependência - deixando desconfigurado
Erros foram encontrados durante o processamento de:
 mysql-common
 mysql-client-5.7
 mysql-server-5.7
 mariadb-common
 mysql-server
 mysql-testsuite-5.7
 mysql-testsuite
E: Sub-process /usr/bin/dpkg returned an error code (1)

Does anyone know the way to solve the problem?
I've tried a lot of things on the internet, but with no success.


text:
Q: redirect 301 depending on parameter With the restructuring and enhancement of an Website I need to redirect all existing (old) Links to the new structure:
But it needs to be depending on the URL Parm and then redirected with the same parm to a different subdirectory.
somthing like this
http://existing_url.com/?m=4&s=5&a=2&b=2&c=3#2
http://existing_url.com/subdirectory/?m=4&s=5&a=2&b=2&c=3#2

but I only need to redirect if the parm starts with   ?m=
as their is new stuff as well...
thx-Martin

A: You can use this code in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|&)m= [NC]
RewriteRule ^/?$ /subdirectory/ [L,R=302]

Query string will be automatically carried over to new target.


text:
Q: How to evaluate the integral $\int\mathbf{g}^T\mathbf{v} \exp{(-\frac{1}{2}\mathbf{v}^T \mathbf{A}\mathbf{v})}\,d\mathbf{v}$ I have the following multidimensional Gaussian integral:

$$\int\textbf{g}^T\textbf{v} \exp{\left(-\frac{1}{2}\textbf{v}^T
 \textbf{A}\textbf{v}\right)}\,d\textbf{v},$$

where $\textbf{A}$ is a real symmetric $W\times W$ matrix, $\textbf{v} \in \mathbb{R}^W$ is a $W$-dimensional real vector and $\textbf{g}$ is some constant $W$-dimensional real vector.
Any hints on what approach would work here? Substitution perhaps?
UPDATE 1:
My problem is a sub-problem from my main task where I need to show that

$$y_{MP} = \int t\,p(t) \,dt,$$

where

$$p(t)\propto\int
 \exp\left(-\frac{\beta}{2}\{t-y_{MP}-\textbf{g}^T\textbf{v}\}^2-\frac{1}{2}\textbf{v}^TA\textbf{v}\right)\,d\textbf{v}.$$

$\beta, y_{MP}$ (MP stands for maximum posteriori) are constant scalars, $\textbf{g}$ is a constant vector and $A$ is a real symmetric $W\times W$matrix. The variable $t\in\mathbb{R}$ is a real number. I'm supposed to use the following facts to help me:
$$\int_{-\infty}^{\infty} \exp\left(-\frac{\lambda}{2}x^2\right)\, dx = \left(\frac{2\pi}{\lambda}\right)^{1/2}$$
$$\int_{-\infty}^{\infty} \exp\left(-\frac{1}{2}\textbf{v}^TA\textbf{v}\right)\, d\textbf{v} = (2\pi)^{W/2}|A|^{-1/2}$$
$$\int_{-\infty}^{\infty} \exp\left(-\frac{1}{2}\textbf{v}^TA\textbf{v}+\textbf{h}^T\textbf{v}\right)\, d\textbf{v} = (2\pi)^{W/2}|A|^{-1/2}\exp\left(\frac{1}{2}\textbf{h}^TA^{-1}\textbf{h}\right)$$
According to the hint, I should first integrate w.r.t $t$ and then w.r.t $\textbf{v}$. If you can help me solve my main problem, then that would be perfect answer to my question also. Thank you.
Hints from my book (page 433, tasks 10.1 and 10.2):

integrate over $t$ first, and then evaluate the integral over
  $\textbf{v}$ using the above three integral equations. Do the integral
  by expanding the square in the exponent and collect together the terms
  which are quadratic in $\textbf{v}$.

UPDATE 2:
Here is my own attempt and the point I'm stuck at the moment
$$\begin{aligned}
\int t \, p(t)\; dt &\propto \int t \, \int \exp{\left(-\frac{\beta}{2}\left\{t-y_{MP}-\textbf{g}^T \textbf{v}\right\}^2-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)}\; d\textbf{v}\; dt\\
&=\int \exp{\left(-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)} \int t \exp{\left(-\frac{\beta}{2}\left\{t-y_{MP}-\textbf{g}^T \textbf{v}\right\}^2\right)}\; dt\; d\textbf{v}\\
&=\int \exp{\left(-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)} \left[\left(y_{MP}+\textbf{g}^T \textbf{v}\right)\left(\frac{2\pi}{\beta}\right)^{1/2}\right]\; d\textbf{v} \\
&=\left(\frac{2\pi}{\beta}\right)^{1/2}\int \exp{\left(-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)} \left(y_{MP}+\textbf{g}^T \textbf{v}\right)\; d\textbf{v} \\
&=\left(\frac{2\pi}{\beta}\right)^{1/2}\left[y_{MP}\int \exp{\left(-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)}\; d\textbf{v} + \int \textbf{g}^T \textbf{v} \exp{\left(-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)}\; d\textbf{v}\right] \\
&=\left(\frac{2\pi}{\beta}\right)^{1/2}\left[y_{MP}(2\pi)^{W/2}|\textbf{A}|^{-1/2} + \int \textbf{g}^T \textbf{v} \exp{\left(-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)}\; d\textbf{v}\right]
\end{aligned}$$
In the second line I simply used substitution. My biggest problem seems to be that no matter how I try to integrate w.r.t $t$ first, I always get the factor $\textbf{g}^T\textbf{v}$, which I would like to get rid of.
UPDATE 3:
I decided to post more information here from my book, maybe it can help:

In order to evaluate $p(t)$ we shall make use of the Gaussian
  approximation for the posterior distribution of weights (weights of a
  neural network), together with the distribution of network outputs.
  This gives:
$$p(t)\propto\int
 \exp\left(-\frac{\beta}{2}\{t-y(\textbf{v})\}^2\right)\exp\left(-\frac{1}{2}\textbf{v}^TA\textbf{v}\right)\,d\textbf{v},$$
where we have dropped any constant factors (i.e. factors independent
  of $t$. $y(\textbf{v})$ is a neural network function with network
  weights $\textbf{v}$. In addition, we shall assume that the width of
  the posterior distribution (determined by the Hessian matrix
  $\textbf{A}$ of the error function) is sufficiently narrow that we may
  approximate the network function $y(\textbf{v})$ by its linear
  expansion around $\textbf{v}_{MP}$
$$y(\textbf{v}) = y(\textbf{v}_{MP}) + \textbf{g}^T\textbf{v},$$
where $\textbf{g} \equiv \nabla
 y(\textbf{v})|_{\textbf{v}=\textbf{v}_{MP}}$. $y_{MP}\equiv y(\textbf{v}_{MP})$

A: I think I got my main problem solved perhaps. Two things that helped me:

*

*Group the terms as suggested in the hint by author

*Integrate w.r.t to $\textbf{v}$ first instead of $t$
here goes:
$$\begin{aligned}
\int t \, p(t)\; dt &\propto \int t \, \int \exp{\left(-\frac{\beta}{2}\left\{t-y_{MP}-\textbf{g}^T \textbf{v}\right\}^2-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)}\; d\textbf{v}\; dt\\
&=\int t\int \exp\left(-\frac{\beta}{2}\{t^2-2ty_{MP}-2t\textbf{g}^T\textbf{v}+2y_{MP}\textbf{g}^T\textbf{v}+y_{MP}^2 + \textbf{v}^T\textbf{g}\textbf{g}^T\textbf{v}\}-\frac{1}{2}\textbf{v}^T\textbf{A}\textbf{v}\right)\;d\textbf{v}\;dt\\
&=\int t\int \exp\left(-\frac{\beta}{2}\{t-y_{MP}\}^2+\beta (t-y_{MP})\textbf{g}^T\textbf{v} -\frac{\beta}{2} \textbf{v}^T\textbf{g}\textbf{g}^T\textbf{v}-\frac{1}{2}\textbf{v}^T\textbf{A}\textbf{v}\right)\;d\textbf{v}\;dt\\
&=\int t\exp\left(-\frac{\beta}{2}\{t-y_{MP}\}^2\right)\int \exp\left(-\frac{1}{2}\textbf{v}^T\left(\textbf{A}+\beta\textbf{g}\textbf{g}^T\right)\textbf{v}+\beta (t-y_{MP})\textbf{g}^T\textbf{v}\right)\;d\textbf{v}\;dt\\
&=\int t\exp\left(-\frac{\beta}{2}\{t-y_{MP}\}^2\right) \left[(2\pi)^{W/2}|\textbf{A}+\beta\textbf{g}\textbf{g}^T|^{-1/2} \exp\left(\frac{1}{2}\beta (t-y_{MP})\textbf{g}^T\left(\textbf{A}+\beta\textbf{g}\textbf{g}^T\right)^{-1}\beta (t-y_{MP})\textbf{g}\right)\right]\;dt.
\end{aligned}$$
I will next denote $\textbf{A}+\beta\textbf{g}\textbf{g}^T=\textbf{C}$ and $\textbf{g}^T \textbf{C}^{-1}\textbf{g} = D$ so I get:
$$\begin{aligned}
\int t \, p(t)\; dt &\propto \int t\exp\left(-\frac{\beta}{2}\{t-y_{MP}\}^2\right) \left[(2\pi)^{W/2}|\textbf{C}|^{-1/2} \exp\left(\frac{1}{2}\beta^2 \{t-y_{MP}\}^2 D\right)\right]\;dt\\
&= (2\pi)^{W/2}|\textbf{C}|^{-1/2} \int t\exp\left(-\frac{\beta}{2}\{t-y_{MP}\}^2\right)  \exp\left((-D\beta)\left(-\frac{\beta}{2}\right) \{t-y_{MP})^2 \right)\;dt\\
&= (2\pi)^{W/2}|\textbf{C}|^{-1/2} \int t  \exp\left((1-D\beta)\left(-\frac{\beta}{2}\right) \{t-y_{MP})^2 \right)\;dt\\
&= (2\pi)^{W/2}|\textbf{C}|^{-1/2} \int t  \exp\left(-\frac{\lambda}{2} \{t-y_{MP})^2 \right)\;dt,
\end{aligned}$$
where $\lambda = \beta-D\beta^2$. Now it down to the last integral. I will use substitution twice. First I set $u=\exp\left(-\frac{\lambda}{2}\{t-y_{MP}\}^2\right)$, from which I get
$$\int du =-\lambda\int t \exp\left(-\frac{\lambda}{2}\{t-y_{MP}\}^2\right)\;dt+\lambda y_{MP}\int \exp\left(-\frac{\lambda}{2}\{t-y_{MP}\}^2\right)\;dt$$
or
$$\begin{aligned}
\int t \exp\left(-\frac{\lambda}{2}\{t-y_{MP}\}^2\right)\;dt &= -\frac{1}{\lambda}\int du + y_{MP}\int \exp\left(-\frac{\lambda}{2}\{t-y_{MP}\}^2\right)\;dt\\
&= -\frac{1}{\lambda}\left[\exp\left(-\frac{\lambda}{2}\{t-y_{MP}\}^2\right)\right]^{\infty}_{-\infty} + y_{MP}\int \exp\left(-\frac{\lambda}{2}\{t-y_{MP}\}^2\right)\;dt\\
&= 0 + y_{MP}\int_{-\infty}^{\infty} \exp\left(-\frac{\lambda}{2}s^2\right)\;ds\\
&= y_{MP}\left(\frac{2\pi}{\lambda}\right)^{1/2}.
\end{aligned}$$
On the previous I used substitution $s=t-y_{MP}$. So now, if I have done everything correctly I have that the main integral is:

$$\begin{aligned} \int t \, p(t)\; dt &\propto
 y_{MP}\left(\frac{2\pi}{\lambda}\right)^{1/2}(2\pi)^{W/2}|\textbf{C}|^{-1/2}\\
 &= y_{MP}\left(\left(\frac{2\pi}{\beta-\beta^2\textbf{g}^T
 \left(\textbf{A}+\beta\textbf{g}\textbf{g}^T\right)^{-1}\textbf{g}}\right)^{1/2}
 (2\pi)^{W/2}|\textbf{A}+\beta\textbf{g}\textbf{g}^T|^{-1/2}\right)
 \end{aligned}.$$

This seems to be correct by looking at the results of the book. This isn't given explicitly, but in the book I use the author states that the corresponding variance (hinting I got something right) for $p(t)$ is:
$$\sigma_t^2 = \frac{1}{\beta-\beta^2\textbf{g}^T \left(\textbf{A}+\beta\textbf{g}\textbf{g}^T\right)^{-1}\textbf{g}}=\frac{1}{\lambda}.$$
As a follow up in the same problem, I needed to show that:
$$\sigma^2_t = \frac{1}{\lambda}=\frac1\beta+\textbf{g}^T\textbf{A}^{-1}\textbf{g},$$
which indeed is the case:
\begin{aligned}
\sigma^2_t &= \frac{1}{\beta-\beta^2\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}}\\
&= \frac{1}{\beta-\beta^2\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}}\times\frac{\textbf{g}^T(\textbf{I}+\beta\textbf{A}^{-1}\textbf{g}\textbf{g}^T)\textbf{g}}{\textbf{g}^T(\textbf{I}+\beta\textbf{A}^{-1}\textbf{g}\textbf{g}^T)\textbf{g}}\\
&= \frac{\textbf{g}^T\textbf{g}+\textbf{g}^T\beta\textbf{A}^{-1}\textbf{g}\textbf{g}^T\textbf{g}}{\beta\textbf{g}^T\textbf{g}+\beta^2\textbf{g}^T\textbf{A}^{-1}\textbf{g}\textbf{g}^T\textbf{g}-\beta^2\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T\textbf{g}-\beta^2\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T(\beta\textbf{A}^{-1}\textbf{g}\textbf{g}^T)\textbf{g}}\\
&=\frac{1+\textbf{g}^T\beta\textbf{A}^{-1}\textbf{g}}{\beta+\beta^2\textbf{g}^T\textbf{A}^{-1}\textbf{g}-\beta^2\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}-\beta^2\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T\beta\textbf{A}^{-1}\textbf{g}}\\
&=\frac{\frac1\beta+\textbf{g}^T\textbf{A}^{-1}\textbf{g}}{1+\beta\textbf{g}^T\textbf{A}^{-1}\textbf{g}-\beta\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}-\beta\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T\beta\textbf{A}^{-1}\textbf{g}},
\end{aligned}
so now we must have:
$$\beta\textbf{g}^T\textbf{A}^{-1}\textbf{g}-\beta\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}-\beta\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T\beta\textbf{A}^{-1}\textbf{g}=0$$
$$\textbf{g}^T\textbf{A}^{-1}\textbf{g}-\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}-\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T\beta\textbf{A}^{-1}\textbf{g}=0$$
$$\textbf{g}^T\textbf{A}^{-1}\textbf{g}-\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}=\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T\beta\textbf{A}^{-1}\textbf{g}$$
Next, I will denote: $\textbf{C}=(\textbf{A}+\beta\textbf{g}\textbf{g}^T)$
$$\textbf{g}^T\textbf{A}^{-1}\textbf{g}-\textbf{g}^T\textbf{C}^{-1}\textbf{g}=\beta\textbf{g}^T\textbf{C}^{-1}\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{g}$$
$$\textbf{g}^T\textbf{A}^{-1}\textbf{g}\textbf{g}^T(\textbf{g}\textbf{g}^T)^{-1}\textbf{C}-\textbf{g}^T\textbf{C}^{-1}\textbf{g}\textbf{g}^T(\textbf{g}\textbf{g}^T)^{-1}\textbf{C}=\beta\textbf{g}^T\textbf{C}^{-1}\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{g}\textbf{g}^T(\textbf{g}\textbf{g}^T)^{-1}\textbf{C}$$
$$\textbf{g}^T\textbf{A}^{-1}\textbf{C}-\textbf{g}^T=\beta\textbf{g}^T\textbf{C}^{-1}\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{C}$$
$$\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{C}-\textbf{g}\textbf{g}^T=\beta\textbf{g}\textbf{g}^T\textbf{C}^{-1}\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{C}$$
$$\textbf{C}(\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{C}-\textbf{C}(\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T=\beta\textbf{C}(\textbf{g}\textbf{g}^T)^{-1}\textbf{g}\textbf{g}^T\textbf{C}^{-1}\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{C}$$
$$\textbf{C}\textbf{A}^{-1}\textbf{C}-\textbf{C}=\beta\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{C}$$
$$(\textbf{A}+\beta\textbf{g}\textbf{g}^T)\textbf{A}^{-1}(\textbf{A}+\beta\textbf{g}\textbf{g}^T)-(\textbf{A}+\beta\textbf{g}\textbf{g}^T)=\beta\textbf{g}\textbf{g}^T\textbf{A}^{-1}(\textbf{A}+\beta\textbf{g}\textbf{g}^T)$$
$$(\textbf{A}+\beta\textbf{g}\textbf{g}^T)(\textbf{I}+\beta\textbf{A}^{-1}\textbf{g}\textbf{g}^T)-(\textbf{A}+\beta\textbf{g}\textbf{g}^T)=\beta\textbf{g}\textbf{g}^T\textbf{A}^{-1}(\textbf{A}+\beta\textbf{g}\textbf{g}^T)$$
$$(\textbf{A}+\beta\textbf{g}\textbf{g}^T)(\textbf{I}+\beta\textbf{A}^{-1}\textbf{g}\textbf{g}^T)-(\textbf{A}+\beta\textbf{g}\textbf{g}^T)=\beta(\textbf{g}\textbf{g}^T+\beta\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{g}\textbf{g}^T)$$
$$(\textbf{A}+\beta\textbf{g}\textbf{g}^T)(\beta\textbf{A}^{-1}\textbf{g}\textbf{g}^T)=\beta(\textbf{g}\textbf{g}^T+\beta\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{g}\textbf{g}^T)$$
$$\beta(\textbf{g}\textbf{g}^T+\beta\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{g}\textbf{g}^T)=\beta(\textbf{g}\textbf{g}^T+\beta\textbf{g}\textbf{g}^T\textbf{A}^{-1}\textbf{g}\textbf{g}^T).$$
In other words,
$$\sigma^2_t = \frac{1}{\beta-\beta^2\textbf{g}^T(\textbf{A}+\beta\textbf{g}\textbf{g}^T)^{-1}\textbf{g}}=\frac1\beta+\textbf{g}^T\textbf{A}^{-1}\textbf{g}.$$
Another update:
I tried also to compute the integral :
$$ \int_{-\infty}^{\infty} \, \int_{\mathbb{R}^W} \exp{\left(-\frac{\beta}{2}\left\{t-y_{MP}-\textbf{g}^T \textbf{v}\right\}^2-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)}\; d\textbf{v}\; dt,$$
first w.r.t $\textbf{v}$ and then w.r.t $t$ and then vice versa to check that both ways result in the same outcome. I was confused at start because I got:
$$\begin{aligned} I_{\textbf{v}, t}&=\int_{-\infty}^{\infty} \, \int_{\mathbb{R}^W} \exp{\left(-\frac{\beta}{2}\left\{t-y_{MP}-\textbf{g}^T \textbf{v}\right\}^2-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)}\; d\textbf{v}\; dt\\
&= (2\pi)^{W/2}(2\pi\sigma^2_t)^{1/2}|\textbf{A}+\beta\textbf{g}\textbf{g}^T|^{-1/2}
\end{aligned},$$
and:
$$\begin{aligned} I_{t, \textbf{v}}&=\int_{\mathbb{R}^W}\,\int_{-\infty}^{\infty} \exp{\left(-\frac{\beta}{2}\left\{t-y_{MP}-\textbf{g}^T \textbf{v}\right\}^2-\frac{1}{2}\textbf{v}^T \textbf{A}\textbf{v}\right)}\;dt\; d\textbf{v}\\
&= (2\pi)^{W/2}\left(\frac{2\pi}{\beta}\right)^{1/2}|\textbf{A}|^{-1/2}
\end{aligned}.$$
So now $I_{t, \textbf{v}}$ should equal $I_{\textbf{v}, t}$:
$$(2\pi)^{W/2}\left(\frac{2\pi}{\beta}\right)^{1/2}|\textbf{A}|^{-1/2}=(2\pi)^{W/2}(2\pi\sigma^2_t)^{1/2}|\textbf{A}+\beta\textbf{g}\textbf{g}^T|^{-1/2}$$
$$\left(\frac{2\pi}{\beta}\right)^{1/2}|\textbf{A}|^{-1/2}=(2\pi\sigma^2_t)^{1/2}|\textbf{A}+\beta\textbf{g}\textbf{g}^T|^{-1/2}$$
$$\left(\frac{2\pi}{\beta}\right)^{1/2}|\textbf{A}|^{-1/2}=\left[2\pi\left(\frac{1}{\beta}+\textbf{g}^T\textbf{A}^{-1}\textbf{g}\right)\right]^{1/2}|\textbf{A}+\beta\textbf{g}\textbf{g}^T|^{-1/2},$$
next I will square both sides:
$$\frac{2\pi}{\beta|\textbf{A}|}=\frac{2\pi\left(\frac{1}{\beta}+\textbf{g}^T\textbf{A}^{-1}\textbf{g}\right)}{|\textbf{A}+\beta\textbf{g}\textbf{g}^T|}$$
$$\frac{1}{|\textbf{A}|}=\frac{1+\beta\textbf{g}^T\textbf{A}^{-1}\textbf{g}}{|\textbf{A}+\beta\textbf{g}\textbf{g}^T|}.$$
This is where I thought something had gone wrong until I found out about the matrix determinant lemma making:
$$|\textbf{A}+\beta\textbf{g}\textbf{g}^T|=(1+\beta\textbf{g}^T\textbf{A}^{-1}\textbf{g})|\textbf{A}|,$$
that is:
$$\frac{1}{|\textbf{A}|}=\frac{1+\beta\textbf{g}^T\textbf{A}^{-1}\textbf{g}}{(1+\beta\textbf{g}^T\textbf{A}^{-1}\textbf{g})|\textbf{A}|}$$
$$\frac{1}{|\textbf{A}|}=\frac{1}{|\textbf{A}|},$$
so indeed $I_{t, \textbf{v}}=I_{\textbf{v}, t}\;\;\;\blacksquare$


text:
Q: Creating Unix local groups for AD users I am implementing LDAP authentication against Samba 4 AD for admins login to our Linux servers.
I successfully configured PAM with libpam-ldapd and libnss_ldapd with auto creation of the home directories of the users. I am facing now the problem that users have their mapped samba gidNumber as primary group which do not exist locally any way. The current situation is the /home directory looks like this (notice the users primary group):
drwxr-xr-x 2 user 1005 4096 Okt 13 16:01 user/

The problem with the sssd is that it requires a domain join to Samba 4 AD, which is not the case now and will not be at all. Since we have several hundreds of these Ganeti VM's, and most of them are very critical!
The admin login to these machines is allowed for admins (member of a specific AD group) and who have a signed SSH public key.
What I was asking for is to rename the group according to the user and automatically create these groups locally. I read somewhere it should be possible to rename them by using wbinfo and rip map. But I have no idea how to do this. Creating the groups locally is secondary, since I will create an admin group and add them all to it.
The main question is:
How could the users primary groups be renamed from gidNumber to uid?
Thanks a lot.

A: I found the answer, I just didn't find the time to post it. Here is a complete how to implement password authentication for users against samba 4 AD:

*

*install libnss-ldapd

*get the certificate of the samba 4 AD and add it to your CA

*update-ca-certificates

*check with ldapsearch the connectivity

*pam-auth-update and select the services that should use LDAP

*use create home on login if needed

*open /etc/nslcd.conf and modify it as follows:
# /etc/nslcd.conf

# nslcd configuration file. See nslcd.conf(5)
# for details.

# The user and group nslcd should run as.
uid nslcd
gid nslcd

# The location at which the LDAP server(s) should be reachable.
uri ldaps://dc.example.com:636/

# The search base that will be used for all queries.
base DC=example,DC=com

# The LDAP protocol version to use.
#ldap_version 3

# The DN to bind with for normal lookups.
#binddn nslcd
binddn CN=binduser,CN=Users,DC=example,DC=com
bindpw yourpassword

# The DN used for password modifications by root.
#rootpwmoddn cn=admin,dc=example,dc=com

# SSL options
#ssl start_tls
#tls_reqcert never
ssl on
tls_cacertfile /etc/ssl/certs/ca.pem
#tls_cacertfile /etc/ssl/certs/ca-certificates.crt

# The search scope.
scope sub

filter passwd (&(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))
map    passwd   uid                 sAMAccountName
map    passwd   homeDirectory       unixHomeDirectory
map    passwd   gecos               displayName
filter passwd (&(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))
map    shadow   uid                 sAMAccountName
map    shadow   shadowLastChange    pwdLastSet
filter passwd (&(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))
map    group    cn                  sAMAccountName
map    group    gidNumber           uidNumber
map    group    memberUid           sAMAccountName

*test the login and you will see:
user@test [Home]:~$  ll /home/
drwxr-xr-x  3 user user 4096 May 20 01:41 user/
user@test [Home]:~$
user@test [Home]:~$
user@test [Home]:~$  ll /home/user/
total 28
drwxr-xr-x 3 user user 4096 May 20 01:41 ./
drwxr-xr-x 4 root root 4096 May 19 23:35 ../
-rw-r--r-- 1 user user  220 May 19 23:35 .bash_logout
-rw-r--r-- 1 user user 3771 May 19 23:35 .bashrc
drwx------ 2 user user 4096 May 19 23:35 .cache/
-rw-r--r-- 1 user user  655 May 19 23:35 .profile
-rw------- 1 user user  568 May 20 01:41 .viminfo

For the public key authentication either you copy the public keys of all users to all servers and every new user as well, which is hard to achieve and very error-prone or you just sign all users ssh public key and all hosts public keys as well, which sounds difficult as well.
I created a users CA and hosts CA and deployed them to all servers and signed all hosts public keys with puppet, users should be responsible for signing their keys, maybe place the users CA in a web app and use curl.


text:
Q: associativity of parentheses This msdn link says that '(' and ')' has left to right associativity.
How does that make sense? Can someone give me a example?

A: In formal grammars an operator with left-to-right precedence is left recursive.  So with binary addition:
S -> E
E -> E + a
E -> a

So the tree would look like:
    S
    |
    E
    |
  E + a
  |
E + a
|
a

As you can see the first two a's are added before the second two.
For a right-associative operator, your grammar would contain right-recursion.  So with binary exponentiation:
S -> E
E -> a ** E
E -> a

Subsequently your parse tree would look like:
    S
    |
    E
    |
  a ** E
       |
     a ** E
          |
          a

As you can see the last two a's are exponentiated, first, and the result of that is the power of the first a (this is the proper associativity for exponentiation, by the way).
For ternary and greater operators the same pattern is applied, the recursive rule is either the left-most nonterminal or the right-most nonterminal.  In the case of unary operators, though, whether or not it's left- or right-recursive depends on whether or not the nonterminal s on the left or right, respectively.  In the case of ( E ) there is a terminal on either side, and the nonterminal, although recursive, is neither left- nor right-recursive from a grammatical point of view so I think the MSDN article has arbitrarily declared it to be "left to right."
The associativity of parenthesis has no bearing on the fact that d is evaluated prior to a+b+c in d+(a+b+c) and has no bearing on the associativity of a+b+c as well, so I have no idea what the other Jared is talking about.

A: What is unclear?  They come in a pair whenever you have a ( you will have a ).  Once inside of them you work the arythmatic from left to right so if you have d+(a+b+c) you will do a+b then the sum of a+b added to c then the total sum of a,b,c added d


text:
Q: jScrollTo bugging out in IE7 + 8, works fine in FF and IE9 I'm using the jScrollTo plugin to create this website [removed]
Sadly, I've spent a few hours trying to debug why it's not working in IE7/8, I've tried many things but can't figure it out.
Here's a demo of it when it works in IE7/8: http://www.queness.com/resources/html/scroll/horizontal.html
Help! :( Sorry if my post isn't formatted correctly, I'm new to StackOverflow.
Solution Below
The  jQuery
$(document).ready(function() {
$('a.panel').click(function () {

    $('a.panel').removeClass('selected');
    $(this).addClass('selected');

    current = $(this);
        //$('#wrapper').scrollTo('#item1', { margin: true});
    $('#wrapper').scrollTo($(this).attr('href'), 800);
    //
    return false;
});

$(window).resize(function () {
    resizePanel();
});

});
The error round abouts:
SCRIPT438: Object doesn't support this property or method

$(document).ready(function() {

$('a.panel').click(function () {

    $('a.panel').removeClass('selected');
    $(this).addClass('selected');
    **current = $(this);**
    $('#wrapper').scrollTo($(this).attr('href'), 1000);
    //
    return false;
});

$(window).resize(function () {
    resizePanel();
});

});
THE SOLUTION
    $(document).ready(function() {

$('a.panel').click(function () {

    $('a.panel').removeClass('selected');
    $(this).addClass('selected');
            *current = $(this); // remove this*
    **var selected = $(this); //add this new line**
    $('#wrapper').scrollTo($(this).attr('href'), 1000);
    //
    return false;
});

A: Move your first <script> tag below the includes of dependent scripts such as jQuery and scrollTo.


text:
Q: how to identify django-nonrel/django fork? I'm contributing on a 3rd party Django package and trying to make it compatible with django-nonrel. The only issue really is that a model contains a ManyToManyField using "through" attribute, which is not supported by nonrel. So I want to add a condition, which only adds the field to the model if the Django framework is NOT nonrel.
How can I identify that the Django framework is nonrel? I don't necessarily want to depend on it being GAE, Mongo or some other usage. Just plain nonrel.

A: This is the solution, courtesy of @aburgel:
from django.db import connection
if connection.features.supports_joins:
   # sql stuff....
   pass
else:
   # NoSQL, i.e., nonrel stuff
   pass


text:
Q: bashrc export path problem I opened my .bashrc file using nano .bashrc in terminal. After that, at the end of the .bashrc file I added following lines
export PATH= "$PATH:$HOME/moltemplate/moltemplate"
export PATH= "$PATH:$HOME/moltemplate/moltemplate/scripts"

after that, I restarted my terminal and I am getting like in the figure
Now I don't understand in which path my .bashrc file is because I can't see anything .bashrc file by using ls -a command.

A: .bashrc file will always be in your home folder which is in ~/.bashrc path
Just add following to ~/.bashrc and do source ~/.bashrc
PATH="$PATH:$HOME/moltemplate/moltemplate"

You don't need to add export in .bashrc and ~ in path means home folder of the user running command, .bashrc will always be in the root of your home folder. You can also use $HOME instead if ~ which will also point to your home folder.
You can't have white space after the = sign and you need to use "" type of quotes instead of "" you used

A: *

*export sets a flag on a variable in the current context, making it available to sub-shells. This means it only has to be exported once, not every time it's changed.

*Unlike most other languages, whitespace is used to separate what are misleadingly called "words". So PATH= "$PATH:$HOME/moltemplate/moltemplate"   is two words, but a variable assignment must be a single word. If you remove the space the assignment works, otherwise each of those words become a separate parameter to export. And since a colon-separated set of paths is definitely not a valid variable name, you get the "not a valid identifier" error.


text:
Q: Bi-annual events created using Graph API/SDK missing first instance When I create the following event using the graph SDK, the first instance of the recurring event isn't created until May 4th, 2021:
var tmpEvent = new Microsoft.Graph.Event
        {
            Start = new Microsoft.Graph.DateTimeTimeZone
            {
                DateTime = "2020-05-04T16:00:00",
                TimeZone = "Central Standard Time"
            },
            End = new Microsoft.Graph.DateTimeTimeZone
            {
                DateTime = "2020-05-04T17:00:00",
                TimeZone = "Central Standard Time"
            },
            Subject = "Bi-Annual Event",
            Body = new Microsoft.Graph.ItemBody
            {
                Content = "Trying to make a bi-annual event",
                ContentType = Microsoft.Graph.BodyType.Text
            },
            Attendees = new List<Microsoft.Graph.Attendee>{
                new Microsoft.Graph.Attendee
                    {
                        EmailAddress = new Microsoft.Graph.EmailAddress
                        {
                            Address = "test.email.123@someTestDomain.org"
                        },
                        Type = Microsoft.Graph.AttendeeType.Required
                    }
                },
            Location = new Microsoft.Graph.Location
            {
                DisplayName = "the office"
            },
            Recurrence = new PatternedRecurrence
            {
                Pattern = new RecurrencePattern
                {
                    DayOfMonth = 4,
                    Interval = 2,
                    Month = 5,
                    Type = RecurrencePatternType.AbsoluteYearly
                },
                Range = new RecurrenceRange
                {
                    StartDate = new Date(2020, 5, 4),
                    Type = RecurrenceRangeType.NoEnd
                }
            }
        };

        var graphClient = await MicrosoftAuthenticationProvider.GetGraphClient(CALENDAR_CLIENT_ID, CALENDAR_CLIENT_SECRET, CALENDAR_REDIRECT_URI, CALENDAR_ACCESS_SCOPES, RefreshToken);

        var savedEvent = await graphClient.Me.Events
                            .Request()
                            .AddAsync(tmpEvent);

Here is what the recurrence looks like in Outlook:
enter image description here
When I resave the recurrence/series in Outlook, the event appears (correctly) on May 4th, 2020.
Is this a bug with the graph SDK?
UPDATE:
Here is the body request I am sending:
{
  "OriginalStartTimeZone": null,
  "OriginalEndTimeZone": null,
  "ResponseStatus": null,
  "ICalUId": null,
  "ReminderMinutesBeforeStart": null,
  "IsReminderOn": null,
  "HasAttachments": null,
  "Subject": "Bi-Annual Event",
  "Body": {
    "ContentType": 0,
    "Content": "Trying to make a bi-annual event",
    "AdditionalData": null,
    "ODataType": "microsoft.graph.itemBody"
  },
  "BodyPreview": null,
  "Importance": null,
  "Sensitivity": null,
  "Start": {
    "DateTime": "2020-05-04T16:00:00",
    "TimeZone": "Central Standard Time",
    "AdditionalData": null,
    "ODataType": "microsoft.graph.dateTimeTimeZone"
  },
  "OriginalStart": null,
  "End": {
    "DateTime": "2020-05-04T17:00:00",
    "TimeZone": "Central Standard Time",
    "AdditionalData": null,
    "ODataType": "microsoft.graph.dateTimeTimeZone"
  },
  "Location": {
    "DisplayName": "the office",
    "LocationEmailAddress": null,
    "Address": null,
    "LocationUri": null,
    "Coordinates": null,
    "LocationType": null,
    "UniqueId": null,
    "UniqueIdType": null,
    "AdditionalData": null,
    "ODataType": "microsoft.graph.location"
  },
  "Locations": null,
  "IsAllDay": null,
  "IsCancelled": null,
  "IsOrganizer": null,
  "Recurrence": {
    "Pattern": {
      "Type": 4,
      "Interval": 2,
      "Month": 5,
      "DayOfMonth": 4,
      "DaysOfWeek": null,
      "FirstDayOfWeek": null,
      "Index": null,
      "AdditionalData": null,
      "ODataType": "microsoft.graph.recurrencePattern"
    },
    "Range": {
      "Type": 1,
      "StartDate": {
        "Year": 2020,
        "Month": 5,
        "Day": 4
      },
      "EndDate": null,
      "RecurrenceTimeZone": null,
      "NumberOfOccurrences": null,
      "AdditionalData": null,
      "ODataType": "microsoft.graph.recurrenceRange"
    },
    "AdditionalData": null,
    "ODataType": "microsoft.graph.patternedRecurrence"
  },
  "ResponseRequested": null,
  "SeriesMasterId": null,
  "ShowAs": null,
  "Type": null,
  "Attendees": [
    {
      "Status": null,
      "Type": 0,
      "EmailAddress": {
        "Name": null,
        "Address": "test.email.123@someTestDomain.org",
        "AdditionalData": null,
        "ODataType": "microsoft.graph.emailAddress"
      },
      "AdditionalData": null,
      "ODataType": "microsoft.graph.attendee"
    }
  ],
  "Organizer": null,
  "WebLink": null,
  "OnlineMeetingUrl": null,
  "IsOnlineMeeting": null,
  "OnlineMeetingProvider": null,
  "OnlineMeeting": null,
  "Attachments": null,
  "SingleValueExtendedProperties": null,
  "MultiValueExtendedProperties": null,
  "Calendar": null,
  "Instances": null,
  "Extensions": null,
  "CreatedDateTime": null,
  "LastModifiedDateTime": null,
  "ChangeKey": null,
  "Categories": null,
  "Id": null,
  "ODataType": "microsoft.graph.event",
  "AdditionalData": null
}

Does your request look different?
Also, I noticed this is only an issue on the desktop client, the events appear normally on the web client


text:
Q: Unique id for a file in C# I need to generate a unique id for file sizes of upto 200-300MB. The condition is that the algo should be quick, it should not take much time. I am selecting the files from a desktop and calculation a hash value as such:
HMACSHA256 myhmacsha256 = new HMACSHA256(key);
byte[] hashValue = myhmacsha256.ComputeHash(fileStream);

filestream is a handle to the file to read content from it. This method is going to take a lot of time for obvious reasons.
Does windows generate a key for a file for its own book keeping that I could directly use ?
Is there any other way to identify if the file is same, instead of matching file name which is not very foolproof.

A: MD5.Create().ComputeHash(fileStream);

Alternatively, I'd suggest looking at this rather similar question.

A: How about generating a hash from the info that's readily available from the file itself? i.e. concatenate :

*

*File Name

*File Size

*Created Date

*Last Modified Date

and create your own?

A: When you compute hashes and compare them, it would require both files to completely go through. My suggestion is to first check the file sizes, if they are identical and then go through the files byte by byte.

A: If you want a "quick and dirty" check, I would suggest looking at CRC-32. It is extremely fast (the algorithm simply involves doing XOR with table lookups), and if you aren't too concerned about collision resistance, a combination of the file size and the CRC-32 checksum over the file data should be adequate. 28.5 bits are required to represent the file size (that gets you to 379M bytes), which means you get a checksum value of effectively just over 60 bits. I would use a 64-bit quantity to store the file size, for future proofing, but 32 bits would work too in your scenario.
If collision resistance is a consideration, then you pretty much have to use one of the tried-and-true-yet-unbroken cryptographic hash algorithms. I would still concur with what Devils child wrote and also include the file size as a separate (readily accessible) part of the hash, however; if the sizes don't match, there is no chance that the file content can be the same, so in that case the computationally intensive hash calculation can be skipped.


text:
Q: ${\int\int\int}_B dxdydz$ where $B$ is the region delimited by $x²+y²+z² = 4$ and $x²+y²=3z$ Take the following integral over the specified region:
${\int\int\int}_B dxdydz$ where $B$ is the region delimited by $x²+y²+z² = 4$ and $x²+y²=3z$
(i'm answering my own question because I was writing it and then found out my error, so I didn't want to erase all my work)

A: This is the intersection betweet the paraboloid $z = \frac{x²+y²}{3}$ and the sphere $x²+y²+z²=4$. Their intersection forms a circle with radius $\sqrt{3}$. Therefore we just need to find the height of the region by integrating with respect to $z$, from the paraboloid to the sphere:
$$\int_{\frac{x²+y²}{3}}^{\sqrt{4-x²-y²}}dz = \sqrt(4-x²-y²)-\frac{x²+y²}{3}$$
then we need to integrate this height all over the circle with radius $\sqrt{3}$, which is our region $B_1$:
$${\int\int}_{B_1}\sqrt(4-x²-y²)-\frac{x²+y²}{3}dxdy$$
So to make this easier, I'm gonna integrate in polar coordinates by doing the substitution $x = p\cos(t), y= p\sin(t)$ where $t$ goes from $0$ to $2\pi$ because our circle is centered at the origin, and $p$ goes from $0$ to $\sqrt{3}$. The jacobian determinant of the transformation is $p$, so our integral becomes:
$$\int_0^{2\pi}\int_0^{\sqrt{3}}\left(\sqrt{4-p²}-\frac{1}{3}p²\right)p \ dp \ dt$$
$$\int_0^{2\pi}\int_0^{\sqrt{3}}\left(\sqrt{4-p²}\ p-\frac{1}{3}p^3\right) \ dp \ dt = $$
$$-\frac{1}{2}\int_0^{2\pi}\int_0^{\sqrt{3}}\sqrt{4-p²}\ (-2p) \ dp \ dt -
\int_0^{2\pi}\int_0^{\sqrt{3}}\frac{1}{3}p^3 \ dp \ dt = $$
$$-\frac{1}{2}\int_0^{2\pi}\int_{4}^{1}\sqrt{u} \ du - \int_0^{2\pi}\frac{\sqrt{3}^4}{12}dt = $$
$$\frac{1}{2}\int_0^{2\pi}\int_{1}^{4}\sqrt{u} \ du - \int_0^{2\pi}\frac{9}{12}dt = $$
$$\frac{1}{2}\int_0^{2\pi}\frac{2}{3}u^{3/2} \ du - \frac{3}{4}\int_0^{2\pi}dt = $$
$$\frac{1}{3}\int_0^{2\pi}(4)^{3/2}-1^{3/2} \ du - \frac{3}{4}2\pi = $$
$$\frac{7}{3}2\pi - \frac{3}{4}2\pi  = \frac{19}{12}2\pi = \frac{19\pi}{6}$$


text:
Q: How to use jQuery plugins with Aurelia How do I use jquery plugins with Aurelia? In particular, I am trying to use Notify.js.
It's in my package.json under jspm -> dependencies as follows:
"notifyjs-browser": "npm:notifyjs-browser@^0.4.2"
And I have tried to import it as follows:
import { notify } from 'notifyjs-browser';
And use it like so:
$.notify("Test 123", "error");
However, I get this error message:
$.notify is not a function
I assume I will have the same issue with any jQuery plugins in Aurelia. How do I solve this?
UPDATE: It appears that the issue may only exist when using a JSPM setup as I have, as both @peinearydevelopment's answer and another answer I received for this same question on Aurelia's "discourse" page both insist notifyjs works fine with Aurelia CLI. It would be really great if I don't have to rewrite everything just to change from JSPM to Aurelia CLI. Can anyone help figure this out? Moving to Aurelia CLI seems like a lot of work for this small problem.

A: Without having your exact setup, it is hard to give you a full answer. The reason for the error you are getting is due to the fact that you haven't imported jQuery. Without that, Aurelia, or more specifically its resource loader won't pull that script into your application, hence notify not being a 'function' as it is an extension of the jQuery prototype.
I know it is a bit of a different setup, but here is how I got that plugin to work.
I created a new project with the Aurelia cli.
au new au-notifyjs
I then installed the desired packages
au install jquery notifyjs-browser
This will install the npm packages, update your package.json file and update the aurelia.json file with proper references to the js files as well as notify's css file.
I then updated the app.js file to test that it works to the following:
import 'jquery';
import 'notifyjs-browser';

export class App {
  constructor() {
    this.message = 'Hello World!';
  }

  attached() {
    $.notify('Test 123', 'error');
  }
}

I ran the app and saw the notification appear in the upper right hand corner of the screen. Full code project can be found here. Hope this helps!

A: I couldn't get Notify.js to work under a JSPM setup, so I decided to find something else instead. I opted for the aurelia-notification plugin and that's working fine. I would still love to know what the issue is getting it to work under JSPM, because there are likely to be other libraries with the same problem. So if anyone has the answer, please do share.


text:
Q: how to keep data when testing insert to mongodb collection with spring inside docker? i have following test in spring boot 2.7.7 with mongodb as a database sevices
// UserController.java
    @GetMapping(value = "admin", produces = MediaType.APPLICATION_JSON_VALUE)
    public String getAdmin () {
        JSONObject report = new JSONObject();
        String dataAdmin = userRepo.findByUsername("admin");
        if(dataAdmin == null) {
            User myadmin = new User();
            myadmin.setUsername("admin");
            myadmin.setFirstname("admin");
            myadmin.setLastname("admin");
            myadmin.setEmail("admin@admin");
            myadmin.setRole("admin");
            userRepo.save(myadmin);
            report.put("message", "admin generated");
        } else {
            report.put("message", "admin only generated once");
        }
        return report.toString();
    }

// AppTests.java
    @Test
    @DisplayName("generate admin")
    void isertAdmin() throws IOException {
        userRepo.deleteAll();
        URL url = new URL("http://"+ addrHost +":8080/users/admin");
        URLConnection conn = url.openConnection();
        InputStream in = conn.getInputStream();
        String encoding = conn.getContentEncoding();
        encoding = encoding == null ? "UTF-8" : encoding;
        String body = IOUtils.toString(in, encoding);
        MatcherAssert.assertThat(body, CoreMatchers.containsString("admin generated"));
    }

    @Test
    @DisplayName("generate failed")
    void isertAdminTwice() throws IOException {
        URL url = new URL("http://"+ addrHost +":8080/users/admin");
        URLConnection conn = url.openConnection();
        InputStream in = conn.getInputStream();
        String encoding = conn.getContentEncoding();
        encoding = encoding == null ? "UTF-8" : encoding;
        String body = IOUtils.toString(in, encoding);
        MatcherAssert.assertThat(body, CoreMatchers.containsString("admin only generated once"));
    }

# docker-compose.yml
  db:
    container_name: database
    image: mongo
    restart: always
    environment:
      MONGO_INITDB_DATABASE: mydb

first testing is to generate new record data admin. I need to make sure there's no any previous document that contains the same record, so i decided to clean the collection before generate admin data when visiting users/admin.
the secound testing is almost similar with the first testing, but it doesnt clean the collection, so its designed to generate error report because the admin record already exist.
Above testing is running as expected when i run the program outside docker. But, when i run inside the docker, the second test failed because the data has been filled from my first test is not exist. In second test display error with actual result equals to first test.


text:
Q: Error parsing data org.json.JSONException: Value  String cannot be converted to JSONObject I know that this question has been answered so many times. I have tried different links but I am unable to solve this problem.
Java code:
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("Username",u));
params.add(new BasicNameValuePair("Email",e));
params.add(new BasicNameValuePair("Password", p));
params.add(new BasicNameValuePair("Confirmpassword", cp));
JSONObject json = jsonParser.makeHttpRequest(url_logindetails, "POST", params);

PHP code:

$response = array();
// check for required fields
if (isset($_POST['Username']) || isset($_POST['Email'])|| isset($_POST['Password']) ||isset($_POST['Confirmpassword']) ) {

  $Username = $_POST['Username'];
  $Email = $_POST['Email'];
  $Password = $_POST['Password'];
  $Confirmpassword = $_POST['Confirmpassword'];

  // include db connect class
  require_once __DIR__ . '/db_connect.php';
  // connecting to db
  db = new DB_CONNECT();
  // mysql inserting a new row
  $result = mysql_query("INSERT INTO login(UserName, email,password,confirmpassword VALUES('$Username','$Email','$Password','$Confirmpassword')");
  // check if row inserted or not

  if ($result) {
    // successfully inserted into database
    $response["success"] = 1;
    $response["message"] = "Company successfully added.";
    // echoing JSON response
    echo json_encode($response);
  } else {
    // failed to insert row
    $response["success"] = 0;
    $response["message"] = "Oops! An error occurred.";
    // echoing JSON response
    echo json_encode($response);
  }
} else {
  // required field is missing
  $response["success"] = 0;
  $response["message"] = "Required field(s) is missing";
  // echoing JSON response
  echo json_encode($response);
}
?>

A: BasicNameValuePair("Username",u) its not right
BasicNameValuePir("Username")


text:
Q: Oracle ODBC define variable [Oracle][ODBC][Ora]ORA-00900: invalid SQL statement I am using Oracle ODBC driver and want to dynamically pass variables. This is how my query looks like:
define val = 'Test';
select * from Table where Name = '&val'

While this query runs fine in Oracle SQL Developer, I think I am not writing the query right for ODBC driver to execute right. Any suggestions?
from ODBC logs:
EXIT  SQLExecDirectW  with return code -1 (SQL_ERROR)
"define val = 'Test';\ aselect * from Table where Name = '&val';\ 0"
DIAG [42000] [Oracle][ODBC][Ora]ORA-00900: invalid SQL statement

A: DEFINE is valid in SQLPlus and SQLDeveloper, but it's not a valid PL/SQL statement.
In PL/SQL you'd do something like
DECLARE
  val   VARCHAR2(25) := 'Test';
  aRow  SOME_TABLE%ROWTYPE;
BEGIN
  SELECT *
    INTO aRow
    FROM SOME_TABLE
    WHERE NAME = val;
END;

Best of luck.


text:
Q: Mongo ids leads to scary URLs This might sound like a trivial question, but it is rather important for consumer facing apps
What is the easiest way and most scalable way to map the scary mongo id onto a id that is friendly?

xx.com/posts/4d371056183b5e09b20001f9
TO
xx.com/posts/a

M

A: Unfortunately, the key macro has been removed from mongo.  For custom ids,
users must now override the _id field.
class Band
  include Mongoid::Document
  field :_id, type: String, default: ->{ name }
end

A: Here's a great gem that I've been using to successfully answer this problem: Mongoid-Slug
https://github.com/digitalplaywright/mongoid-slug.
It provides a nice interface for adding this feature across multiple models. If you'd rather roll your own, at least check out their implementation for some ideas. If you're going this route, look into the Stringex gem, https://github.com/rsl/stringex, and acts_as_url library within. That will help you get the nice dash-between-url slugs.

A: You can create a composite key in mongoid to replace the default id using the key macro:
class Person
  include Mongoid::Document
  field :first_name
  field :last_name
  key :first_name, :last_name
end

person = Person.new(:first_name => "Syd", :last_name => "Vicious")
person.id # returns "syd-vicious"

If you don't like this way to do it, check this gem: https://github.com/hakanensari/mongoid-slug

A: Define a friendly unique field (like a slug) on your collection, index it, on your model, define to_param to return it:
def to_param
  slug
end

Then in your finders, find by slug rather than ID:
@post = Post.where(:slug => params[:id].to_s).first

This will let you treat slugs as your effective PK for the purposes of resource interaction, and they're a lot prettier.


text:
Q: Converting StreamListener with headers to Functional Model Because @EnableBinding and @StreamListener are deprecated, I need to migrate existing code to the new model, however I could not find any information on whether the argument mapping available in Spring Cloud Stream is still supported and/or any clean workarounds.
My original method:
@StreamListener("mysource)
public void processMessage(byte[] rawMessage, @Header(required = false, value = KafkaHeaders.RECEIVED_MESSAGE_KEY) byte[] rawKey) {
    processMessage(rawMessage, rawKey);
}

I managed to convert this to work as follows:
@Bean(name = "mysource")
public Consumer<Message<?>> mySource() {
    return message -> {
    byte[] rawMessage = message.getPayload().toString().getBytes();
    byte[] rawKey = (byte[]) message.getHeaders().get("kafka_receivedMessageKey");
        processMessage(rawMessage, rawKey);
    };
}

However, what I would prefer is one that maximizes framework support with respect to argument mapping and/or automatic type conversions.
I attempted:
@Bean(name = "mysource")
public BiConsumer<Message<byte[]>, MessageHeaders> mySource() {
    return (message, headers) -> {
        byte[] rawMessage = message.getPayload();
        byte[] rawKey = (byte[]) headers.get("kafka_receivedMessageKey");
        processMessage(rawMessage, rawKey);
    };
}

But this gives an error at startup: FunctionConfiguration$FunctionBindingRegistrar.afterPropertiesSet - The function definition 'mysource' is not valid. The referenced function bean or one of its components does not exist
I'm also aware that along with Supplier and Consumer, Function is also available, but I'm not sure how to use a Function in this case instead of a BiConsumer or if it's possible, so looking for examples on how to do this type of migration seamlessly and elegantly with respecting to consuming and producing messages plus headers from/to Kafka.


text:
Q: WFS typescript/angular 4 Is there a WFS library that will work with typescript or angular 4
I would like the access a WFS server without showing a Map on the page so I dont think openlayers will work for me.


text:
Q: Android Room Entities: Is it possible to ignore fields by default? By default, Room creates a column for each field that is defined in the entity. If an entity has fields that I don't want to persist, I have to use the @Ignore annotation.
This poses a problem with inheritance. Annotating all the unwanted fields from a base class becomes unfeasible at a certain point, especially if you have to make your own versions of complex stock objects only to ignore the fields.
Currently, I am using interfaces instead of inheritance to work around that problem, but I would prefer to have a base class for my Room objects.
Do you know a way to ignore fields by default, so I can rather De-Ignore the desired fields instead of the other way around? Preferably in Kotlin?
Edit:
I want to build a treeview of different room entities and it would be nice to have my treeview item as a base class for all of them. But the treeview item implements a lot of stuff, it is not practical to customize all of that just for @Ignore tags. There are workarounds, but i would need less code if i do it this way.

A: You can use @Ignore on your base classes as well, for instance:
open class MyBaseClass{
    @Ignore
    open var somethingBasic: Int = 0
}

@Entity(...)
class A : MyBaseClass{
    var name: String? = null
}

@Entity(...)
class B : MyBaseClass{
    var type: Int = 0
}

But be careful about this because using a base class for different tables is a bit abnormal and it's able to break all your tables somewhere (take migrations as an example). I suggest to take a deeper look on your structure and try to stay away from this :D


text:
Q: Why was the TARDIS's broken slab left in the crack? The Doctor grabbed the broken slab of the TARDIS as he put his hand into the crack. Why did this broken piece come into the hands of the Doctor? Is that a piece of TARDİS coming from future ?
(0.30-0.50 in video)

A: He examines the crack and finds a fragment of broken TARDIS inside.
This indicates that the cracks in time were going to be caused by the destruction of the TARDIS.
The destruction will happen in the Doctor's future, but the cracks appear throughout time, and so are seen in the past.


text:
Q: Change (or add) id name using url parameters I need to change or create a div from an url parameters

www.example.com?change=newdiv

Is it possible to do this with js?

A: yes you can do it like that :) :

      var url_string =   window.location.href; //window.location.href
var url = new URL(url_string);
var c = url.searchParams.get("change");
var element = document.getElementsByClassName("myclass");
element[0].setAttribute("id",c);

A: Basically you need to create new URL property using https, otherwise you will get a

TypeError: www.example.com is not a valid URL.

After that get the search parameter change and create a div where to set the id

const url = new URL('https://www.example.com?change=newdiv');
const changeParamValue = url.searchParams.get("change");
console.log("param value: " + changeParamValue)

let newDiv = document.createElement("div");
newDiv.setAttribute("id", changeParamValue);

console.log(newDiv)


text:
Q: How to remove or prevent escape slashes from json-file data in azure logic app workflow Situation
I'm using Azure Logic App to do the following steps:

*

*Load/read a JSON file from blob storage. This file is created and written in R, using the toJSON function fromt JSONlite package

*Get de file content from this JSON file

*Convert it to a JSON format (using expression json())

*Insert the converted output into a Azure Table Storage

Please look at the screenshot for this workflow
azure workflow
I've created a JSON-file in R (using the JSONlite package). When printed in the R console, it looks fine:
{"PartitionKey":"pdf","RowKey":"robject)test","nr":"24330087","status":true}

This is the 'formatting' I want. When in this format, it inserts smoothly with logic app into the azure table storages.
Problem
But when I write the JSON-file above to Azure Blob, and use this file as input in a logic app workflow, these escape slashes cause problems
The file from the blob storage isn't interpreted by logic app in the desired format (without escape slashed) It includes the escape slashes (). And I think this causes the problems in logic apps. I pasted a hardcoded format without these slashes. And this worked. But hard coding isn't an option here.
Below the format the logic app 'json()' expression makes of it. It includes the dreaded escapes.
[
  "{\"PartitionKey\":\"pdf\",\"RowKey\":\"coolblue_factuur_1744212700.pdf\",\"kvknr\":\"24330087\",\"active_status\":true}"
]

And then this Error occurs:
{
  "odata.error": {
    "code": "InvalidInput",
    "message": {
  "lang": "en-US",
  "value": "An error occurred while processing this request.\nRequestId:xxxx\nTime:2019-11-20T09:02:46.6051827Z"
}
  }
}

After some online research, it looks like Logic App is having difficulty with the escape slashes () and the dubble quotes it escapes ("). So all these (\") escapes are choking the flow.
Question
How to deal with \" (escape slashes?). All I want is that logic app can correctly read the JSON-file from blob storage, convert it and instert the data into the table storage.
So ideally: convert the JSON file from blob storage into a format without escape slashes. I tried to pre process this in R, but this did not work.
Extra info
Below you can find the steps I took in logic app:
The JSON file uploaded (and fetched) from blob storage
{
"headers": {
    "Pragma": "no-cache",
    "Transfer-Encoding": "chunked",
    "Retry-After": "15",
    "Vary": "Accept-Encoding",
    "x-ms-request-id": "xxxx",
    "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
    "X-Content-Type-Options": "nosniff",
    "X-Frame-Options": "DENY",
    "Timing-Allow-Origin": "*",
    "x-ms-apihub-cached-response": "true",
    "Cache-Control": "no-store, no-cache",
    "Date": "Wed, 20 Nov 2019 09:09:52 GMT",
    "Location": "https://[location url]",
    "Set-Cookie": "[cookieset]",
    "Content-Type": "application/json",
    "Expires": "-1",
    "Content-Length": "452"
},
"body": {
    "Id": "xyz",
    "Name": "robjecttest_parameters_db.json",
    "DisplayName": "robjecttest_parameters_db.json",
    "Path": "/path/robjecttest_parameters_db.json",
    "LastModified": "2019-11-20T09:09:39Z",
    "Size": 95,
    "MediaType": "application/octet-stream",
    "IsFolder": false,
    "ETag": "\"[etag]\"",
    "FileLocator": "[filelocations]",
    "LastModifiedBy": null
}
}

From the headers, the content type is 'JSON'. But the body (which is the data I want) it is 'octet-stream').
After a 'get filecontent' action:
{
  "$content-type": "application/octet-stream",
  "$content": "[content]"
}

Next step is to convert/cast the 'body-data' to a JSON format. Using the expression & dynamic content from logic APP
json(body('Get_blob_content'))

Use this 'output' as an entity to insert into the table storage.

A: You just need to replace the \" with " by the expression below:
replace(string(body('Get_blob_content')), '\"', '"')

And then we can use json() to convert it.
Update:
In your json data to insert to table storage, the data in red box below cause the problem

You can't insert into it with the second level of data.


text:
Q: How can an html attribute's value be captured then written as text in html? I am trying to display class values on a webpage. I want to be able to create pages that contain many combinations of styles. Then for the sake of accuracy have the page auto display these variables. Instead of copying and pasting the string manually like this:

left my-figure my-figure-50 thumbnail

I would like to dump the classes of a parent
 in the caption area
 and get

I'm guessing that .getAttribute("class") or .attr('class') could be used somewhere but for my life, I can't seem to figure it out.

A: You can use the textContent and className properties of HTML elements here.
Vanilla JavaScript Implementation:

document.querySelectorAll('figure').forEach(function (figure) {
  figure.querySelector('figcaption').textContent = figure.className
})

jQuery Implementation:

$('figure').each(function () {
  $('figcaption', this).text(this.className)
})


text:
Q: How can I print the data from the form side by side in the textarea? I really hope someone can point out my mistake here. This is the code that I have tried.

Name :

Address :

City :

E-mail :

--The output should display like this --
Name : Jake
Address : Tronoh
City : Perak
E-mail : jake123@gmail.com
--But it turned out to be like this instead --
Name :
Jake
Address :
Tronoh
City :
Perak
E-mail :
jake123@gmail.com


text:
Q: INotifyPropertyChanged Disable Button and CheckBox I am using the following command to update the button on GUI
PropertyChanged(this, new PropertyChangedEventArgs(resetButton.IsEnabled = false));
However, I get an error `

Argument 1: cannot convert from 'bool' to 'string'

EDIT
This XAML code for the button that I want to disable when its clicked.
resetButton.IsEnabled = false is what I initially tried to use to disable it.
<Button x:Name="resetButton"
        Grid.Row="1"
        HorizontalAlignment="Right"
        VerticalAlignment="Bottom"
        Width="80"
        Content="Reset"
        Style="{StaticResource BlueButton}"
        Click="resetButton_Click"/>

A: I will first discuss the mere syntactical error that the compiler is complaining about:
You invoke
new PropertyChangedEventArgs(resetButton.IsEnabled = false)

In there, the expression
resetButton.IsEnabled = false

will evaluate to a bool. Hence, you are passing a bool to the constructor of PropertyChangedEventArgs.
However, that constructor expects a string, namely the name of the changed property.

Now, concerning the intended result:

I am using the following command to update the button on GUI

No, you are not. At least, not directly.
What you can use the call to PropertyChanged for is to fire any event handlers registered with the PropertyChanged event, which can then do whatever you want them to do, e.g. update something in the GUI.
Therefore, somewhere else in the code, you have to write something like this:
myObject.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
{
    resetButton.IsEnabled = false;
}

This creates an anonymous method and registers it as an event handler with your event.
Now, usually, you will also want to check the PropertyName property on the e argument to see which property of myObject has actually been changed.
And here, we get back to your firing of the event: You have to pass in the property name of the changed property upon constructing the PropertyChangedEventArgs instance.
If your property is of type bool (or if you have an appropriate value converter to convert whatever type your property is to bool), you can also directly bind the resetButton.IsEnabled property in XAML to your property. It will then automatically register a handler with the PropertyChanged event under the hood in order to update the enabled state of the button when required.


text:
Q: fill new Columns with Open price at certain times Hoping someone can help me here... I'm absolutely lost!
Here is my dataframe: a 1 minute export of the DAX fom Metatrader5. I am wanting to add 2 new columns. "Hourly Open" and "Market Open".
                         Open        High        Low         Close     Vol
Date_Time
2022-07-04 00:01:00     12869.2     12873.5     12867.5     12869.1     63
2022-07-04 00:02:00     12868.3     12868.3     12854.9     12854.9     68
2022-07-04 00:03:00     12855.8     12861.1     12854.4     12860.8     69
2022-07-04 00:04:00     12861.1     12861.7     12854.0     12854.0     73
2022-07-04 00:05:00     12854.1     12857.3     12849.8     12849.9     58

*

*for the Hourly Open column I would like to find the Open price at the start of each hour. I would then like to ffill() that value into subsequent columns until a new hour opens at a new price....

*for the market Open column I would like to find the open price for a specific time: ie 08:00.  Once again Id like to ffill() that until the next day at 08:00 provides a new value....
I'm not understanding why I am having so much trouble with Pandas etc It just seems like every attempt I make at this is incorrect, plus I just haven't got the experience in Pandas to know where I'm going wrong. Every tutorial I do is helpful to a point but I'm not sure what exactly I'm seaching for....
if someone could please help me with some pointers I'd be grateful...
=============================
Thanks for the question. Hopefully this clarifies things...

*

*Good Point - I'll have to drop the entries before the 08:00 time.

*Here is what I'd like to end up with... Saved as an image

Hopefully that makes sense....I need to be able to refer to both the Hourly oopen and the Session / Market Open later...
many thanks!

A: I can only do it on ideal data. Namely, on the opening date (9:30 for me, you apparently have it at 8:00, this will need to be corrected) there should be a candle, if it is not there, then there will be empty values. The same applies to the hour, if there is no candle, for example, exactly at 13:00, then there will also be gaps in the nan value. Perhaps someone will tell you how to set a range in offset in order to take the nearest available data, the same applies to the hourly frequency.
Now for the code: the column Date_Time is converted to datetime format and made into an index. Next, a column is created with a frequency per hour Hourly Open. Then, a series is additionally created with a frequency per day, with the start time of the day at 9:30. And with this data, the Hourly Open column is filled in and the Market Open is filled in. At the end, the empty data is filled with past values.
import pandas as pd

pd.set_option('display.max_rows', None)#these lines are needed to display all rows and columns
pd.set_option('display.max_columns', None)#you can remove them or comment them out

df = pd.read_csv('dax.csv', sep=',', header=0)
df['Date_Time'] = pd.to_datetime(df['Date_Time'], errors='raise')
df = df.set_index('Date_Time')

df['Hourly Open'] = df['Close'].resample("H").asfreq()
df1 = df['Close'].resample('1D', offset='9h30min').asfreq().dropna()
df.loc[df1.index, 'Market Open'] = df1.values
df.loc[df1.index, 'Hourly Open'] = df1.values
df[['Hourly Open', 'Market Open']] = df[['Hourly Open', 'Market Open']].fillna(method="ffill")

print(df[['Close', 'Hourly Open', 'Market Open']])

Again, this will only work if the data frequency is uniform.


text:
Q: Assign object to a variable before exporting as module default I am building a restaurant website and got this error in my constants/images.js
this is my full page of images.js :
export default {
  bg,
  chef,
  G,
  gallery01,
  gallery02,
  gallery03,
  gallery04,
  knife,
  logo,
  menu,
  overlaybg,
  spoon,
  welcome,
  findus,
  laurels,
  award01,
  award02,
  award03,
  award05,
  sign,
  quote,
  gericht,
};

the error shown in exporting default, kindly I need your help :)


text:
Q: Is it possible to filter JTable in a worker thread? I have a JTable with around 11000 rows and a search box used for filtering on regex.
My code in the search box looks like this:
getDocument().addDocumentListener(new DocumentListener()
    {
        public void insertUpdate(DocumentEvent e)
        {
            final RowFilter<TableModel, Object> rf;
            try
            {
                rf = RowFilter.regexFilter(getText(), 0);
            }
            catch (java.util.regex.PatternSyntaxException exception)
            {
                logger.info("Failed to compile regex.", exception);
                return;
            }
            sorter.setRowFilter(rf);
        }
        .......

The problem is that the whole UI becomes unresponsive during the filtering operation. I suppose that this is because the filtering is done in the EventDispatchThread so
is there a way to somehow put the filtering in a worker thread?


text:
Q: Strange reference class generation when using WCF I encountered an (what I consider to be) issue with a service reference generation.
Original class (example)
[Serializable()]
public class Foo
{
    private int _Bar;
    public int Bar
    {
        get { return _Bar; }
        set { _Bar = value; }
    }

    public Foo()
    {
        this._Bar = 42;
    }
}

I found it strange that the constructor was using the private backing field rather than using the public setter, so I refactored to this:
[Serializable()]
public class Foo
{
    public int Bar { get; set; }

    public Foo()
    {
        this.Bar = 42;
    }
}

these two seem equivalent enough I believe... however when I regenerated my service reference that contains a reference to Foo... I received a compile error.

No reference/extension method for _Bar exists in Foo

Note this is only what I can remember of the compile error since this is only a generalized example of what I encountered.  There was existing code reliant on this service reference, which somehow referenced Foo._Bar - even though it is private.
So... is this the expected behavior?  My re-factored class even though looking equivalent to me... generated a reference class in a way I didn't expect.
I'm assuming because the private _Bar was referenced directly in the constructor, it was somehow serialized with the class even though it was private?
I'm worried about this behavior, as I did similar refactoring in numerous places in our code base - am I not understanding something about how the serializing classes works?
Edit:
I'm noticing that the original Reference file created on the Foo class looks like this:
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="Foo", Namespace="http://schemas.datacontract.org/2004/07/Foo")]
[System.SerializableAttribute()]
public partial class Foo: object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {

    [System.NonSerializedAttribute()]
    private System.Runtime.Serialization.ExtensionDataObject extensionDataField;

    private int _BarField;

    [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
    public int _Bar {
        get {
            return this._BarField;
        }
        set {
            if ((this._BarField.Equals(value) != true)) {
                this._BarField = value;
                this.RaisePropertyChanged("_Bar");
            }
        }
    }

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged(string propertyName) {
        System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
        if ((propertyChanged != null)) {
            propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
        }
    }
}

I guess I expected Bar to be the accessible property in the Reference file from the original class, not _Bar - but that assumption was incorrect in this case.  Is there something I'm missing here?  Why would the reference file be generated with the private _Bar as the property, rather than the public Bar which is used as a getter and setter for the private backing field?

A: This behavior occurs because you have marked your class with the Serializable attribute, but no data contract attributes.  According to Types Supported by the Data Contract Serializer,

The following is a complete list of types that can be serialized:

*

*Types marked with the SerializableAttribute attribute. Many types included in the .NET Framework base class library fall into this category. The DataContractSerializer fully supports this serialization programming model that was used by .NET Framework remoting, the BinaryFormatter, and the SoapFormatter, including support for the ISerializable interface.

So, how does this "serialization programming model" work?  From the docs:

When you apply the SerializableAttribute attribute to a type, all private and public fields are serialized by default.

Thus you have (unintentionally) instructed the data contract serializer to auto-generate a contract that serializes private and public fields of your class, not the properties.  Then when you switch your property to be auto-implemented, you are changing the name of the its backing field from _Bar to the name of the hidden backing field.  In turn the contract inferred from the type contains a renamed member.  You can see the change in the contract when you serialize to XML.  Here is the original field being serialized in the original XML:

<Foo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Question29495337.V1">
    <_Bar>42</_Bar>
</Foo>

And the backing field in the new XML:

<Foo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Question29495337.V2">
    <_x003C_Bar_x003E_k__BackingField>42</_x003C_Bar_x003E_k__BackingField>
</Foo>

Then when you do add service reference in a client, Visual Studio auto-generates a data contract type with public properties named after the serializable data contract members.  Since those members got named after the private fields, this promotes the private field names on the server to public property names in the client, making seemingly private aspects of your class public.
You have several ways to avoid this problem:

*

*Extract the serializable type into a DLL and link it into both the client and server.  In this case the auto-generated data contract won't matter.

*Remove the [Serializable] attribute.  Doing so will cause DataContractSerializer to infer a contract that serializes all public fields, and properties with public get and set methods.

*If you cannot remove [Serializable], annotate the class with explicit data contract attributes.  These will override the auto-generated Serializable contract and stabilize the contract member names.


text:
Q: How to install Windows Update service again in Windows Server 2012? Windows Update can't be completely stopped unless you delete Windows Update service:
sc delete wuauserv

I did that on a machine we had, because of strict policies about updates.
Now I'm gonna install Microsoft Visual C++ Redistributable and I receive this error that the specified service does not exist:

As I searched it seems that this package's installation is done through Windows Update (stupid) and I need to re-install Windows Update back so that I can install this package, and remove it again.
But I can't find a solution on how to re-install Windows Update on Windows Server 2012. All I found is about WSUS, or about some other trouble that assumes that Windows Update is already working, or about DSIM which can't be found on my machine, etc.
So, anyone can help me re-installing the Windows Update service, AKA wuauserv?

A: You have to reinstall Windows Server.
Since you deleted a system service, you can't trust this server anymore because nobody can tell you which system components/services are now broken.
When the server is reinstalled, you can disable Windows Update with this group policy:
Computer configuration -> Administrative templates -> Windows Components -> Windows Update -> "Configure automatic updates" set it to "disabled".


text:
Q: Rails / Rack default network timeout value? I'm investigating a system where I have a Rails app that talks to a Tomcat backend, and I'm seeing many "500 Connection reset by peer" errors.
I'd like to know what the timeout value is for Rails network requests.
Alternatively, where can I find this information? (Googling hasn't helped)