问:
Puppeteer: Can't access iframe elements after update from 2.1 to 3.1 with built-in firefox
I recently updated my puppeteer version from 2.1 to 3.1. I was using pupeteer-firefox on the previous version. And now since pupeteer 3.1 has firefox built-in, I am using that. But it's only an experimental feature from pupeteer.

This code was working properly with the previous version.

```<code>        const elementHandle = await page.$("iframe[src^=\"https://docs.google.com/picker\"] [id=\":7\"]")
        await elementHandle.click()
</code>```

Steps to reproduce

login to google: https://accounts.google.com/ServiceLogin?hl=en&gl=en

Go to: https://www.google.com/maps/d/?hl=en&gl=en

Create a new map

search for a location and add it to the map

click on the add image icon image icon

Now an iframe will open up. I need to click on the element with id=":7" inside the iframe and input image url. Can some one please help me out?

答:
This is the official test result of puppeteer's firefox.

https://hg.mozilla.org/mozilla-central/file/tip/remote/puppeteer-expected.json

Every test against iframe is either FAIL or SKIP.

And google won't give support for firefox inside the pupeteer.

So I've come to the conclusion that it's not possible to access the iframe using pupetteer especially when cross-site scripting is banned.

I've abandoned puppeteer and started using microsoft's playwright. And everything's going good.

Body:
I recently updated my puppeteer version from 2.1 to 3.1. I was using pupeteer-firefox on the previous version. And now since pupeteer 3.1 has firefox built-in, I am using that. But it's only an experimental feature from pupeteer.

This code was working properly with the previous version.

        const elementHandle = await page.$("iframe[src^=\"https://docs.google.com/picker\"] [id=\":7\"]")
        await elementHandle.click()

Steps to reproduce

login to google: https://accounts.google.com/ServiceLogin?hl=en&gl=en

Go to: https://www.google.com/maps/d/?hl=en&gl=en

Create a new map

search for a location and add it to the map

click on the add image icon image icon

Now an iframe will open up. I need to click on the element with id=":7" inside the iframe and input image url. Can some one please help me out?


来源: stackexchange

问:
Error when running Mocha with ES6 files in node_modules/
I have a file that uses ES6 syntax that causes the following error when I attempt to run Mocha:

```<code>import 'test';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Module._extensions..js (module.js:580:10)
</code>```

I run my tests using the following npm command:

```<code>"test": "mocha --reporter progress --require babel-core/register tools/testSetup.js \"**/*_spec.jsx\""
</code>```

Here is my .babelrc file:

```<code>{
  "presets": ["es2015", "react"]
}
</code>```

The file that is using ES6 syntax is contained in node_modules/ under a private module that is referenced through git. Is there any way to run Mocha without having to manually remove ES6 syntax from this private module? All of the regular ES6 files within my project do not cause any issues when I run Mocha.

答:
There is already an issue filed with ts-node for this over here https://github.com/TypeStrong/ts-node/issues/617. To summarize, by default, ts-node does not transpile node_modules packages. If your ts file has an import statement pointing to one of the node_module package, then following the dependency rule, ts-node will transpile it (if you are on node10 or higher.) If you are on node version less than 10, then you will end up with the above error anyways.

As blakeembrey mentioned in the above link,

TS Node does not compile files in node_modules by default. If you want to consume ES modules, you should update to a node.js version that supports ES modules natively, use something like esm or alter the default behaviour by changing --ignore.

In ideal case, you should not be having a npm package with ts files. It should be JS files. As mentioned here https://github.com/TypeStrong/ts-node#import-statements

ContentLicense: CC BY-SA 3.0

Body:
I have a file that uses ES6 syntax that causes the following error when I attempt to run Mocha:

import 'test';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Module._extensions..js (module.js:580:10)

I run my tests using the following npm command:

"test": "mocha --reporter progress --require babel-core/register tools/testSetup.js \"**/*_spec.jsx\""

Here is my .babelrc file:

{
  "presets": ["es2015", "react"]
}

The file that is using ES6 syntax is contained in node_modules/ under a private module that is referenced through git. Is there any way to run Mocha without having to manually remove ES6 syntax from this private module? All of the regular ES6 files within my project do not cause any issues when I run Mocha.

ContentLicense: CC BY-SA 4.0


问:
Custom text to  tag using CSS
I have a two  tags and it's HTML as below:

```<code><ul>
  <li><a href="#">This is my link</a></li>
  <li><a href="#">This is my link</a></li>
</ul>
</code>```

What I want is, to replace links text as this:

```<code><ul>
  <li><a href="#">custom 1</a></li>
  <li><a href="#">custom 2</a></li>
</ul>
</code>```

This is how I tried it using CSS. But still I couldn't figure this out.

```<code>ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul li {
  padding: 0;
  margin: 0;
}

ul li a {
  color: #fff;
  font-size: 0;
  position: relative;
}

ul li a:first-child:after {
  content: 'Custom 1';
  position: absolute;
  top: 0;
  left: 0;
}

ul li a:last-child:after {
  content: 'Custom 2';
  position: absolute;
  top: 0;
  left: 0;
}
</code>```

Hope somebody may help me out. Thank you.

答:
If you want to make it dynamicly, you should use a Script..
With this snnipet :
document.getElementById("ahref1").innerHTML = "Google";</p>

Title: Custom text to <a> tag using CSS

Body:
I have a two  tags and it's HTML as below:

This is my link

This is my link

What I want is, to replace links text as this:

custom 1

custom 2

This is how I tried it using CSS. But still I couldn't figure this out.

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul li {
  padding: 0;
  margin: 0;
}

ul li a {
  color: #fff;
  font-size: 0;
  position: relative;
}

ul li a:first-child:after {
  content: 'Custom 1';
  position: absolute;
  top: 0;
  left: 0;
}

ul li a:last-child:after {
  content: 'Custom 2';
  position: absolute;
  top: 0;
  left: 0;
}

Hope somebody may help me out. Thank you.


问:
making the whole page blur when I click on a certain button
So, I have a button and want the whole body to go blurry when I click on it and show an alert or a pop-up message. this is what I have been trying to do:

function myFunction() {
  $('body').css("filter","blur(2px)");
  alert("hello");
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="phone_num d-none d-xl-block">
  {% trans 'try' %}
</div></code>```

But I have a couple of issues:
1- the blur doesn't last until I click okay to the alert and moves to the next page right away.
2- the alert is way up on the top of the page o can I some how move to the middle of the page?

答:
I wouldn't  fire the function insite the html tag. I would use a click event from JQuery. There you can place a return false; with prevents the browser from opening the link.

$('.blurBtn').on('click', function(){
  $('body').css("filter","blur(2px)");
  return false;
})
       ```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="phone_num d-none d-xl-block">
  {% trans 'try' %}
</div></code>```

Body:
So, I have a button and want the whole body to go blurry when I click on it and show an alert or a pop-up message. this is what I have been trying to do:

function myFunction() {
  $('body').css("filter","blur(2px)");
  alert("hello");
}

  {% trans 'try' %}

But I have a couple of issues:
1- the blur doesn't last until I click okay to the alert and moves to the next page right away.
2- the alert is way up on the top of the page o can I some how move to the middle of the page?

Body:
I wouldn't  fire the function insite the html tag. I would use a click event from JQuery. There you can place a return false; with prevents the browser from opening the link.

$('.blurBtn').on('click', function(){
  $('body').css("filter","blur(2px)");
  return false;
})

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="phone_num d-none d-xl-block">
  <a class="boxed-btn3 blurBtn" href="{% url 'homepage' %}" onclick="myFunction">{% trans 'try' %}</a>
</div>


问:
problem with regular expression replacement
I'm trying to make a program to go through a lot of .sql files and replace names for example view_name to [dbo].[view_name]. So far it replaces most of the words, however if a name contains number in brackets like (3) or (7) and so on it wont replace anything within that file. I've provided the code below.</p>

```<code>        FolderBrowserDialog fb = new FolderBrowserDialog();
        fb.ShowDialog();

        string directory = fb.SelectedPath;

        if(directory != String.Empty)
        {
            DirectoryInfo di = new DirectoryInfo(directory);
            FileInfo fi = new FileInfo(directory);
            FileInfo[] fiArray = di.GetFiles();

            for (int i = 0; i < fiArray.Length; i++)
            {
                string result;
                //StreamReader
                using (StreamReader sr = new StreamReader(directory + "\\" + fiArray[i].ToString()))
                {
                    string temp = sr.ReadToEnd();

                    string tempNameExtens = fiArray[i].Name;
                    string tempNameNoExtens = Path.GetFileNameWithoutExtension(fiArray[i].Name);
                    MessageBox.Show(tempNameNoExtens);

                    string pattern = "\\s" + tempNameNoExtens;
                    string replace = " [dbo].[" + tempNameNoExtens + "]";

                    Regex rgx = new Regex(pattern);
                    result = rgx.Replace(temp, replace);
                }

                //StreamWriter
                using (StreamWriter sw = new StreamWriter(directory + "\\" + fiArray[i].ToString()))
                {
                    sw.WriteLine(result);
                }
            }
        }
</code>```

答:
You should Escape the characters when building a regex pattern:

```<code>string pattern = "\\s" + Regex.Escape(tempNameNoExtens);
</code>```

Body:
I'm trying to make a program to go through a lot of .sql files and replace names for example view_name to [dbo].[view_name]. So far it replaces most of the words, however if a name contains number in brackets like (3) or (7) and so on it wont replace anything within that file. I've provided the code below.

        FolderBrowserDialog fb = new FolderBrowserDialog();
        fb.ShowDialog();

        string directory = fb.SelectedPath;

        if(directory != String.Empty)
        {
            DirectoryInfo di = new DirectoryInfo(directory);
            FileInfo fi = new FileInfo(directory);
            FileInfo[] fiArray = di.GetFiles();

            for (int i = 0; i < fiArray.Length; i++)
            {
                string result;
                //StreamReader
                using (StreamReader sr = new StreamReader(directory + "\\" + fiArray[i].ToString()))
                {
                    string temp = sr.ReadToEnd();

                    string tempNameExtens = fiArray[i].Name;
                    string tempNameNoExtens = Path.GetFileNameWithoutExtension(fiArray[i].Name);
                    MessageBox.Show(tempNameNoExtens);

                    string pattern = "\\s" + tempNameNoExtens;
                    string replace = " [dbo].[" + tempNameNoExtens + "]";

                    Regex rgx = new Regex(pattern);
                    result = rgx.Replace(temp, replace);
                }

                //StreamWriter
                using (StreamWriter sw = new StreamWriter(directory + "\\" + fiArray[i].ToString()))
                {
                    sw.WriteLine(result);
                }
            }
        }

Body:
You should Escape the characters when building a regex pattern:

string pattern = "\\s" + Regex.Escape(tempNameNoExtens);


问:
Push list of elements to component in React
I want to build a sidebar component similar to the one in this image:
Instead of passing the child components as Objects with text values through the props, I'd like to create a separate component for each key-value pair in each element in the list. For example: if the list has 3 elements, there should be 3 components for each element in the list.

Here is my code so far:

sidebarcomponents.js:

```<code>import React from 'react'

function SidebarComponents({ name, title, selected, onSelect }) {
  const style = {
    cursor: 'pointer'
  }

  return (
    <div
      name={name}
      title={title}
      style={style}
      onClick={() => {
        if (onSelect) onSelect(name)
      }}
    >

    </div>
  )
}

export default SidebarComponents

</code>```

sidebar.js:

```<code>
import React, { useEffect, useState } from 'react'
import SidebarComponents from '../../components/Sidebar1/Sidebar'

function Sidebar({ onChange }) {
  const [selectedComponent, setSelectedComponent] = useState({
    componentsName: [
      { name: 'Overview', title: 'Overview' },
      { name: 'SPO2', title: 'SPO2' }
    ]
  })

  return (
    <div>
      {selectedComponent.componentsName.map(componentsName => {
        return (
          <SidebarComponents
            name={componentsName.name}
            title={componentsName.title}
          />
        )
      })}
    </div>
  )
}

export default Sidebar
</code>```

How can I change my code to map a list child components rather than a list of objects that represent them?

I hope that my question is clear.

答:
@shubham-khatri's answer is correct: you need to include the text inside the component.

Below is a more in-depth solution using render props and hooks -- I suggest reading the linked docs as hooks and render props are awesome.. Note that hooks are only available starting with React 16.8.

In simple terms, in the below example, the sidebar renders using the render prop provided by the parent component: App. In the render prop for the SidebarComponent, the function says to render a Title and a Name component. The name from the map function is used as the argument for the onClick handler, and to set selected to true or false, without having to pass the selected component object to the sidebar.

If you want to provide a master list of components the sidebar can render, and then pass which of that set should render in the props, then you will have to filter the componentsName array such that only the ones provided in the props for SidebarComponent.

```<code>import React from 'react'
import ReactDOM from 'react-dom'

/**
 * Title component
 * @param {string=''} props.title
 */
const Title = ({ title = '' }) => <h2>{title}</h2>

/**
 * Name component
 * @param {string=''} props.name
 */
const Name = ({ name = '' }) => <div>{name}</div>

/**
 * SidebarComponent styles
 */
const style = {
  cursor: 'pointer'
}

/**
 * SidebarComponent classes
 */
const classes = {
  selected: {
    backgroundColor: '#00ff00'
  }
}

/**
 * @func SidebarComponent
 * @param {string=''} name
 * @param {function} onClick
 * @param {boolean=false} selected
 * @param {string=''} title
 * @returns {React.Node} react component that returns a div
 *  containing two other components: Title and Name
 */
const SidebarComponent = ({
  name = '',
  onClick,
  selected = false,
  title = ''
}) => (
  <div
    onClick={onClick && onClick}
    style={{
      ...style,
      ...(selected ? classes.selected : {})
    }}
  >
    <Title title={title} />
    <Name name={name} />
  </div>
)

/**
 * @func Sidebar
 * @param {Array[{title: string, name: string}]} componentsName an
 *  arry of components to render inside the sidebar, as SidebarComponents
 * @param {function} renderProp render function that dictates
 *  what to render inside of the sidebar
 * @returns {Node} returns the calling of the renderProp function
 */
const Sidebar = ({ componentsName, render }) => {
  const [selectedComponentName, setSelectedComponentName] = React.useState(null)
  const handleClick = name => setSelectedComponentName(name)
  return (
    <div id="sidebar">
      {render({
        selectedComponentName,
        handleClick
      })}
    </div>
  )
}

/**
 * An array of the components to render inside the Sidebar
 */
const componentsName = [
  { name: 'Overview', title: 'Overview' },
  { name: 'SPO2', title: 'SPO2' }
]

/**
 * @func App
 * @returns {React.Node} a react component that renders the sidebar
 */
const App = () => (
  <Sidebar
    render={({ selectedComponentName, handleClick }) =>
      componentsName.map(({ name, ...props }, index) => (
        <SidebarComponent
          selected={name === selectedComponentName}
          key={`sidebar-component-${index}`}
          onClick={() => handleClick(name)}
          {...{
            name,
            ...props
          }}
        />
      ))
    }
  />
)

ReactDOM.render(<App />, document.getElementById('container'))

</code>```

Demo

https://codesandbox.io/s/react-playground-wnxer?file=/index.js

In this demo, you can click on either the menu item, and see the selected item change background-color to green.

Body:
I want to build a sidebar component similar to the one in this image:
Instead of passing the child components as Objects with text values through the props, I'd like to create a separate component for each key-value pair in each element in the list. For example: if the list has 3 elements, there should be 3 components for each element in the list.

Here is my code so far:

sidebarcomponents.js:

import React from 'react'

function SidebarComponents({ name, title, selected, onSelect }) {
  const style = {
    cursor: 'pointer'
  }

  return (

 {
        if (onSelect) onSelect(name)
      }}
    >

  )
}

export default SidebarComponents

sidebar.js:

import React, { useEffect, useState } from 'react'
import SidebarComponents from '../../components/Sidebar1/Sidebar'

function Sidebar({ onChange }) {
  const [selectedComponent, setSelectedComponent] = useState({
    componentsName: [
      { name: 'Overview', title: 'Overview' },
      { name: 'SPO2', title: 'SPO2' }
    ]
  })

  return (

      {selectedComponent.componentsName.map(componentsName => {
        return (
          <SidebarComponents
            name={componentsName.name}
            title={componentsName.title}
          />
        )
      })}

  )
}

export default Sidebar

How can I change my code to map a list child components rather than a list of objects that represent them?

I hope that my question is clear.

Body:
@shubham-khatri's answer is correct: you need to include the text inside the component.

Below is a more in-depth solution using render props and hooks -- I suggest reading the linked docs as hooks and render props are awesome.. Note that hooks are only available starting with React 16.8.

In simple terms, in the below example, the sidebar renders using the render prop provided by the parent component: App. In the render prop for the SidebarComponent, the function says to render a Title and a Name component. The name from the map function is used as the argument for the onClick handler, and to set selected to true or false, without having to pass the selected component object to the sidebar.

If you want to provide a master list of components the sidebar can render, and then pass which of that set should render in the props, then you will have to filter the componentsName array such that only the ones provided in the props for SidebarComponent.

import React from 'react'
import ReactDOM from 'react-dom'

/**
 * Title component
 * @param {string=''} props.title
 */
const Title = ({ title = '' }) => <h2>{title}</h2>

/**
 * Name component
 * @param {string=''} props.name
 */
const Name = ({ name = '' }) => <div>{name}</div>

/**
 * SidebarComponent styles
 */
const style = {
  cursor: 'pointer'
}

/**
 * SidebarComponent classes
 */
const classes = {
  selected: {
    backgroundColor: '#00ff00'
  }
}

/**
 * @func SidebarComponent
 * @param {string=''} name
 * @param {function} onClick
 * @param {boolean=false} selected
 * @param {string=''} title
 * @returns {React.Node} react component that returns a div
 *  containing two other components: Title and Name
 */
const SidebarComponent = ({
  name = '',
  onClick,
  selected = false,
  title = ''
}) => (
  <div
    onClick={onClick && onClick}
    style={{
      ...style,
      ...(selected ? classes.selected : {})
    }}
  >
    <Title title={title} />
    <Name name={name} />
  </div>
)

/**
 * @func Sidebar
 * @param {Array[{title: string, name: string}]} componentsName an
 *  arry of components to render inside the sidebar, as SidebarComponents
 * @param {function} renderProp render function that dictates
 *  what to render inside of the sidebar
 * @returns {Node} returns the calling of the renderProp function
 */
const Sidebar = ({ componentsName, render }) => {
  const [selectedComponentName, setSelectedComponentName] = React.useState(null)
  const handleClick = name => setSelectedComponentName(name)
  return (
    <div id="sidebar">
      {render({
        selectedComponentName,
        handleClick
      })}
    </div>
  )
}

/**
 * An array of the components to render inside the Sidebar
 */
const componentsName = [
  { name: 'Overview', title: 'Overview' },
  { name: 'SPO2', title: 'SPO2' }
]

/**
 * @func App
 * @returns {React.Node} a react component that renders the sidebar
 */
const App = () => (
  <Sidebar
    render={({ selectedComponentName, handleClick }) =>
      componentsName.map(({ name, ...props }, index) => (
        <SidebarComponent
          selected={name === selectedComponentName}
          key={`sidebar-component-${index}`}
          onClick={() => handleClick(name)}
          {...{
            name,
            ...props
          }}
        />
      ))
    }
  />
)

ReactDOM.render(<App />, document.getElementById('container'))

Demo

https://codesandbox.io/s/react-playground-wnxer?file=/index.js

In this demo, you can click on either the menu item, and see the selected item change background-color to green.


问:
GitLab : Can not find "default description template for merge request"
I created a project and the role is Maintainer.

When I want to create "default description template for merge request", I can not find text area.

enter image description here

Does anyone know why this is happening?

I do not want to use template(.gitlab/merge_request_templates/).

I have create.gitlab/merge_request_templates/Default.md.When I create new merge request, I can see this template.

But I want to have a default value without selecting any template.

答:
The OP 楊筱誼 confirms in the comments:

"Setting default template" is only available if you have a Starter (or higher) license for a self-managed installation of GitLab or Bronze for GitLab.com.

My trial license seems to have expired, so it cannot be displayed.

I can not find text area.

Precisely because, as described in the official documentation "Description templates", you do not have yet created a .md file in the  .gitlab/merge_request_templates/ directory of your repository.

Once you have created, committed and push that file, then you will see that field:

I do not want to use template(.gitlab/merge_request_templates/).

Then... you won't see that field.

Don't forget the visibility:

The visibility of issues and/or merge requests should be set to either “Everyone with access” or “Only Project Members” in your project’s Settings / Visibility, project features, permissions section, otherwise the template text areas won’t show.


问:
Cannot GET / Node JS Amazon EC2 server issues
In my app.js file

```<code>app.listen(process.env.PORT || 8080, () => console.log(`Listening on port ${process.env.PORT || 8080}!`));
</code>```

In my webpack.config.js file

```<code>devServer: {
   port: 3000,
   open: true,
   proxy: {
     '/api': 'http://localhost:8080'
   }
}
</code>```

In /etc/nginx/sites-enabled/default on my EC2 instance

```<code>server {
  listen       80;
  server_name  _;

  location / {
    proxy_pass http://[private ip]:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}
</code>```

EDIT: Full app.js file

```<code>const app = express();
app.use(cors());
app.use(express.static('dist'));
app.listen(process.env.PORT || 8080, () => console.log(`Listening on port ${process.env.PORT || 8080}!`));

app.post('/api/[route]', async (req, res, next) => {
  try {
    const seq = await sequelize();
    const file = await [...];
  } catch (err) {
    return next(err);
  }
});
</code>```

答:
The correct config was

```<code>server {
  listen       80;
  server_name  _;

  location / {
    proxy_pass http://localhost:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}
</code>```

I believe i had installed pm2 incorrectly at the beginning, because both the nginx server and pm2 were trying to listen on port 80. So i did a fresh install of everything, and voila it works now.

Body:
In my app.js file

app.listen(process.env.PORT || 8080, () => console.log(`Listening on port ${process.env.PORT || 8080}!`));

In my webpack.config.js file

devServer: {
   port: 3000,
   open: true,
   proxy: {
     '/api': 'http://localhost:8080'
   }
}

In /etc/nginx/sites-enabled/default on my EC2 instance

server {
  listen       80;
  server_name  _;

  location / {
    proxy_pass http://[private ip]:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}

EDIT: Full app.js file

const app = express();
app.use(cors());
app.use(express.static('dist'));
app.listen(process.env.PORT || 8080, () => console.log(`Listening on port ${process.env.PORT || 8080}!`));

app.post('/api/[route]', async (req, res, next) => {
  try {
    const seq = await sequelize();
    const file = await [...];
  } catch (err) {
    return next(err);
  }
});

Body:
The correct config was

server {
  listen       80;
  server_name  _;

  location / {
    proxy_pass http://localhost:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}

I believe i had installed pm2 incorrectly at the beginning, because both the nginx server and pm2 were trying to listen on port 80. So i did a fresh install of everything, and voila it works now.


问:
Outlook addin DisplayDialogAsync iFrame not showing page
I have the following issue:

I'm using the DisplayDialogAsync function in my addin to launch auth from custom provider.

```<code>Office.context.ui.displayDialogAsync(
  url,
  {width: 400, height: 844, displayInIframe: true},
  function (asyncResult) {
    dialog = asyncResult.value;
    dialog.addEventHandler(Office.EventType.DialogMessageRecieved, processMessage);
  }
);
</code>```

When the user is already logged in auth redirects me to specified endpoint and the Iframe closes whilst passing the token -> so everything works fine.

Yet when the user is not logged in the auth page is not displayed in the IFrame.

I've checked for the  x-frame-options: SAMEORIGIN header and the provider does not set it.

The domain of the auth provider is added in the manifest.xml

So I can't figure out why is the auth page not showing.

答: had to open an endpoint from the same domain as parent in the IFrame that would run the office script and then redirect to the auth provider site.</p>

Body:
I have the following issue:

I'm using the DisplayDialogAsync function in my addin to launch auth from custom provider.

Office.context.ui.displayDialogAsync(
  url,
  {width: 400, height: 844, displayInIframe: true},
  function (asyncResult) {
    dialog = asyncResult.value;
    dialog.addEventHandler(Office.EventType.DialogMessageRecieved, processMessage);
  }
);

When the user is already logged in auth redirects me to specified endpoint and the Iframe closes whilst passing the token -> so everything works fine.

Yet when the user is not logged in the auth page is not displayed in the IFrame.

I've checked for the  x-frame-options: SAMEORIGIN header and the provider does not set it.

The domain of the auth provider is added in the manifest.xml

So I can't figure out why is the auth page not showing.


问:
Calculate perc in Pandas Dataframe based on rows having a specific condition for each distinct value in column
I have a dataframe with sample values as given below

`

```<code>col1   col2
A     ['1','2','er']
A     []
B     ['3','4','ac']
B     ['5']
C     []
</code>```

`

I want to calculate the percentage of total number of rows for each value in col1 against total number of rows in col2 that are not empty list.

I am able to do it if there is a single value in col1. I am looking for a solution to do this iteratively. Thanks for the help.

答:
I believe you need compare length of lists greater like 0, convert to number and athen aggregate mean:

```<code>df1 = df['col2'].str.len().gt(0).view('i1').groupby(df['col1']).mean().reset_index(name='%')
print (df1)
  col1    %
0    A  0.5
1    B  1.0
2    C  0.0
</code>```

Body:
I have a dataframe with sample values as given below

`

col1   col2
A     ['1','2','er']
A     []
B     ['3','4','ac']
B     ['5']
C     []

`

I want to calculate the percentage of total number of rows for each value in col1 against total number of rows in col2 that are not empty list.

I am able to do it if there is a single value in col1. I am looking for a solution to do this iteratively. Thanks for the help.

Body:
I believe you need compare length of lists greater like 0, convert to number and athen aggregate mean:

df1 = df['col2'].str.len().gt(0).view('i1').groupby(df['col1']).mean().reset_index(name='%')
print (df1)
  col1    %
0    A  0.5
1    B  1.0
2    C  0.0


问:
I there any downtime in kubernetes upgrade?
I am planning to upgrade the kubernetes version of AWS EKS from 1.15 to 1.16. I understood that there is no downtime while upgrading the cluster plane of the kubernetes. But I am not sure if there is a downtime while upgrading the worker nodes of the kubernetes.

Is there any downtime while upgrading the kubernetes version?

答:
It depends on how you have deployed your workload on the cluster and how you are planning to upgrade the worker nodes. Note the following items

Drain each worker node one by one and upgrade each one by one.

Use deployment, statefulset, daemonset instead of bare pods directly.

https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/


问:
R: How to filter column as long as it contains combination of values?
I have a df like this:

```<code>VisitID | Item |
1       | A    |
1       | B    |
1       | C    |
1       | D    |
2       | A    |
2       | D    |
2       | B    |
3       | B    |
3       | C    |
4       | D    |
4       | C    |
</code>```

In R, how do I filter for VisitIDs as long as they contain Item A & B?
Expected Outcome:

```<code>VisitID | Item |
1       | A    |
1       | B    |
1       | C    |
1       | D    |
2       | A    |
2       | D    |
2       | B    |
</code>```

I tried df %>% group_by(VisitID) %>% filter(any(Item == 'A' & Item == 'B')) but it doesn't work..

```<code>df <- read_delim("ID | Item
1  | A
1  | B
2  | A
3  | B
1  | C
4  | C
5  | B
3  | A
4  | A
5  | D", delim = "|", trim_ws = TRUE)
</code>```

答:
Since you want both "A" and "B" you can use all

```<code>library(dplyr)
df %>% group_by(VisitID) %>% filter(all(c("A", "B") %in% Item))

#  VisitID Item
#    <int> <chr>
#1       1 A
#2       1 B
#3       1 C
#4       1 D
#5       2 A
#6       2 D
#7       2 B
</code>```

OR if you want to use any use them separately.

```<code>df %>% group_by(VisitID) %>% filter(any(Item == 'A') && any(Item == 'B'))
</code>```

Body:
I have a df like this:

VisitID | Item |
1       | A    |
1       | B    |
1       | C    |
1       | D    |
2       | A    |
2       | D    |
2       | B    |
3       | B    |
3       | C    |
4       | D    |
4       | C    |

In R, how do I filter for VisitIDs as long as they contain Item A & B?
Expected Outcome:

VisitID | Item |
1       | A    |
1       | B    |
1       | C    |
1       | D    |
2       | A    |
2       | D    |
2       | B    |

I tried df %>% group_by(VisitID) %>% filter(any(Item == 'A' & Item == 'B')) but it doesn't work..

df <- read_delim("ID | Item
1  | A
1  | B
2  | A
3  | B
1  | C
4  | C
5  | B
3  | A
4  | A
5  | D", delim = "|", trim_ws = TRUE)

Body:
Since you want both "A" and "B" you can use all

library(dplyr)
df %>% group_by(VisitID) %>% filter(all(c("A", "B") %in% Item))

#  VisitID Item
#    <int> <chr>
#1       1 A
#2       1 B
#3       1 C
#4       1 D
#5       2 A
#6       2 D
#7       2 B

OR if you want to use any use them separately.

df %>% group_by(VisitID) %>% filter(any(Item == 'A') && any(Item == 'B'))


问:
axios not sending json data
I am trying to post some json data using axios. The axios.post method works well:

```<code>axios.post(
    "http://localhost/api",
    {"k1":"v1","k2":"v2"}
)
</code>```

However, the following code does not work:

```<code>const axiosInstance = axios.create({
    baseURL: 'http://localhost/api',
    method: 'POST',
    data: {"k1":"v1","k2":"v2"}
});
axiosInstance.request()
</code>```

The backend is a Flask app, which cannot receive any data. It cannot even read the 'Content-type' header.
So what is the difference between the above two codes? Any idea how to modify the second method so it can work?

答:
fail to receive data on backend

```<code>  let iidd = axios.create({
    baseURL: '/iidd',
    method: 'POST',
    data:{'ll': 'ok'}
  })
  iidd.request({}).then(res=>{
    console.log(res);
  })
</code>```

========================================================

Can receive data on backend

```<code>  let iidd = axios.create({
    baseURL: '/iidd',
    method: 'POST'
  })
  iidd.request({data:{'ll': 'ok'}}).then(res=>{
    console.log(res);
  })
</code>```

mh....In this result, maybe create axios instance couldn't have default data. but is weird, in axios doc they are [config] too, It should have same result.

Title: axios not sending json data

Body:
I am trying to post some json data using axios. The axios.post method works well:

axios.post(
    "http://localhost/api",
    {"k1":"v1","k2":"v2"}
)

However, the following code does not work:

const axiosInstance = axios.create({
    baseURL: 'http://localhost/api',
    method: 'POST',
    data: {"k1":"v1","k2":"v2"}
});
axiosInstance.request()

The backend is a Flask app, which cannot receive any data. It cannot even read the 'Content-type' header.
So what is the difference between the above two codes? Any idea how to modify the second method so it can work?

Body:
fail to receive data on backend

  let iidd = axios.create({
    baseURL: '/iidd',
    method: 'POST',
    data:{'ll': 'ok'}
  })
  iidd.request({}).then(res=>{
    console.log(res);
  })

========================================================

Can receive data on backend

  let iidd = axios.create({
    baseURL: '/iidd',
    method: 'POST'
  })
  iidd.request({data:{'ll': 'ok'}}).then(res=>{
    console.log(res);
  })

mh....In this result, maybe create axios instance couldn't have default data. but is weird, in axios doc they are [config] too, It should have same result.


问:
What is the C# equivalent of NaN or IsNumeric?
What is the most efficient way of testing an input string whether it contains a numeric value (or conversely Not A Number)? I guess I can use Double.Parse or a regex (see below) but I was wondering if there is some built in way to do this, such as javascript's NaN() or IsNumeric() (was that VB, I can't remember?).

```<code>public static bool IsNumeric(this string value)
{
    return Regex.IsMatch(value, "^\\d+$");
}
</code>```

答:
This is a modified version of the solution proposed by Mr Siir. I find that adding an extension method is the best solution for reuse and simplicity in the calling method.

```<code>public static bool IsNumeric(this String s)
{
    try { double.Parse(s); return true; }
    catch (Exception) { return false; }
}
</code>```

I modified the method body to fit on 2 lines and removed the unnecessary .ToString() implementation. For those not familiar with extension methods here is how to implement:

Create a class file called ExtensionMethods. Paste in this code:

```<code>using System;
using System.Collections.Generic;
using System.Text;

namespace YourNameSpaceHere
{
    public static class ExtensionMethods
    {
        public static bool IsNumeric(this String s)
        {
            try { double.Parse(s); return true; }
            catch (Exception) { return false; }
        }
    }
}
</code>```

Replace YourNameSpaceHere with your actual NameSpace. Save changes. Now you can use the extension method anywhere in your app:

```<code>bool validInput = stringVariable.IsNumeric();
</code>```

Note: this method will return true for integers and decimals, but will return false if the string contains a comma. If you want to accept input with commas or symbols like "$" I would suggest implementing a method to remove those characters first then test if IsNumeric.

OwnerDisplayName: lagerdalek

Body:
What is the most efficient way of testing an input string whether it contains a numeric value (or conversely Not A Number)? I guess I can use Double.Parse or a regex (see below) but I was wondering if there is some built in way to do this, such as javascript's NaN() or IsNumeric() (was that VB, I can't remember?).

public static bool IsNumeric(this string value)
{
    return Regex.IsMatch(value, "^\\d+$");
}

LastEditorDisplayName: Iraimbilanja

Body:
This is a modified version of the solution proposed by Mr Siir. I find that adding an extension method is the best solution for reuse and simplicity in the calling method.

public static bool IsNumeric(this String s)
{
    try { double.Parse(s); return true; }
    catch (Exception) { return false; }
}

I modified the method body to fit on 2 lines and removed the unnecessary .ToString() implementation. For those not familiar with extension methods here is how to implement:

Create a class file called ExtensionMethods. Paste in this code:

using System;
using System.Collections.Generic;
using System.Text;

namespace YourNameSpaceHere
{
    public static class ExtensionMethods
    {
        public static bool IsNumeric(this String s)
        {
            try { double.Parse(s); return true; }
            catch (Exception) { return false; }
        }
    }
}

Replace YourNameSpaceHere with your actual NameSpace. Save changes. Now you can use the extension method anywhere in your app:

bool validInput = stringVariable.IsNumeric();

Note: this method will return true for integers and decimals, but will return false if the string contains a comma. If you want to accept input with commas or symbols like "$" I would suggest implementing a method to remove those characters first then test if IsNumeric.


问:
How to select only numeric values
Table1

id

```<code>01
wire
02
steve
ram123
03
....
</code>```

from the table1 i want to select only numeric values,
It should not display alphanumeric values like (ram123)

Expected Output

```<code>01
02
03
....
</code>```

How to make a query for this condition

答:
I tried the code above (ISNUMERIC()) and it somehow doesn't work in Oracle SQL.

But I found a working solution for Oracle SQL:

```<code>SELECT column1
FROM Table
WHERE regexp_like( column1, '^[[:digit:]]*$');
</code>```

From: https://community.oracle.com/thread/2394572

Title: How to select only numeric values

Body:
Table1

id

01
wire
02
steve
ram123
03
....

from the table1 i want to select only numeric values,
It should not display alphanumeric values like (ram123)

Expected Output

01
02
03
....

How to make a query for this condition

Body:
I tried the code above (ISNUMERIC()) and it somehow doesn't work in Oracle SQL.

But I found a working solution for Oracle SQL:

SELECT column1
FROM Table
WHERE regexp_like( column1, '^[[:digit:]]*$');

From: https://community.oracle.com/thread/2394572


问:
if window.location.href has 'sometext' inside - do this
Currently working on something which uses ajax for some pagination. What I'm looking to do is add something like referal=3 to the end of some links then when they go to that link I'll insert a back button with the window location for example:

User uses the ajax pagination, goes to page 3 I'll add ?ref=3 to the end of the link or something so it would like this this:

http://foo.com/somepage/?ref=3

(not sure if that's a corrent way of doing it)

Then the user clicks that link and I'll append a back button on that page with that link.

So when they go back to the homepage using the generated button the window.location.href will be:

http://foo.com?ref=3

The idea is that when they click that back button, the ajax pagination will load to page 3.

I'm not sure how else to explain this, but does anyone know how I would go about doing a conditional statement dependant on the window.location.href?

答:
I'm not sure I fully understand what you want to do, but it sounds like you want to look into using the location.hash property.

Using a jQuery plugin, such as hashchange, you can add ajax calls to the browsers history. Also, all pages will be bookmarkable. It's a pretty broad subject, but the link I provided should get you started.


问:
Discrepancy in the results of model.evaluate and model.predict in Keras
I'm performing multi-class classification with three class labels in Keras. During training, both the training and validation losses were decreasing and accuracies were increasing. After training, I tested out the model on the training set as a sanity check and there seems to be a huge discrepancy between model.evaluate and model.predict. I did find some solutions that seemed to indicate this was an issue with BatchNorm and Dropout layers, but that shouldn't result in such a huge difference. The relevant code is as shown below.

```<code>model=Sequential()
model.add(Conv2D(32, (3, 3), padding="same",input_shape=input_shape))
model.add(Activation("relu"))
model.add(BatchNormalization(axis=chanDim))
model.add(MaxPooling2D(pool_size=(3, 3)))
model.add(Dropout(0.25))
.
.
model.add(Dense(n_classes))
model.add(Activation("softmax"))

optimizer=Adam()
model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['categorical_accuracy'])

datagen = ImageDataGenerator(horizontal_flip=True, fill_mode='nearest')

train_datagen = datagen.flow(X_train, y_train, batch_size=batch_size)
val_datagen = ImageDataGenerator().flow(X_val, y_val, batch_size=batch_size)

history=model.fit(train_datagen, steps_per_epoch=math.ceil(nb_train_samples/batch_size), verbose=2, epochs=50, validation_data=val_datagen, validation_steps=math.ceil(nb_validation_samples/batch_size), class_weight=d_class_weights)

print('model.evaluate accuracy: ', model.evaluate(X_train, y_train, batch_size=batch_size)[1])
test_pred = model.predict(ImageDataGenerator().flow(X_train, y=None, batch_size=batch_size), steps=math.ceil(nb_train_samples/batch_size))
test_result=np.array(test_pred)
test_result = np.zeros(test_result.shape)
test_result[np.arange(len(test_pred)), test_pred.argmax(1)] = 1
total=0
count=0
for i in range(test_result.shape[0]):
    total+=1
    count+=(test_result[i]==y_train[i]).all()
print('model.predict accuracy: ', count/total)
</code>```

The output I get is as follows:-

```<code>66/66 [==============================] - 12s 177ms/step - loss: 0.0010 - categorical_accuracy: 1.0000
model.evaluate accuracy:  1.0
model.predict accuracy:  0.42138063279002874
</code>```

I've been trying to solve this for a while now and have failed to find anything. I'm already using categorical_crossentropy, categorical_accuracy, and softmax activation in the last layer, so I have no idea what's wrong. Any help would be greatly appreciated!

答:
I finally found the solution, turns out that I'm only passing X_train into the predict function, and the shuffle parameter is True by default, because of which the predictions didn't correspond to the ground truth. Setting shuffle=False solved the problem.

```<code>test_pred = model.predict(ImageDataGenerator().flow(X_train, y=None, batch_size=batch_size, shuffle=False), steps=math.ceil(nb_train_samples/batch_size))
</code>```

Body:
I'm performing multi-class classification with three class labels in Keras. During training, both the training and validation losses were decreasing and accuracies were increasing. After training, I tested out the model on the training set as a sanity check and there seems to be a huge discrepancy between model.evaluate and model.predict. I did find some solutions that seemed to indicate this was an issue with BatchNorm and Dropout layers, but that shouldn't result in such a huge difference. The relevant code is as shown below.

model=Sequential()
model.add(Conv2D(32, (3, 3), padding="same",input_shape=input_shape))
model.add(Activation("relu"))
model.add(BatchNormalization(axis=chanDim))
model.add(MaxPooling2D(pool_size=(3, 3)))
model.add(Dropout(0.25))
.
.
model.add(Dense(n_classes))
model.add(Activation("softmax"))

optimizer=Adam()
model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['categorical_accuracy'])

datagen = ImageDataGenerator(horizontal_flip=True, fill_mode='nearest')

train_datagen = datagen.flow(X_train, y_train, batch_size=batch_size)
val_datagen = ImageDataGenerator().flow(X_val, y_val, batch_size=batch_size)

history=model.fit(train_datagen, steps_per_epoch=math.ceil(nb_train_samples/batch_size), verbose=2, epochs=50, validation_data=val_datagen, validation_steps=math.ceil(nb_validation_samples/batch_size), class_weight=d_class_weights)

print('model.evaluate accuracy: ', model.evaluate(X_train, y_train, batch_size=batch_size)[1])
test_pred = model.predict(ImageDataGenerator().flow(X_train, y=None, batch_size=batch_size), steps=math.ceil(nb_train_samples/batch_size))
test_result=np.array(test_pred)
test_result = np.zeros(test_result.shape)
test_result[np.arange(len(test_pred)), test_pred.argmax(1)] = 1
total=0
count=0
for i in range(test_result.shape[0]):
    total+=1
    count+=(test_result[i]==y_train[i]).all()
print('model.predict accuracy: ', count/total)

The output I get is as follows:-

66/66 [==============================] - 12s 177ms/step - loss: 0.0010 - categorical_accuracy: 1.0000
model.evaluate accuracy:  1.0
model.predict accuracy:  0.42138063279002874

I've been trying to solve this for a while now and have failed to find anything. I'm already using categorical_crossentropy, categorical_accuracy, and softmax activation in the last layer, so I have no idea what's wrong. Any help would be greatly appreciated!

Body:
I finally found the solution, turns out that I'm only passing X_train into the predict function, and the shuffle parameter is True by default, because of which the predictions didn't correspond to the ground truth. Setting shuffle=False solved the problem.

test_pred = model.predict(ImageDataGenerator().flow(X_train, y=None, batch_size=batch_size, shuffle=False), steps=math.ceil(nb_train_samples/batch_size))


问:
JQuery to check for duplicate ids in a DOM
I'm writing applications with ASP.NET MVC. In contrast to traditional ASP.NET you're a lot more responsible for creating all the ids in your generated page. ASP.NET would give you nasty, but unique ids.

I'd like to add a quick little jQuery script to check my document for duplicate ids. They may be ids for DIVS, images, checkboxes, buttons etc.

```<code><div id="pnlMain"> My main panel </div>
<div id="pnlMain"> Oops we accidentally used the same ID </div>
</code>```

I'm looking for a set and forget type utility that'll just warn me when I do something careless.

Yes i'd be using this only during testing, and alternatives (such as firebug plugins) are welcome too.

答:
The top jQuery answer, rewritten in ES6:</p>
```<code>  [...document.querySelectorAll('[id]')].forEach(el => {
    const dups = document.querySelectorAll(`[id="${el.id}"]`);

    if (dups[1] === el) {
      console.error(`Duplicate IDs #${el.id}`, ...dups);
    }
  });
</code>```

OwnerDisplayName: Simon

ContentLicense: CC BY-SA 2.5

Body:
I'm writing applications with ASP.NET MVC. In contrast to traditional ASP.NET you're a lot more responsible for creating all the ids in your generated page. ASP.NET would give you nasty, but unique ids.

I'd like to add a quick little jQuery script to check my document for duplicate ids. They may be ids for DIVS, images, checkboxes, buttons etc.

 My main panel

 Oops we accidentally used the same ID

I'm looking for a set and forget type utility that'll just warn me when I do something careless.

Yes i'd be using this only during testing, and alternatives (such as firebug plugins) are welcome too.

LastEditorDisplayName: Simon

Body:
The top jQuery answer, rewritten in ES6:

  [...document.querySelectorAll('[id]')].forEach(el => {
    const dups = document.querySelectorAll(`[id="${el.id}"]`);

    if (dups[1] === el) {
      console.error(`Duplicate IDs #${el.id}`, ...dups);
    }
  });


问:
Cannot find module @angular\cli\bin\ng
I'm getting into trouble with anngular-cli installation because it doesn't recognize the ng command in my git bash but it works in my cmd on Windows 7.

I looked for some issues on the web but I didn't really find a solution.

Here, the error :

```<code>   ng -v
   module.js:549
    throw err;
    ^

   Error: Cannot find module 'C:\Program
   Files\Git\node_modules\@angular\cli\bin\ng'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
</code>```

This error happened the first time I used ng after installing Node and angular-cli globally.

I didn't get this error when I was working on my laptop on Windows 10.

答: I faced the same problem but running npm install solved my problem.

Title: Cannot find module @angular\cli\bin\ng

Body:
I'm getting into trouble with anngular-cli installation because it doesn't recognize the ng command in my git bash but it works in my cmd on Windows 7.

I looked for some issues on the web but I didn't really find a solution.

Here, the error :

   ng -v
   module.js:549
    throw err;
    ^

   Error: Cannot find module 'C:\Program
   Files\Git\node_modules\@angular\cli\bin\ng'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

This error happened the first time I used ng after installing Node and angular-cli globally.

I didn't get this error when I was working on my laptop on Windows 10.


问:
helm chart "stable/mongodb-replicaset" is stuck when 2nd pods bootstraps / is added to replicaset
Version of Helm and Kubernetes:

Kubernetes (GKE):
Client Version: v1.9.7
Server Version: 1.10.6-gke.2

Helm: 2.10.0
Server: v2.10.0

Which chart:

stable/mongodb-replicaset

What happened:

Summary: 1st Pod started correct. 2nd Pod is stuck at "Init:2/3"

Details:
I wanna setup a mongodb replicaset with 3 replicas. I want to use authentication and TLS with X509 for authentication.
Here are the contents of my values.yaml file used for helm install:

```<code>replicas: 3
port: 27018

replicaSetName: rs0

podDisruptionBudget: {}
  # maxUnavailable: 1
  # minAvailable: 2

auth:
  enabled: true
  adminUser: admin
  adminPassword: pass1234
  metricsUser: metrics
  metricsPassword: pass1234
  key: abcdefghijklmnopqrstuvwxyz1234567890
  #existingKeySecret:
  #existingAdminSecret:
  #exisitingMetricsSecret:

# Specs for the Docker image for the init container that establishes the replica set
installImage:
  repository: k8s.gcr.io/mongodb-install
  tag: 0.6

  pullPolicy: IfNotPresent

# Specs for the MongoDB image
image:
  repository: mongo
  #tag: 3.6
  tag: latest
  pullPolicy: IfNotPresent

# Additional environment variables to be set in the container
extraVars: {}
# - name: TCMALLOC_AGGRESSIVE_DECOMMIT
#   value: "true"

# Prometheus Metrics Exporter
metrics:
  enabled: false
  image:
    repository: ssalaues/mongodb-exporter
    tag: 0.6.1
    pullPolicy: IfNotPresent
  port: 9216
  path: "/metrics"
  socketTimeout: 3s
  syncTimeout: 1m
  prometheusServiceDiscovery: true
  resources: {}

# Annotations to be added to MongoDB pods
podAnnotations: {}

securityContext:
  runAsUser: 999
  fsGroup: 999
  runAsNonRoot: true

resources:
  limits:
  #   cpu: 100m
    memory: 512Mi
  requests:
#   cpu: 100m
    memory: 256Mi

## Node selector
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
nodeSelector: {}

affinity: {}

tolerations: []

extraLabels: {}

persistentVolume:
  enabled: true
  ## mongodb-replicaset data Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  storageClass: "standard"
  accessModes:
    - ReadWriteOnce
  size: 10Gi
  annotations: {}

# Annotations to be added to the service
serviceAnnotations: {}

tls:
  # Enable or disable MongoDB TLS support
  enabled: true
  # Please generate your own TLS CA by generating it via:
  # $ openssl genrsa -out ca.key 2048
  # $ openssl req -x509 -new -nodes -key ca.key -days 10000 -out ca.crt -subj "/CN=mydomain.com"
  # After that you can base64 encode it and paste it here:
  # $ cat ca.key | base64 -w0
  cacert: base64 encoded ca certificate goes here
  cakey: base64 encoded ca key goes here

# Entries for the MongoDB config file
configmap:
  storage:
    dbPath: /data/db
  net:
    port: 27018
    ssl:
      mode: requireSSL
      CAFile: /data/configdb/tls.crt
      PEMKeyFile: /work-dir/mongo.pem
  replication:
    replSetName: rs0
  security:
    authorization: enabled
    clusterAuthMode: x509
    keyFile: /data/configdb/key.txt

# Readiness probe
readinessProbe:
  initialDelaySeconds: 5
  timeoutSeconds: 1
  failureThreshold: 3
  periodSeconds: 10
  successThreshold: 1

# Liveness probe
livenessProbe:
  initialDelaySeconds: 30
  timeoutSeconds: 5
  failureThreshold: 3
  periodSeconds: 10
  successThreshold: 1
</code>```

I've installed the chart using:

```<code>helm install --name mongo-test -f values.yaml stable/mongodb-replicaset
</code>```

helm installs first without any problems - no error messages during install:

```<code>NAME:   mongo-test
LAST DEPLOYED: Wed Aug 29 16:40:43 2018
NAMESPACE: b2c
STATUS: DEPLOYED

RESOURCES:
==> v1/Secret
NAME                                   TYPE               DATA  AGE
mongo-test-mongodb-replicaset-admin    Opaque             2     0s
mongo-test-mongodb-replicaset-ca       kubernetes.io/tls  2     0s
mongo-test-mongodb-replicaset-keyfile  Opaque             1     0s

==> v1/ConfigMap
NAME                                   DATA  AGE
mongo-test-mongodb-replicaset-init     1     0s
mongo-test-mongodb-replicaset-mongodb  1     0s
mongo-test-mongodb-replicaset-tests    1     0s

==> v1/Service
NAME                           TYPE       CLUSTER-IP  EXTERNAL-IP  PORT(S)    AGE
mongo-test-mongodb-replicaset  ClusterIP  None        <none>       27018/TCP  0s

==> v1beta2/StatefulSet
NAME                           DESIRED  CURRENT  AGE
mongo-test-mongodb-replicaset  3        1        0s

==> v1/Pod(related)
NAME                             READY  STATUS   RESTARTS  AGE
mongo-test-mongodb-replicaset-0  0/1    Pending  0         0s
</code>```

The 1st Pod is then started correctly and without any problems.
2nd Pod is stuck at "Init:2/3"

```<code>NAME                                          READY     STATUS     RESTARTS   AGE
po/mongo-test-mongodb-replicaset-0            1/1       Running    0          5m
po/mongo-test-mongodb-replicaset-1            0/1       Init:2/3   0          5m
</code>```

when I connect to mongo-test-mongodb-replicaset-1 -c bootstrap I can find the following inside /work-dir/log.txt:

```<code>mongodb@mongo-test-mongodb-replicaset-1:/work-dir$ more log.txt
[2018-08-29T14:41:51,684293796+00:00] [on-start.sh] Bootstrapping MongoDB replica set member: mongo-test-mongodb-replicaset-1
[2018-08-29T14:41:51,687394595+00:00] [on-start.sh] Reading standard input...
[2018-08-29T14:41:51,688594499+00:00] [on-start.sh] Generating certificate
[2018-08-29T14:41:51,951181683+00:00] [on-start.sh] Peers: mongo-test-mongodb-replicaset-0.mongo-test-mongodb-replicaset.b2c.svc.cluster.local
[2018-08-29T14:41:51,952080311+00:00] [on-start.sh] Starting a MongoDB instance...
[2018-08-29T14:41:51,953075555+00:00] [on-start.sh] Waiting for MongoDB to be ready...
2018-08-29T14:41:52.020+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] MongoDB starting : pid=30 port=27017 dbpath=/data/db 64-bit host=mongo-test-mongodb-replicaset-1
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] db version v4.0.1
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] git version: 54f1582fc6eb01de4d4c42f26fc133e623f065fb
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] modules: none
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] build environment:
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten]     distarch: x86_64
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] options: { config: "/data/configdb/mongod.conf", net: { bindIp: "0.0.0.0", port: 27017, ssl: { CAFile: "/data/configdb/tls.crt", PEMKeyFile: "/work-dir/mongo.pem", mode: "requireSS
L" } }, replication: { replSet: "rs0" }, security: { authorization: "enabled", clusterAuthMode: "x509", keyFile: "/data/configdb/key.txt" }, storage: { dbPath: "/data/db" } }
2018-08-29T14:41:52.047+0000 I STORAGE  [initandlisten]
2018-08-29T14:41:52.047+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-08-29T14:41:52.047+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-08-29T14:41:52.048+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1337M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=jou
rnal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
[2018-08-29T14:41:52,083645436+00:00] [on-start.sh] Retrying...
2018-08-29T14:41:52.789+0000 I STORAGE  [initandlisten] WiredTiger message [1535553712:789699][30:0x7fd33c091a00], txn-recover: Set global recovery timestamp: 0
2018-08-29T14:41:52.800+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2018-08-29T14:41:52.819+0000 I STORAGE  [initandlisten] createCollection: local.startup_log with generated UUID: 2a15f25a-5f7b-47d3-b1a3-2338677428d0
2018-08-29T14:41:52.832+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-08-29T14:41:52.833+0000 I STORAGE  [initandlisten] createCollection: local.replset.oplogTruncateAfterPoint with generated UUID: ae87a21f-d2dc-4474-b4de-d70d95b7a2a8
2018-08-29T14:41:52.847+0000 I STORAGE  [initandlisten] createCollection: local.replset.minvalid with generated UUID: ffaf5c08-356c-4ed0-b4e0-1b3d9cdeea92
2018-08-29T14:41:52.866+0000 I REPL     [initandlisten] Did not find local voted for document at startup.
2018-08-29T14:41:52.866+0000 I REPL     [initandlisten] Did not find local Rollback ID document at startup. Creating one.
2018-08-29T14:41:52.866+0000 I STORAGE  [initandlisten] createCollection: local.system.rollback.id with generated UUID: 6e3e4fc7-b821-4df6-9c32-7db2af4a3bc4
2018-08-29T14:41:52.880+0000 I REPL     [initandlisten] Initialized the rollback ID to 1
2018-08-29T14:41:52.880+0000 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument: Did not find replica set configuration document in local.system.replset
2018-08-29T14:41:52.881+0000 I CONTROL  [LogicalSessionCacheRefresh] Sessions collection is not set up; waiting until next sessions refresh interval: Replication has not yet been configured
2018-08-29T14:41:52.881+0000 I CONTROL  [LogicalSessionCacheReap] Sessions collection is not set up; waiting until next sessions reap interval: Replication has not yet been configured
2018-08-29T14:41:52.881+0000 I NETWORK  [initandlisten] waiting for connections on port 27017 ssl
2018-08-29T14:41:54.148+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:50022 #1 (1 connection now open)
2018-08-29T14:41:54.154+0000 I ACCESS   [conn1] note: no users configured in admin.system.users, allowing localhost access
2018-08-29T14:41:54.154+0000 I NETWORK  [conn1] received client metadata from 127.0.0.1:50022 conn1: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.1" }, os: { type: "Linux", name: "Ub
untu", architecture: "x86_64", version: "16.04" } }
2018-08-29T14:41:54.157+0000 I ACCESS   [conn1] Unauthorized: not authorized on admin to execute command { endSessions: [ { id: UUID("95760764-878a-4dd0-8ce6-470182c48a3a") } ], $db: "admin" }
2018-08-29T14:41:54.158+0000 I NETWORK  [conn1] end connection 127.0.0.1:50022 (0 connections now open)
[2018-08-29T14:41:54,162283712+00:00] [on-start.sh] Initialized.
[2018-08-29T14:41:54,267062979+00:00] [on-start.sh] Found master: mongo-test-mongodb-replicaset-0.mongo-test-mongodb-replicaset.b2c.svc.cluster.local
[2018-08-29T14:41:54,268004950+00:00] [on-start.sh] Adding myself (mongo-test-mongodb-replicaset-1.mongo-test-mongodb-replicaset.b2c.svc.cluster.local) to replica set...
2018-08-29T14:41:54.368+0000 I NETWORK  [listener] connection accepted from 10.43.67.35:50550 #2 (1 connection now open)
2018-08-29T14:41:54.371+0000 I ACCESS   [conn2]  authenticate db: $external { authenticate: 1, mechanism: "MONGODB-X509", user: "CN=mongo-test-mongodb-replicaset-0", $db: "$external" }
2018-08-29T14:41:54.371+0000 I ACCESS   [conn2] Failed to authenticate CN=mongo-test-mongodb-replicaset-0@$external from client 10.43.67.35:50550 with mechanism MONGODB-X509: UserNotFound: Could not find user CN=mongo-test-mongodb-repli
caset-0@$external
2018-08-29T14:41:54.372+0000 I NETWORK  [conn2] end connection 10.43.67.35:50550 (0 connections now open)
2018-08-29T14:41:54.375+0000 I NETWORK  [listener] connection accepted from 10.43.67.35:50552 #3 (1 connection now open)
2018-08-29T14:41:54.378+0000 I NETWORK  [conn3] received client metadata from 10.43.67.35:50552 conn3: { driver: { name: "NetworkInterfaceTL", version: "4.0.1" }, os: { type: "Linux", name: "Ubuntu", architecture: "x86_64", version: "16
.04" } }
2018-08-29T14:41:54.379+0000 I ACCESS   [conn3]  authenticate db: $external { authenticate: 1, mechanism: "MONGODB-X509", user: "CN=mongo-test-mongodb-replicaset-0", $db: "$external" }
2018-08-29T14:41:54.379+0000 I ACCESS   [conn3] Failed to authenticate CN=mongo-test-mongodb-replicaset-0@$external from client 10.43.67.35:50552 with mechanism MONGODB-X509: UserNotFound: Could not find user CN=mongo-test-mongodb-repli
caset-0@$external
[2018-08-29T14:41:57,388632734+00:00] [on-start.sh] Waiting for replica to reach SECONDARY state...
2018-08-29T14:41:57.441+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:50032 #4 (2 connections now open)
2018-08-29T14:41:57.446+0000 I NETWORK  [conn4] received client metadata from 127.0.0.1:50032 conn4: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.1" }, os: { type: "Linux", name: "Ub
untu", architecture: "x86_64", version: "16.04" } }
2018-08-29T14:41:57.448+0000 I ACCESS   [conn4] Supported SASL mechanisms requested for unknown user 'admin@admin'
2018-08-29T14:41:57.448+0000 I ACCESS   [conn4] SASL SCRAM-SHA-1 authentication failed for admin on admin from client 127.0.0.1:50032 ; UserNotFound: Could not find user admin@admin
2018-08-29T14:41:57.450+0000 I ACCESS   [conn4] Unauthorized: not authorized on admin to execute command { endSessions: [ { id: UUID("38098891-2b34-46eb-aef2-53a69416671f") } ], $db: "admin" }
2018-08-29T14:41:57.451+0000 I NETWORK  [conn4] end connection 127.0.0.1:50032 (1 connection now open)
2018-08-29T14:41:58.504+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:50034 #5 (2 connections now open)
2018-08-29T14:41:58.508+0000 I NETWORK  [conn5] received client metadata from 127.0.0.1:50034 conn5: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.1" }, os: { type: "Linux", name: "Ub
untu", architecture: "x86_64", version: "16.04" } }
2018-08-29T14:41:58.509+0000 I ACCESS   [conn5] Supported SASL mechanisms requested for unknown user 'admin@admin'
2018-08-29T14:41:58.510+0000 I ACCESS   [conn5] SASL SCRAM-SHA-1 authentication failed for admin on admin from client 127.0.0.1:50034 ; UserNotFound: Could not find user admin@admin
2018-08-29T14:41:58.511+0000 I ACCESS   [conn5] Unauthorized: not authorized on admin to execute command { endSessions: [ { id: UUID("e1089881-4c47-450c-9721-6b291c6f0e50") } ], $db: "admin" }
2018-08-29T14:41:58.512+0000 I NETWORK  [conn5] end connection 127.0.0.1:50034 (1 connection now open)
2018-08-29T14:41:59.574+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:50036 #6 (2 connections now open)
2018-08-29T14:41:59.582+0000 I NETWORK  [conn6] received client metadata from 127.0.0.1:50036 conn6: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.1" }, os: { type: "Linux", name: "Ub
untu", architecture: "x86_64", version: "16.04" } }
</code>```

....to be continued...

答: Configure initContainer by setting volumePermissions.enabled to true. </p>

Body:
Version of Helm and Kubernetes:

Kubernetes (GKE):
Client Version: v1.9.7
Server Version: 1.10.6-gke.2

Helm: 2.10.0
Server: v2.10.0

Which chart:

stable/mongodb-replicaset

What happened:

Summary: 1st Pod started correct. 2nd Pod is stuck at "Init:2/3"

Details:
I wanna setup a mongodb replicaset with 3 replicas. I want to use authentication and TLS with X509 for authentication.
Here are the contents of my values.yaml file used for helm install:

replicas: 3
port: 27018

replicaSetName: rs0

podDisruptionBudget: {}
  # maxUnavailable: 1
  # minAvailable: 2

auth:
  enabled: true
  adminUser: admin
  adminPassword: pass1234
  metricsUser: metrics
  metricsPassword: pass1234
  key: abcdefghijklmnopqrstuvwxyz1234567890
  #existingKeySecret:
  #existingAdminSecret:
  #exisitingMetricsSecret:

# Specs for the Docker image for the init container that establishes the replica set
installImage:
  repository: k8s.gcr.io/mongodb-install
  tag: 0.6

  pullPolicy: IfNotPresent

# Specs for the MongoDB image
image:
  repository: mongo
  #tag: 3.6
  tag: latest
  pullPolicy: IfNotPresent

# Additional environment variables to be set in the container
extraVars: {}
# - name: TCMALLOC_AGGRESSIVE_DECOMMIT
#   value: "true"

# Prometheus Metrics Exporter
metrics:
  enabled: false
  image:
    repository: ssalaues/mongodb-exporter
    tag: 0.6.1
    pullPolicy: IfNotPresent
  port: 9216
  path: "/metrics"
  socketTimeout: 3s
  syncTimeout: 1m
  prometheusServiceDiscovery: true
  resources: {}

# Annotations to be added to MongoDB pods
podAnnotations: {}

securityContext:
  runAsUser: 999
  fsGroup: 999
  runAsNonRoot: true

resources:
  limits:
  #   cpu: 100m
    memory: 512Mi
  requests:
#   cpu: 100m
    memory: 256Mi

## Node selector
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
nodeSelector: {}

affinity: {}

tolerations: []

extraLabels: {}

persistentVolume:
  enabled: true
  ## mongodb-replicaset data Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  storageClass: "standard"
  accessModes:
    - ReadWriteOnce
  size: 10Gi
  annotations: {}

# Annotations to be added to the service
serviceAnnotations: {}

tls:
  # Enable or disable MongoDB TLS support
  enabled: true
  # Please generate your own TLS CA by generating it via:
  # $ openssl genrsa -out ca.key 2048
  # $ openssl req -x509 -new -nodes -key ca.key -days 10000 -out ca.crt -subj "/CN=mydomain.com"
  # After that you can base64 encode it and paste it here:
  # $ cat ca.key | base64 -w0
  cacert: base64 encoded ca certificate goes here
  cakey: base64 encoded ca key goes here

# Entries for the MongoDB config file
configmap:
  storage:
    dbPath: /data/db
  net:
    port: 27018
    ssl:
      mode: requireSSL
      CAFile: /data/configdb/tls.crt
      PEMKeyFile: /work-dir/mongo.pem
  replication:
    replSetName: rs0
  security:
    authorization: enabled
    clusterAuthMode: x509
    keyFile: /data/configdb/key.txt

# Readiness probe
readinessProbe:
  initialDelaySeconds: 5
  timeoutSeconds: 1
  failureThreshold: 3
  periodSeconds: 10
  successThreshold: 1

# Liveness probe
livenessProbe:
  initialDelaySeconds: 30
  timeoutSeconds: 5
  failureThreshold: 3
  periodSeconds: 10
  successThreshold: 1

I've installed the chart using:

helm install --name mongo-test -f values.yaml stable/mongodb-replicaset

helm installs first without any problems - no error messages during install:

NAME:   mongo-test
LAST DEPLOYED: Wed Aug 29 16:40:43 2018
NAMESPACE: b2c
STATUS: DEPLOYED

RESOURCES:
==> v1/Secret
NAME                                   TYPE               DATA  AGE
mongo-test-mongodb-replicaset-admin    Opaque             2     0s
mongo-test-mongodb-replicaset-ca       kubernetes.io/tls  2     0s
mongo-test-mongodb-replicaset-keyfile  Opaque             1     0s

==> v1/ConfigMap
NAME                                   DATA  AGE
mongo-test-mongodb-replicaset-init     1     0s
mongo-test-mongodb-replicaset-mongodb  1     0s
mongo-test-mongodb-replicaset-tests    1     0s

==> v1/Service
NAME                           TYPE       CLUSTER-IP  EXTERNAL-IP  PORT(S)    AGE
mongo-test-mongodb-replicaset  ClusterIP  None        <none>       27018/TCP  0s

==> v1beta2/StatefulSet
NAME                           DESIRED  CURRENT  AGE
mongo-test-mongodb-replicaset  3        1        0s

==> v1/Pod(related)
NAME                             READY  STATUS   RESTARTS  AGE
mongo-test-mongodb-replicaset-0  0/1    Pending  0         0s

The 1st Pod is then started correctly and without any problems.
2nd Pod is stuck at "Init:2/3"

NAME                                          READY     STATUS     RESTARTS   AGE
po/mongo-test-mongodb-replicaset-0            1/1       Running    0          5m
po/mongo-test-mongodb-replicaset-1            0/1       Init:2/3   0          5m

when I connect to mongo-test-mongodb-replicaset-1 -c bootstrap I can find the following inside /work-dir/log.txt:

mongodb@mongo-test-mongodb-replicaset-1:/work-dir$ more log.txt
[2018-08-29T14:41:51,684293796+00:00] [on-start.sh] Bootstrapping MongoDB replica set member: mongo-test-mongodb-replicaset-1
[2018-08-29T14:41:51,687394595+00:00] [on-start.sh] Reading standard input...
[2018-08-29T14:41:51,688594499+00:00] [on-start.sh] Generating certificate
[2018-08-29T14:41:51,951181683+00:00] [on-start.sh] Peers: mongo-test-mongodb-replicaset-0.mongo-test-mongodb-replicaset.b2c.svc.cluster.local
[2018-08-29T14:41:51,952080311+00:00] [on-start.sh] Starting a MongoDB instance...
[2018-08-29T14:41:51,953075555+00:00] [on-start.sh] Waiting for MongoDB to be ready...
2018-08-29T14:41:52.020+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] MongoDB starting : pid=30 port=27017 dbpath=/data/db 64-bit host=mongo-test-mongodb-replicaset-1
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] db version v4.0.1
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] git version: 54f1582fc6eb01de4d4c42f26fc133e623f065fb
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] modules: none
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] build environment:
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten]     distarch: x86_64
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2018-08-29T14:41:52.045+0000 I CONTROL  [initandlisten] options: { config: "/data/configdb/mongod.conf", net: { bindIp: "0.0.0.0", port: 27017, ssl: { CAFile: "/data/configdb/tls.crt", PEMKeyFile: "/work-dir/mongo.pem", mode: "requireSS
L" } }, replication: { replSet: "rs0" }, security: { authorization: "enabled", clusterAuthMode: "x509", keyFile: "/data/configdb/key.txt" }, storage: { dbPath: "/data/db" } }
2018-08-29T14:41:52.047+0000 I STORAGE  [initandlisten]
2018-08-29T14:41:52.047+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-08-29T14:41:52.047+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-08-29T14:41:52.048+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1337M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=jou
rnal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
[2018-08-29T14:41:52,083645436+00:00] [on-start.sh] Retrying...
2018-08-29T14:41:52.789+0000 I STORAGE  [initandlisten] WiredTiger message [1535553712:789699][30:0x7fd33c091a00], txn-recover: Set global recovery timestamp: 0
2018-08-29T14:41:52.800+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2018-08-29T14:41:52.819+0000 I STORAGE  [initandlisten] createCollection: local.startup_log with generated UUID: 2a15f25a-5f7b-47d3-b1a3-2338677428d0
2018-08-29T14:41:52.832+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-08-29T14:41:52.833+0000 I STORAGE  [initandlisten] createCollection: local.replset.oplogTruncateAfterPoint with generated UUID: ae87a21f-d2dc-4474-b4de-d70d95b7a2a8
2018-08-29T14:41:52.847+0000 I STORAGE  [initandlisten] createCollection: local.replset.minvalid with generated UUID: ffaf5c08-356c-4ed0-b4e0-1b3d9cdeea92
2018-08-29T14:41:52.866+0000 I REPL     [initandlisten] Did not find local voted for document at startup.
2018-08-29T14:41:52.866+0000 I REPL     [initandlisten] Did not find local Rollback ID document at startup. Creating one.
2018-08-29T14:41:52.866+0000 I STORAGE  [initandlisten] createCollection: local.system.rollback.id with generated UUID: 6e3e4fc7-b821-4df6-9c32-7db2af4a3bc4
2018-08-29T14:41:52.880+0000 I REPL     [initandlisten] Initialized the rollback ID to 1
2018-08-29T14:41:52.880+0000 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument: Did not find replica set configuration document in local.system.replset
2018-08-29T14:41:52.881+0000 I CONTROL  [LogicalSessionCacheRefresh] Sessions collection is not set up; waiting until next sessions refresh interval: Replication has not yet been configured
2018-08-29T14:41:52.881+0000 I CONTROL  [LogicalSessionCacheReap] Sessions collection is not set up; waiting until next sessions reap interval: Replication has not yet been configured
2018-08-29T14:41:52.881+0000 I NETWORK  [initandlisten] waiting for connections on port 27017 ssl
2018-08-29T14:41:54.148+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:50022 #1 (1 connection now open)
2018-08-29T14:41:54.154+0000 I ACCESS   [conn1] note: no users configured in admin.system.users, allowing localhost access
2018-08-29T14:41:54.154+0000 I NETWORK  [conn1] received client metadata from 127.0.0.1:50022 conn1: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.1" }, os: { type: "Linux", name: "Ub
untu", architecture: "x86_64", version: "16.04" } }
2018-08-29T14:41:54.157+0000 I ACCESS   [conn1] Unauthorized: not authorized on admin to execute command { endSessions: [ { id: UUID("95760764-878a-4dd0-8ce6-470182c48a3a") } ], $db: "admin" }
2018-08-29T14:41:54.158+0000 I NETWORK  [conn1] end connection 127.0.0.1:50022 (0 connections now open)
[2018-08-29T14:41:54,162283712+00:00] [on-start.sh] Initialized.
[2018-08-29T14:41:54,267062979+00:00] [on-start.sh] Found master: mongo-test-mongodb-replicaset-0.mongo-test-mongodb-replicaset.b2c.svc.cluster.local
[2018-08-29T14:41:54,268004950+00:00] [on-start.sh] Adding myself (mongo-test-mongodb-replicaset-1.mongo-test-mongodb-replicaset.b2c.svc.cluster.local) to replica set...
2018-08-29T14:41:54.368+0000 I NETWORK  [listener] connection accepted from 10.43.67.35:50550 #2 (1 connection now open)
2018-08-29T14:41:54.371+0000 I ACCESS   [conn2]  authenticate db: $external { authenticate: 1, mechanism: "MONGODB-X509", user: "CN=mongo-test-mongodb-replicaset-0", $db: "$external" }
2018-08-29T14:41:54.371+0000 I ACCESS   [conn2] Failed to authenticate CN=mongo-test-mongodb-replicaset-0@$external from client 10.43.67.35:50550 with mechanism MONGODB-X509: UserNotFound: Could not find user CN=mongo-test-mongodb-repli
caset-0@$external
2018-08-29T14:41:54.372+0000 I NETWORK  [conn2] end connection 10.43.67.35:50550 (0 connections now open)
2018-08-29T14:41:54.375+0000 I NETWORK  [listener] connection accepted from 10.43.67.35:50552 #3 (1 connection now open)
2018-08-29T14:41:54.378+0000 I NETWORK  [conn3] received client metadata from 10.43.67.35:50552 conn3: { driver: { name: "NetworkInterfaceTL", version: "4.0.1" }, os: { type: "Linux", name: "Ubuntu", architecture: "x86_64", version: "16
.04" } }
2018-08-29T14:41:54.379+0000 I ACCESS   [conn3]  authenticate db: $external { authenticate: 1, mechanism: "MONGODB-X509", user: "CN=mongo-test-mongodb-replicaset-0", $db: "$external" }
2018-08-29T14:41:54.379+0000 I ACCESS   [conn3] Failed to authenticate CN=mongo-test-mongodb-replicaset-0@$external from client 10.43.67.35:50552 with mechanism MONGODB-X509: UserNotFound: Could not find user CN=mongo-test-mongodb-repli
caset-0@$external
[2018-08-29T14:41:57,388632734+00:00] [on-start.sh] Waiting for replica to reach SECONDARY state...
2018-08-29T14:41:57.441+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:50032 #4 (2 connections now open)
2018-08-29T14:41:57.446+0000 I NETWORK  [conn4] received client metadata from 127.0.0.1:50032 conn4: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.1" }, os: { type: "Linux", name: "Ub
untu", architecture: "x86_64", version: "16.04" } }
2018-08-29T14:41:57.448+0000 I ACCESS   [conn4] Supported SASL mechanisms requested for unknown user 'admin@admin'
2018-08-29T14:41:57.448+0000 I ACCESS   [conn4] SASL SCRAM-SHA-1 authentication failed for admin on admin from client 127.0.0.1:50032 ; UserNotFound: Could not find user admin@admin
2018-08-29T14:41:57.450+0000 I ACCESS   [conn4] Unauthorized: not authorized on admin to execute command { endSessions: [ { id: UUID("38098891-2b34-46eb-aef2-53a69416671f") } ], $db: "admin" }
2018-08-29T14:41:57.451+0000 I NETWORK  [conn4] end connection 127.0.0.1:50032 (1 connection now open)
2018-08-29T14:41:58.504+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:50034 #5 (2 connections now open)
2018-08-29T14:41:58.508+0000 I NETWORK  [conn5] received client metadata from 127.0.0.1:50034 conn5: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.1" }, os: { type: "Linux", name: "Ub
untu", architecture: "x86_64", version: "16.04" } }
2018-08-29T14:41:58.509+0000 I ACCESS   [conn5] Supported SASL mechanisms requested for unknown user 'admin@admin'
2018-08-29T14:41:58.510+0000 I ACCESS   [conn5] SASL SCRAM-SHA-1 authentication failed for admin on admin from client 127.0.0.1:50034 ; UserNotFound: Could not find user admin@admin
2018-08-29T14:41:58.511+0000 I ACCESS   [conn5] Unauthorized: not authorized on admin to execute command { endSessions: [ { id: UUID("e1089881-4c47-450c-9721-6b291c6f0e50") } ], $db: "admin" }
2018-08-29T14:41:58.512+0000 I NETWORK  [conn5] end connection 127.0.0.1:50034 (1 connection now open)
2018-08-29T14:41:59.574+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:50036 #6 (2 connections now open)
2018-08-29T14:41:59.582+0000 I NETWORK  [conn6] received client metadata from 127.0.0.1:50036 conn6: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.1" }, os: { type: "Linux", name: "Ub
untu", architecture: "x86_64", version: "16.04" } }

....to be continued...


问:
removing from array is not calling set
I have a list

```<code>List {
    ForEach (appState.foo.indices, id: \.self) { fooIndex in
        Text(foo[fooIndex].name)
    }
    .onDelete(perform: self.deleteRow)
}
</code>```

with a function that deletes a row from the foo array:

```<code>private func deleteRow(at indexSet: IndexSet) {
    self.appState.foo.remove(atOffsets: indexSet)
}
</code>```

and an observable object that acts as an environment object in the view with the list:

```<code>class AppState: ObservableObject {

    var foo: [Bar] {
        set {
            if let encoded = try? JSONEncoder().encode(newValue) {
            let defaults = UserDefaults.standard
                 defaults.set(encoded, forKey: "foo")
            }
            objectWillChange.send()
            self.myFunc()
        }
        get {
            if let savedTrainings = UserDefaults.standard.object(forKey: "trainings") as? Data,
                let loadedTraining = try? JSONDecoder().decode([Training].self, from: savedTrainings) {
                return loadedTraining
            }
            return []
        }
    }
// ....
    func myFunc() {
        print("I'm not printing when you delete a row")
    }
}
</code>```

How can I get my myFunc() triggered when I delete a row?

答:
Use stored property instead of a computed property. To fix your issue modify the foo property in AppState like this:

struct Bar: Encodable { }

class AppState: ObservableObject {
    var foo: [Bar] {
        didSet {
            if let encoded = try? JSONEncoder().encode(foo) {
                 UserDefaults.standard.set(encoded, forKey: "foo")
            }
            objectWillChange.send()
            myFunc()
        }
    }
    init() {
        if let data = UserDefaults.standard.data(forKey: "foo"),
            let savedFoo = try? JSONDecoder().decode([Bar].self, from: data) {
            foo = savedFoo
        } else {
            foo = []
        }
    }
    func myFunc() {
        print("I'm not printing when you delete a row")
    }
}
```

Title: removing from array is not calling set

Body:
I have a list

List {
    ForEach (appState.foo.indices, id: \.self) { fooIndex in
        Text(foo[fooIndex].name)
    }
    .onDelete(perform: self.deleteRow)
}

with a function that deletes a row from the foo array:

private func deleteRow(at indexSet: IndexSet) {
    self.appState.foo.remove(atOffsets: indexSet)
}

and an observable object that acts as an environment object in the view with the list:

class AppState: ObservableObject {

    var foo: [Bar] {
        set {
            if let encoded = try? JSONEncoder().encode(newValue) {
            let defaults = UserDefaults.standard
                 defaults.set(encoded, forKey: "foo")
            }
            objectWillChange.send()
            self.myFunc()
        }
        get {
            if let savedTrainings = UserDefaults.standard.object(forKey: "trainings") as? Data,
                let loadedTraining = try? JSONDecoder().decode([Training].self, from: savedTrainings) {
                return loadedTraining
            }
            return []
        }
    }
// ....
    func myFunc() {
        print("I'm not printing when you delete a row")
    }
}

How can I get my myFunc() triggered when I delete a row?


问:
How to load sqlite extension in PDO?
First, I want to inform about the case to avoid the misunderstanding.

By sqlite extension, I mention Sqlite's extension like FTS, not PHP's sqlite extension.

I have been using PDO Sqlite in my application, it cannot be changed.

As I saw here, Sqlite extensions can be loaded as query seen below:

```<code>SELECT load_extension('xyz.so');
$db = new PDO ( 'sqlite:qwert.db' );
$db->query("SELECT load_extension('myextension.so');");
$db->query("SELECT myfunction(name) FROM table");
$rows = $db->fetchAll(PDO::FETCH_CLASS, 'stdClass');
</code>```

Note: myfunction is method of myextension

But when I test with this query from PDO, it return "not authorized" message.

For only testing purpose, I tried PHP's Sqlite3 extension to load the extension by using the code below:

```<code>$db = new SQLite3('qwer.db');
$db->loadExtension('xyz.so');
</code>```

It works

As I know that PDO Sqlite hasnot a method like loadExtension for loading extensions

Any idea how can I handle this?

答: I have implemented a library with a solution for this problem for PHP 7.4+ which does not involve recompiling the PDO driver. In short, it uses PHP's FFI extension and Z-Engine (which reads PHP's internal memory structures using FFI) to make a direct call to the SQLite C API. You can find more detailed background information in this blog post. I would not recommend this solution in production yet, but it could be a feasible workaround for test or development workflows.</p>

Title: How to load sqlite extension in PDO?

Body:
First, I want to inform about the case to avoid the misunderstanding.

By sqlite extension, I mention Sqlite's extension like FTS, not PHP's sqlite extension.

I have been using PDO Sqlite in my application, it cannot be changed.

As I saw here, Sqlite extensions can be loaded as query seen below:

SELECT load_extension('xyz.so');
$db = new PDO ( 'sqlite:qwert.db' );
$db->query("SELECT load_extension('myextension.so');");
$db->query("SELECT myfunction(name) FROM table");
$rows = $db->fetchAll(PDO::FETCH_CLASS, 'stdClass');

Note: myfunction is method of myextension

But when I test with this query from PDO, it return "not authorized" message.

For only testing purpose, I tried PHP's Sqlite3 extension to load the extension by using the code below:

$db = new SQLite3('qwer.db');
$db->loadExtension('xyz.so');

It works

As I know that PDO Sqlite hasnot a method like loadExtension for loading extensions

Any idea how can I handle this?


问:
Trouble mapping json to golang struct
I have a json stream as follows ...

```<code>[
  {
    "page": 1,
    "pages": 7,
    "per_page": "2000",
    "total": 13200
  },
  [
    {
      "indicator": {
        "id": "SP.POP.TOTL",
        "value": "Population, total"
      },
      "country": {
        "id": "1A",
        "value": "Arab World"
      },
      "value": null,
      "decimal": "0",
      "date": "2019"
    },
    {
      "indicator": {
        "id": "SP.POP.TOTL",
        "value": "Population, total"
      },
      "country": {
        "id": "1A",
        "value": "Arab World"
      },
      "value": "419790588",
      "decimal": "0",
      "date": "2018"
    },
   ...
   ]
]
</code>```

And I'm trying to decode it ... so I have the following struct ... but I keep getting
"cannot unmarshal array into Go value of type struct { P struct ... "

```<code>type Message []struct {
        P struct {
                Page int
        }
        V []struct {
                Indicator struct {
                        Id    string
                        Value string
                }
                Country struct {
                        Value string
                }
                Value   string
                Decimal string
                Date    string
        }
}
</code>```

My struct looks to match the json ... but obviously not! Any ideas?

答:
Looking at your struct, your corresponding JSON should look something like this.

```<code>[
    {
        "P": {"page": 1},
        "V": [
            {
                "Indicator": {"Id": ...},
                "Country": {"Value":""},
                "Value": "",
                ...
            }
        ]
    },
    ...
]
</code>```

The JSON structure you are trying to Unmarshal looks like a list of objects where each object is not of the same type. You can start unmarshalling them into interfaces and defining each interface based on the object being unmarhsalled.

```<code>package main

import (
    "encoding/json"
    "log"
)

type Message []interface{}

func main() {
    data := `[{"page":1,"pages":7,"per_page":"2000","total":13200},[{"indicator":{"id":"SP.POP.TOTL","value":"Population, total"},"country":{"id":"1A","value":"Arab World"},"value":null,"decimal":"0","date":"2019"},{"indicator":{"id":"SP.POP.TOTL","value":"Population, total"},"country":{"id":"1A","value":"Arab World"},"value":"419790588","decimal":"0","date":"2018"}]]`

    var m Message
    if err := json.Unmarshal([]byte(data), &m); err != nil {
        log.Fatalf("could not unmarshal")
    }

    log.Printf("message: %v", m)
}
</code>```

Output:

```<code>message: [map[page:1 pages:7 per_page:2000 total:13200] [map[country:map[id:1A value:Arab World] date:2019 decimal:0 indicator:map[id:SP.POP.TOTL value:Population, total] value:<nil>] map[country:map[id:1A value:Arab World] date:2018 decimal:0 indicator:map[id:SP.POP.TOTL value:Population, total] value:419790588]]]
</code>```

[Edit]: Ideally you should change your JSON to be structured better for unmarshalling. If you do not have control on it, then your corresponding Go structure is just embedded maps of string to interfaces, which you will have to manually type cast and access.

Title: Trouble mapping json to golang struct

Body:
I have a json stream as follows ...

[
  {
    "page": 1,
    "pages": 7,
    "per_page": "2000",
    "total": 13200
  },
  [
    {
      "indicator": {
        "id": "SP.POP.TOTL",
        "value": "Population, total"
      },
      "country": {
        "id": "1A",
        "value": "Arab World"
      },
      "value": null,
      "decimal": "0",
      "date": "2019"
    },
    {
      "indicator": {
        "id": "SP.POP.TOTL",
        "value": "Population, total"
      },
      "country": {
        "id": "1A",
        "value": "Arab World"
      },
      "value": "419790588",
      "decimal": "0",
      "date": "2018"
    },
   ...
   ]
]

And I'm trying to decode it ... so I have the following struct ... but I keep getting
"cannot unmarshal array into Go value of type struct { P struct ... "

type Message []struct {
        P struct {
                Page int
        }
        V []struct {
                Indicator struct {
                        Id    string
                        Value string
                }
                Country struct {
                        Value string
                }
                Value   string
                Decimal string
                Date    string
        }
}

My struct looks to match the json ... but obviously not! Any ideas?

Body:
Looking at your struct, your corresponding JSON should look something like this.

[
    {
        "P": {"page": 1},
        "V": [
            {
                "Indicator": {"Id": ...},
                "Country": {"Value":""},
                "Value": "",
                ...
            }
        ]
    },
    ...
]

The JSON structure you are trying to Unmarshal looks like a list of objects where each object is not of the same type. You can start unmarshalling them into interfaces and defining each interface based on the object being unmarhsalled.

package main

import (
    "encoding/json"
    "log"
)

type Message []interface{}

func main() {
    data := `[{"page":1,"pages":7,"per_page":"2000","total":13200},[{"indicator":{"id":"SP.POP.TOTL","value":"Population, total"},"country":{"id":"1A","value":"Arab World"},"value":null,"decimal":"0","date":"2019"},{"indicator":{"id":"SP.POP.TOTL","value":"Population, total"},"country":{"id":"1A","value":"Arab World"},"value":"419790588","decimal":"0","date":"2018"}]]`

    var m Message
    if err := json.Unmarshal([]byte(data), &m); err != nil {
        log.Fatalf("could not unmarshal")
    }

    log.Printf("message: %v", m)
}

Output:

message: [map[page:1 pages:7 per_page:2000 total:13200] [map[country:map[id:1A value:Arab World] date:2019 decimal:0 indicator:map[id:SP.POP.TOTL value:Population, total] value:<nil>] map[country:map[id:1A value:Arab World] date:2018 decimal:0 indicator:map[id:SP.POP.TOTL value:Population, total] value:419790588]]]

[Edit]: Ideally you should change your JSON to be structured better for unmarshalling. If you do not have control on it, then your corresponding Go structure is just embedded maps of string to interfaces, which you will have to manually type cast and access.


问:
SAPUI5 Fileuploader upload not triggered if file to upload is set via setValue
In SAPUI5 I am using fileuploader to to upload file to gateway service.

Functionality works if I select file using by pressing "Browse" button, however if I set file path using using setValue() and after that call upload() function, file upload is not triggered. There are no errors in the browser.

This is the same behavior if I press upload button, but file path is not set. I suspect that there something additional that I need to set, but I have no idea what is that. Below is the code

UI

```<code><u:FileUploader id="fileUploader"
                tooltip="Select file to upload"
                width="415px"
                icon="sap-icon://add-document"
                uploadOnChange="false"
                sendXHR="true"
                uploadUrl="/sap/opu/odata/sap/ZUPLOAD_DOC_SRV/Upload_DocSet"
                useMultipart="false"
                uploadStart="onUploadStart"
                uploadComplete="handleUploadComplete"
                sameFilenameAllowed="true"
                change="onChange"/>
</code>```

Controller

```<code>var oFileUploader = this.byId("fileUploader");
oFileUploader.removeAllHeaderParameters(oCustomerHeaderToken);
oFileUploader.setValue("C:\\TEMP\\test.txt");

oCustomerHeaderToken = new sap.ui.unified.FileUploaderParameter({
    name: "x-csrf-token",
    value: oFileUploader.getModel().getSecurityToken()
});

oFileUploader.addHeaderParameter(oCustomerHeaderToken);
var oSlug = new sap.ui.unified.FileUploaderParameter({
        name: "slug",
        value: slugTemp
    });

oFileUploader.addHeaderParameter(oSlug);
oFileUploader.upload();
</code>```

Can someone help me with this?

答:
For security reasons this is not allowed in JavaScript by Browsers. This has nothing to do with UI5, it is a general security measure.

If it was allowed a script could access ALL your files by generating random paths, read them and upload them to ANY server.

In some browsers it's possible to access a sandboxed environment but it's unlikely that this will help you.

Accessing the complete hard drive is impossible (at the moment).

Body:
In SAPUI5 I am using fileuploader to to upload file to gateway service.

Functionality works if I select file using by pressing "Browse" button, however if I set file path using using setValue() and after that call upload() function, file upload is not triggered. There are no errors in the browser.

This is the same behavior if I press upload button, but file path is not set. I suspect that there something additional that I need to set, but I have no idea what is that. Below is the code

UI

<u:FileUploader id="fileUploader"
                tooltip="Select file to upload"
                width="415px"
                icon="sap-icon://add-document"
                uploadOnChange="false"
                sendXHR="true"
                uploadUrl="/sap/opu/odata/sap/ZUPLOAD_DOC_SRV/Upload_DocSet"
                useMultipart="false"
                uploadStart="onUploadStart"
                uploadComplete="handleUploadComplete"
                sameFilenameAllowed="true"
                change="onChange"/>

Controller

var oFileUploader = this.byId("fileUploader");
oFileUploader.removeAllHeaderParameters(oCustomerHeaderToken);
oFileUploader.setValue("C:\\TEMP\\test.txt");

oCustomerHeaderToken = new sap.ui.unified.FileUploaderParameter({
    name: "x-csrf-token",
    value: oFileUploader.getModel().getSecurityToken()
});

oFileUploader.addHeaderParameter(oCustomerHeaderToken);
var oSlug = new sap.ui.unified.FileUploaderParameter({
        name: "slug",
        value: slugTemp
    });

oFileUploader.addHeaderParameter(oSlug);
oFileUploader.upload();

Can someone help me with this?


问:
Is there a JavaScript function to serialize and unserialize arrays like PHP?
I'm making a PHP model to store a serialized array in a database. The array is then accessed via AJAX through an HTTP request.

Is there a JavaScript function to serialize and unserialize arrays like PHP?

EDIT: This is the php function http://uk.php.net/manual/en/function.serialize.php

答:
Sorry for the (almost an year :) ) late response, but i just saw this.

Since i can only place one link, i will give you this one: http://phpjs.org/functions/index

Search for "serialize" and "unserialize" and you'll find them. I had to send serialized data to the server, and PHP works perfectly with the results of these functions.

Be sure to also take a look at the dependencies and get those functions as well.

Best of luck!