text:
Q: What is the intuition behind difference-in-differences with continuous treatment? It's very clear to me how a difference-in-difference model works when there is a binary treatment. If the model is $y_{i,t}=\beta_{0}+\beta_{1}P_{t}+\beta_{2}T_{i}+\beta_{3}(P_{t}*T_{t})+u_{i,t}$ where $P_{t}$ is a dummy for the time period after a policy and $T_{i}$ is a dummy for the treatment. It is clear that difference-in-differences will give us $\beta_{3}$ as the average differential change in $y$ from one period to the next relative to the control group $\bigg(\big((\beta_{0}+\beta_{1}+\beta_{2}+\beta_{3})-(\beta_{0}+\beta_{2})\big)-\big((\beta_{0}+\beta_{1})-\beta_{0}\big)\bigg)=\beta_{3}$.
I'm currently studying a model, however, that looks like the following: $y_{i,t}=\beta_{0}+\beta_{1}(\Delta T*P_{t})+u_{i,t}$ where $\Delta T$ is the change in education funding from a year before a certain policy to a year after a certain policy and is continuous. In this case, how do I show that this is still using the difference-in-difference approach as before? I'm struggling to see the link.


text:
Q: Accessing PHP functions that are in an iFrame from parent document So I am trying to access a PHP function, from the parent HTML document, that is in an iFrame which is loaded with a remote PHP file.  The whole reason that I am doing it this way, is because I am using goDaddys Website Builder, which does not allow a user to upload PHP scripts.  So I uploaded a PHP file for testing on my own FTP and was able to access the PHP file by linking the src of the iFrame to the URL of the PHP file on my FTP server.
So far I am just testing to see if this will even work, so the function right now is very simple.
Here is the html:
<iframe id="targetFrame" src="http://terrefhosting.net/arcpickup/test.php" style="width: 90%;    height: 300px;"></iframe>
<input onclick="alert('test0'); phpFunction();" type="button" value="Click me"></input>

Here is the JavaScript:
function phpFunction(){
  alert("test1");
  alert(document.getElementById('targetFrame').contentWindow.mailReceipt());
  alert("test2");
}

Here is the code in my php file:
<?php

function mailReceipt(){
  return "test";
}

?>

When I click the button that runs phpFunction onClick,  I get up to alert ("test1"); which means to me that this line in the javascript is failing:
alert(document.getElementById('targetFrame').contentWindow.mailReceipt());

A: Use AJAX. When a user causes an event to be triggered your Javascript uses the XMLHttpRequest object to send the request to your server.
Then another Javascript function or event gives a place to work with the server output.
*
The OP provided solution:
onclick = loadXMLDoc();

function loadXMLDoc() {
var xmlhttp;
if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari
 xmlhttp=new XMLHttpRequest();
}
else { // code for IE6, IE5
 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

xmlhttp.onreadystatechange=function() {
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
 {
    document.getElementById("targetFrame").innerHTML=xmlhttp.responseText;
 }
}
 var url = "http://******hosting.net/arcpickup/test.php";
 xmlhttp.open("GET", url , true);
 xmlhttp.send();
}

php:
<?php
echo "test";
?>

redpajama_set_name: RedPajamaStackExchange


text:
Q: PHP - returning multiple states, not just true/false I have a conceptual problem to do with PHP classes and error handling.. Below is a basic class demonstrating my issue.
A function to create a database record exists named "domain_create". This function calls a secondary function to ensure that the domain to be created does not already exist within the database table.
In the past I have always used true or false to reflect if the function had found a record, but that creates a flaw in my logic.. Records are inserted when the domain_lu function returns false, however should be done if an error is encountered such as the select failing? Returning false would cause the create function to believe nothing has been found and continue with the create process..
My question is how should multiple states be reflected in this scenario? Is there a "best practise" for this scenario?
<?php

require_once('auth.base.class.php');
require_once('mysql.class.php');

class auth extends base
{
   public function __construct()
   {
      parent::__construct();
   }

   /*
    * User
    */

   public function domain_create($args='')
   {
      if ( domain_lu($args['dname']) === FALSE )
      {
         return $error['Domain already in use'];
      }
   }

   /*
    * Domain
    */

   private function domain_lu($dname)
   {
      $sql = "SELECT name FROM domain WHERE name = '$dname'";
      $this->_mysql->SQLQuery($sql);

      if ($this->_mysql->numRow() > 0) return true;
      else return false;
   }
}

?>

A: You should use Exceptions. If there's a query error throw an exception stating the reason for failure. If the domain already exists, throw an exception stating that the domain exists already. Here's a very simple example:
   public function domain_create($args='')
   {
      if (!$this->domain_lu($args['dname']))
          throw new Exception('domain already in use');
   }

   private function domain_lu($dname)
   {
      $sql = "SELECT name FROM domain WHERE name = '$dname'";
      $this->_mysql->SQLQuery($sql); // SQLQuery should throw an exception if it fails
      return ($this->_mysql->numRow() > 0);
   }

You should really create specialized exception classes so user can catch the specific exception without relying on the exception message alone, the PHP docs have more info on that. But basically doing things this way will bail out from the function as soon as an exception is thrown, and go back as long as there's code that catches the exception. Or if it's not caught anywhere, PHP will terminate the script.

A: You have two choices: use exceptions or define error constants, like
class auth extends base
{
   const E_OK = 0;
   const E_NOTFOUND = 1;
   const E_FAILURE = 2;
//[snip]

   private function domain_lu($dname)
   {
      $sql = "SELECT name FROM domain WHERE name = '$dname'";
      if(!$this->_mysql->SQLQuery($sql)) return self::E_FAILURE;
      if ($this->_mysql->numRow() > 0) return self::E_OK;
      else return self::E_NOTFOUND;
   }
}

A: IMO, you are tackling this at the wrong place. If you need to ensure a database column cannot contain duplicate values, you should create this column with a UNIQUE key constraint:

A UNIQUE index creates a constraint such that all values in the index must be distinct. An error occurs if you try to add a new row with a key value that matches an existing row. For all engines, a UNIQUE  index permits multiple NULL values for columns that can contain NULL.

DB roundtrips are usually bottlenecks in applications, so this has the advantage that you do not need to dispatch two queries against your database (one to check, one to insert). Just run your query and see if it was successful and if not, get and return the error or throw appropriate Exceptions.


text:
Q: how to input in the debug window while debugging Xcode 4 iPhone app How can I input data with getchar() or scanf() by typing into the debugger window (where printf output goes to) while debugging an iPhone app in Xcode 4?
I want to be able to quickly input control parameters just whil debugging.
(I'll add sliders later.)
thanks.

A: You can call methods from the console, so you could change mutable objects, like
[myDictionary setObject:@"some value" forKey:@"key"]


text:
Q: How to determine the currency code of a given stock using libraries in R? I am currently working with quantmod library in R. Using quantmod, I can get the prices of the required indexes, stocks and equities from yahoo finance. Some of these asset classes are in Canadian dollar and some are in USD. Is it possible to get the names of these indexes and their corresponding currency code using R.
Name of Index                           Currency code
S&P/TSX Composite index                      CAD
Dow Jones Industrial Average                 USD


text:
Q: Counting Frequency of Characters in a string C++ I'm trying to count the frequency of letters in a string input. I'm having some trouble and I don't exactly know what I'm doing incorrectly. I'm getting weird outputs, like smiley faces. I want my code to do something like this, if the string is "abcdc"
a - 1
b - 1
c - 2
d - 1
      #include <iostream>
using namespace std;

class moose
{
    char inputbuffer[132];
    char countbuffer[122];
    long count;
    short index = 0;
public:
    char charcount();
    char charinput();
    char initialize();

};

int main()
{
    moose obj;
    obj.initialize();
    obj.charinput();
    obj.charcount();
    system("pause");

}

char moose::initialize()
{
    for (int i = 0; i < 122; i++)
        countbuffer[i] = 0;
    return 0;

}

char moose::charinput()
{
    cout << "Enter your text and I'll read your characters" << endl;
    cin.getline(inputbuffer, 132);
    cin.gcount();
    count = cin.gcount();
    count--;
    return 0;
}

char moose::charcount()
{
    for (int i = 0; i < count; i++)
    {
        if (inputbuffer[i] >= 'a' & inputbuffer[i] <= 'z') {
            index = inputbuffer[i];
            countbuffer[index]++;

        }
        for (i = 0; i < count; i++)
        {
            cout << inputbuffer[i] << " - " << countbuffer[index] << endl;
        }
    }

    return 0;
}

A: You have several issues with the code:

*

*The moose::charinput() method contains extra call to gcount(). You need only this statement: count = cin.gcount();. The count--; should not be there, too.

*The condition inside moose::charcount() has to be
if (inputbuffer[i] >= 'a' && inputbuffer[i] <= 'z')

*The moose::charcount() should have two distinct loops:
    char moose::charcount()
    {
        for (int i = 0; i < count; i++)
        {
            if (inputbuffer[i] >= 'a' && inputbuffer[i] <= 'z') {
                index = inputbuffer[i];
                countbuffer[index]++;
            }
        }
        for (i = 0; i < count; i++)
        {
            cout << inputbuffer[i] << " - " << countbuffer[inputbuffer[i]] << endl;
        }
        return 0;
    }

*countbuffer has to be declared is int to be printed properly


text:
Q: Replace string taken from another column in pandas I am trying to do a replace across one column of a pandas dataframe like the below.
From:
a          b
house      ho
cheese     ee
king       ng

To:
a        b
use      ho
chse     ee
ki       ng

My attempt is to use:
df['a'] = df['a'].str.replace(df['b'], "")

but I get TypeError: 'Series' objects are mutable, thus they cannot be hashed
I have done it by iterating row by row across the dataframe but its 200,000 rows so would take hours. Does anyone know how I can make this work?

A: Because performance is important here is possible use list comprehension with replace for replace per rows:
df['a'] = [a.replace(b, "") for a, b in df[['a','b']].values]

Another solution is slowier with DataFrame.apply:
df['a'] = df.apply(lambda x: x.a.replace(x.b, ""), axis=1)

print (df)
      a   b
0   use  ho
1  chse  ee
2    ki  ng


text:
Q: Transform sub-queries to joins I have three tables: userProfile, loginTimes, orders.
I am trying get each user's profile row, his last login time, and his last order row.
Here's my query:
Select u.*, t.loginTime, orders.* From userProfiles u

Inner Join

(Select userId, MAX(time) loginTime From loginTimes Group By userID) t

On u.userId = t.userID

Inner Join
(Select userId, MAX(enterDate) orderDate From orders Group By userId) o

On u.userID = o.userID

Inner Join
orders On orders.userId = u.userId And orders.enterDate = o.orderDate

Is there any way to rewrite without so many sub queries?

A: OP I think this is the query you are going for, this still requires 2 subqueries, but I don't believe your original query functioned as intended.
You could remove the loginTimes subquery, and use MAX(loginTime) in the outer SELECT list, but then you'd need to GROUP BY every field in the order table, which is arguably just as unclean.
The following query retrieves the UserId, latest LoginTime and the entire order record for the user's most recent order:
SELECT u.userId,
       u.userName,
       l.loginTime,
       o.*
FROM userProfiles u
INNER JOIN ( SELECT userId,
                   loginTime = MAX(time)
             FROM loginTimes
             GROUP BY userID) l ON u.userId = l.userId
INNER JOIN ( SELECT *,
             rowNum = ROW_NUMBER() OVER (PARTITION BY userId
                                         ORDER BY enterDate DESC)
             FROM orders) o ON u.userId = o.userId AND o.rowNum = 1

Working on SQLFiddle

A: I believe this will do:
SELECT u.userID
      ,u.otherColumn
      ,MAX(t.time) AS loginTime
      ,MAX(o.enterDate) AS orderDate
FROM userProfiles u
JOIN loginTimes t ON t.userID = u.userID
JOIN orders o ON o.userID = u.userID
GROUP BY u.userID, u.otherColumn

For every other column in userProfiles you add to the SELECT clause, you need to add it to the GROUP BY clause as well..
Update:
Just because it can be done.. I tried it without any subquery :)
SELECT u.userID
      ,MAX(t.time) AS loginTime
      ,o.*
FROM userProfiles u
JOIN loginTimes t ON t.userID = u.userID
JOIN orders o ON o.userID = u.userID
LEFT JOIN orders o1 ON o.userID = o1.userID AND o.enterDate < o1.enterDate
WHERE o1.orderID IS NULL
GROUP BY u.userID
        ,o.* --write out the fields here

You'll have to write down the fields of the orders table you want in the select clause in your GROUP BY clause also.

A: You can easily re-write the aggregation with the following.
-- Aggregation

(
SELECT
  T.userId,
  MAX(time) as loginTime,
  MAX(enterDate) as orderDate
FROM
  loginTimes as T INNER JOIN orders as O
ON
  T.userId = O.userId
GROUP BY
  T.userId
)

However, I do not understand why you are calculating MAX(enterDate) and not using it.
The two tables that are joined without aggregation is easy also.  You should stay away from using *.  It is just wasted overhead if all the fields are not being used.
SELECT
  U.*, O.*
FROM
  userProfiles as U
INNER JOIN
  orders as O
ON O.userId = U.userId

Please explain what you are trying to return as values from the Query.  What is the business logic?


text:
Q: What component allows DIP to be connected with Dupont style jumper wires? (sorry for the n00b/cringey question!) I've order an ADC chip and I realized upon receiving it that standard Dupont style jumper wires don't fit on standard integrated chips pins.  I was wondering if an IC to jumper wire connector/socket even exists and if so, then what it's called.
Basically, what I'm aiming for is a single component that combines a DIP socket (at least 2x8 pins) and Dupont style jump wire header pins so that I can push my IC in that socket and connect jumper wires without any soldering.
The closest I could find is this guy who made himself a couple ones with breadboard, but does that exist as a single standard component?
Thx

A: You might look into wire wrap sockets which look like this
Or you could use a breadboard:

If you are ok with using jumper cables with one end having a male pin, you can push your IC into the breadboard and use your jumpers to connect to it. Breadboards are pretty standard for electronics prototyping, and typically people plug their components into them and use short jumpers to make connections where required.


text:
Q: HTTPS SEO and Canonical As i have now https version of my website is it seo friendly to have "permanently moved" status 301, 200 and redirect the http url to https ?
I am using .htaccess to do this
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Here is the example of the non http url test:
Go to https://httpstatus.io/ and test url http://sunnybeachtaxi.com/from-Sunny-Beach-to-Burgas-airport-options-Burgas-1-4-35/book/
returns 301, 200
Now another question is what canonical url should i use http or https ? I know google prefers https but still not sure. At the moment http urls are indexed and https are not becouse they appear to google as dublicates.
What is the best steps to achive this ? Should i first remove the http urls and then submit to google index the https ones?
Thanks

A: If you want to permanent redirect from HTTP to HTTPS then you should first of all purchase SSL certificate and activate it for your site. Nowadays google does not allow some site which is running without HTTPS. Just add SSL to your site and you do not need to submit it again into google webmaster just because of that if you have update time to time sitemap of your website. crawler automatically understand.
What is canonical URL's?
A canonical tag is a different way of telling search engines that a specific URL represents the master copy of a page. visit this SEO MOZ page for more information. https://moz.com/learn/seo/canonicalization
Thank you in advance


text:
Q: How to preserve the newlines of the input while taking it from input()? I'm currently working on a simple script where i want to take the input from the console. This input is a python code snippet. While writing the input in the file, overall alignment is improper.
For an eg:
model_def = str(input("Paste the defination of the classifier used :"))
f = open("classifier.py","w+")
f.write(model_def)
f.close()

Input was provided something like that:
class classifier(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(2208, 500)
        self.fc2 = nn.Linear(500, 256)
        self.fc3 = nn.Linear(256, 3)
        self.dropout = nn.Dropout(0.5)
        self.logsoftmax = nn.LogSoftmax(dim=1)
        self.acivation = relu
    def forward(self,x):
        x = x.view(x.size(0), -1)
        x = self.dropout(self.acivation(self.fc1(x)))
        x = self.dropout(self.acivation(self.fc2(x)))

        x = self.logsoftmax(self.fc3(x))
        return x

Saving it results in an improper alignment.
class classifier(nn.Module):     def __init__(self):         super().__init__()         self.fc1 = nn.Linear(2208, 500)         self.fc2 = nn.Linear(500, 256)         self.fc3 = nn.Linear(256, 3)         self.dropout = nn.Dropout(0.5)         self.logsoftmax = nn.LogSoftmax(dim=1)         self.acivation = relu     def forward(self,x):         x = x.view(x.size(0), -1)         x = self.dropout(self.acivation(self.fc1(x)))         x = self.dropout(self.acivation(self.fc2(x)))          x = self.logsoftmax(self.fc3(x))         return x

A: You have to read from input until EOF. You can raise EOF with Ctrl-D or Ctrl-Z (windows):
Python 3
print("Paste the defination of the classifier used. Ctrl-D or Ctrl-Z ( windows ) to save it.")
contents = []
while True:
    try:
        line = input()
    except EOFError:
        break
    contents.append(line)

f = open("classifier.py","w+")
for line in contents:
    f.write("%s\n" % line)
f.close()

A: Try this one:
lines = []
line = input()
while line:
    lines.append(line)
    line = input()
print(lines)

Inputting will break with first empty line. As a result you will get list of lines then you can break them up however you prefer.
E.g. windows:
lines_str = "\r\n".join(lines)

Ref: https://www.reddit.com/r/Python/comments/2y6f7x/reading_multiple_lines_of_input/

A: You might use sys.stdin.read() instead of input:
import sys

data = sys.stdin.read()

Hit Ctrl+D/Ctrl+Z when you're done with providing input.


text:
Q: Mean of two normal distributions Suppose I have two normal distributions of measurement taken with different instruments. What is the best strategy to calculate weighted mean of two distributions if error distributions of both the instruments is unknown? Is it possible?

A: The sum of two independent normal variables is normal random variable, e.g. $x\sim\mathcal{N}(\mu_x,\sigma_x^2)$ and $y\sim\mathcal{N}(\mu_y,\sigma_y^2)$ will get you $$\alpha x+(1-\alpha)y\sim\mathcal{N}(\alpha\mu_x+(1-\alpha)\mu_y,\alpha^2\sigma_x^2+(1-\alpha)^2\sigma_y^2)$$
Here, you could use $\alpha=\frac{1}{2}$ for an equal weight mean.
If you assume that both instruments are unbiased, then you actually have a simpler situation:
$$x\sim\mathcal{N}(\mu,\sigma_x^2)$$
$$y\sim\mathcal{N}(\mu,\sigma_y^2)$$
In this case you assume that in average both instruments are accurate(as defined by IUPAC), i.e. have no bias. However, their precision is different $\sigma_x,\sigma_y$.
Let's construct a weighted estimator
$$\hat\mu=\alpha x + (1-\alpha) y$$
Let's look at its characteristics:
$$E[\hat\mu]=\alpha\mu+(1-\alpha)\mu=\mu $$
Good, it's unbiased regardless of the weight $\alpha$, i.e. it's accurate.
Let's see what's its precision:
$$Var[\hat\mu]=\alpha^2\sigma_x^2+(1-\alpha)^2\sigma_y^2$$
The independence assumption of normal variables is usually reasonable for instrument measurements unless they're affected with the same exact random shocks, which may happen in certain setups but not usually encountered.
In this case the the optimal
$$\alpha=\frac{\sigma_y^2}{\sigma_x^2+\sigma_y^2}$$
You can see that if the precisions are the same, the weight is $\alpha=1/2$. Otherwise, if the first instrument twice more precise, e.g. $\sigma_x=\sigma_y/2$ then you get $$\alpha=\frac{4}{4+1}=0.8$$

A: I will edit this answer into a more elaborate one later in the day.
You can consider the geodesic between your two densities and pick-up the distribution at the mid-distance. These densities have an hyperbolic geometry under the Fisher-Rao metric. You can google SIR Costa Information Geometry for detailed computations and close-form expressions.


text:
Q: ERROR:"javah" failed to generate header I have been stuck in this for few days. kindly help me to get rid of this.
Error is

Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class nam
  e: D:/Android/androidProjects/OpenCV/openCVLibrary/build/intermediates/classes/debug
  :
          at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:129)
          at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:107)
          at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:64)
          at com.sun.tools.javah.JavahTask.run(JavahTask.java:503)
          at com.sun.tools.javah.JavahTask.run(JavahTask.java:329)
          at com.sun.tools.javah.Main.main(Main.java:46)


text:
Q: PHP - How to SCP local file from BASH OSX to remote via SSH with Password in PHP? I want PHP to send myfile.txt to remote SSH which uses a password for login.
From OSX bash I use this command to send file manually:
scp /Users/myname/Documents/myfile.txt root@192.168.1.116:/Docs/myfile.txt

Since I need to do it via PHP, I made this upload.sh bash script:
#!/usr/bin/expect
spawn scp /Users/myname/Documents/myfile.txt root@192.168.1.116:/Docs/myfile.txt
expect "root@192.168.1.116's password:"
send "mYpassWORD\r"
interact

I can run this above code with: ./update.sh in terminal and it sends the file as I want.
Now problem is when I add this bash script in PHP, it dont send the file.
I have tried:
exec('/Library/WebServer/update.sh 2>&1', $output);
print_r($output);

And I am stuck at this error/msg:
Array
(
    [0] => spawn scp /Users/myname/Documents/myfile.txt root@192.168.1.116:/Docs/myfile.txt
    [1] => root@192.168.1.116's password:
)

In bash the password is sent and all is Ok, via PHP it dont uploads the file.
I also noticed first time I run it via PHP it said SSH Host Keys Dont match, so I copied .ssh folder to server root location and that error is gone.
Can anyone please help how to make it work?
Thank you

A: Working as expected, but not a rocksolid solution.
I found a solution and got it working but not sure if this is the correct way.
The problem is not Password related. The problem is/was: The Bash script is too FAST. Or maybe PHP is too fast?
Anyway I solved my problem by adding sleep after send "mYpassWORD\r".
Here is my working Bash command which I access from PHP to send file to remote with password:
#!/usr/bin/expect
spawn scp /Library/WebServer/Documents/test34/myfile.txt root@192.168.1.116:/Docs/myfile.txt
expect "root@192.168.1.116's password:"
send "mYpassWORD\r"
sleep 0.2
interact

I saved this as: update.sh and did chmod +x update.sh
Then in PHP file: index.php i wrote:
<?php
$do = shell_exec("(/Library/WebServer/Documents/test34/update.sh)");
var_dump($do);
?>

And got this SUCCESS result:
string(320) "spawn scp /Library/WebServer/Documents/test34/myfile.txt root@192.168.1.116:/Docs/myfile.txt
root@192.168.1.116's password:

myfile.txt                                  0%    0     0.0KB/s   --:-- ETA
myfile.txt                                100% 3649     3.6KB/s   00:00
"

So just adding sleep 0.2in Bash script solved the problem.
I also tried sleep 0.1 but then I got error. Therefore the sleep time might be depended on how big is your file? myfile.txt was only 3.6kb and 0.2 seconds sleep works great.
If your file is bigger you can try sleep 1 or sleep 5 etc..
This method works and solves the problem but doesn't feel secure since it might fail if file size varies on every call or if there is a slow ssh connection.
If anyone can contribute to improve this answer I will highly appreciate it.


text:
Q: Unable to open connection pool to SQL Server through r2dbc I'm getting an error when I'm trying to get a SQL Server connection pool.
Maven:
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>accessing-data-r2dbc</artifactId>
<version>0.1.0</version>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<name>R2DBC</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.9</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.projectreactor</groupId>
        <artifactId>reactor-spring</artifactId>
        <version>1.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-r2dbc</artifactId>
    </dependency>
    <dependency>
        <groupId>io.r2dbc</groupId>
        <artifactId>r2dbc-mssql</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>
    <dependency>
      <groupId>io.r2dbc</groupId>
      <artifactId>r2dbc-pool</artifactId>
      <version> 0.8.3.RELEASE </version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <scope>provided</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

</project>

Using ReactiveCrudRepository:
public class R2DBCConfiguration extends AbstractR2dbcConfiguration {
    @Bean
    @Override
    public ConnectionFactory  connectionFactory() {
        ConnectionFactory connectionFactory = ConnectionFactories.get(ConnectionFactoryOptions.builder()
                   .option(ConnectionFactoryOptions.DRIVER, "pool")
                   .option(ConnectionFactoryOptions.PROTOCOL, "mssql") // driver identifier, PROTOCOL is delegated as DRIVER by the pool.
                   .option(ConnectionFactoryOptions.HOST, HOST)
                   .option(ConnectionFactoryOptions.PORT, PORT)
                   .option(ConnectionFactoryOptions.USER, user)
                   .option(ConnectionFactoryOptions.PASSWORD, passwd)
                   .option(ConnectionFactoryOptions.DATABASE, mydatabase)
                   .option(MAX_SIZE, 30)
                   .build());
         ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration.builder(connectionFactory)
                    .maxIdleTime(Duration.ofMinutes(30))
                    .initialSize(10)
                    .maxSize(10)
                    .maxCreateConnectionTime(Duration.ofSeconds(1))
                    .build();

        return new ConnectionPool(configuration);
    }

}

I can get the connection through MssqlConnectionFactory but we are finding errors when we need to update more than 1000 records concurrently , so I think a Connection Pool should be more suitable for us.
This is the test code:
@Test
    void simpleTest() {
        pushMesgApiRepository.findAllPushStatus("4")
        .subscribe(
            obj -> {
                obj.setPUSH_TIME((new java.util.Date()).toInstant()
                                      .atZone(ZoneId.systemDefault()).toLocalDateTime());

                pushMesgApiRepository.save(obj)
                .subscribe(
                        elem->{
                            System.out.println("Register updated: " + elem);                        },
                        err->{
                            System.out.println("Register failed: "  + obj);
                            err.printStackTrace();
                        });
            },
            err->err.getSuppressed());

        }

This is the error I'm getting:
2020-07-28 16:01:59.552  INFO 9648 --- [           main] com.example.demo.DemoApplicationTests    : Starting DemoApplicationTests on LAPTOP-NQ3UUEE1 with PID 9648 (started by Banana in D:\MyWorkSpace\R2DBC\R2DBC)
2020-07-28 16:01:59.554  INFO 9648 --- [           main] com.example.demo.DemoApplicationTests    : No active profile set, falling back to default profiles: default
2020-07-28 16:01:59.925  INFO 9648 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data R2DBC repositories in DEFAULT mode.
2020-07-28 16:02:00.058  INFO 9648 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 128ms. Found 1 R2DBC repository interfaces.
2020-07-28 16:02:00.654  WARN 9648 --- [           main] io.r2dbc.pool.ConnectionPool             : Creating ConnectionPool using another ConnectionPool [ConnectionPool[Microsoft SQL Server]] as ConnectionFactory
2020-07-28 16:02:01.371  INFO 9648 --- [           main] com.example.demo.DemoApplicationTests    : Started DemoApplicationTests in 2.15 seconds (JVM running for 3.297)
2020-07-28 16:02:01.808  WARN 9648 --- [extShutdownHook] o.s.b.f.support.DisposableBeanAdapter    : Destroy method 'close' on bean with name 'connectionFactory' threw an exception: java.lang.NoSuchMethodError: 'boolean reactor.pool.InstrumentedPool.isDisposed()'

I've also tried to do it through DatabaseClient object instead ReactiveCRUDRepository
ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration.builder(connectionFactory)
                    .maxIdleTime(Duration.ofMinutes(30))
                    .initialSize(10)
                    .maxSize(30)
                    //.maxCreateConnectionTime(Duration.ofSeconds(1))
                    .build();

        client = DatabaseClient.create(new ConnectionPool(configuration));

And I got a more detailed error message: (it seems to me the error is related with the dependencies)
2020-07-28 16:17:33.785 ERROR 5928 --- [ctor-http-nio-1] reactor.core.publisher.Operators         : Operator called default onErrorDropped

java.lang.NoSuchMethodError: 'reactor.core.publisher.Mono reactor.pool.InstrumentedPool.acquire()'
    at io.r2dbc.pool.ConnectionPool.lambda$new$6(ConnectionPool.java:96) ~[r2dbc-pool-0.8.3.RELEASE.jar:0.8.3.RELEASE]
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxRetry$RetrySubscriber.resubscribe(FluxRetry.java:110) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.MonoRetry.subscribeOrReturn(MonoRetry.java:49) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Mono.subscribe(Mono.java:4204) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:97) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:165) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onError(FluxMapFuseable.java:134) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:185) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2344) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.request(FluxHandleFuseable.java:243) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:162) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:103) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:90) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onSubscribe(FluxHandleFuseable.java:148) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.MonoCurrentContext.subscribe(MonoCurrentContext.java:35) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Mono.subscribe(Mono.java:4219) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.MonoUsingWhen.subscribe(MonoUsingWhen.java:96) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Mono.subscribe(Mono.java:4219) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Mono.subscribeWith(Mono.java:4330) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Mono.subscribe(Mono.java:4190) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Mono.subscribe(Mono.java:4126) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at com.example.demo.DemoApplicationTests.lambda$12(DemoApplicationTests.java:189) ~[test-classes/:na]
    at reactor.core.publisher.LambdaMonoSubscriber.onNext(LambdaMonoSubscriber.java:168) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:385) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxContextStart$ContextStartSubscriber.onNext(FluxContextStart.java:96) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:287) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:330) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:152) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) ~[reactor-core-3.3.6.RELEASE.jar:3.3.6.RELEASE]
    at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:365) ~[reactor-netty-0.9.8.RELEASE.jar:0.9.8.RELEASE]
    at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:368) ~[reactor-netty-0.9.8.RELEASE.jar:0.9.8.RELEASE]
    at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:424) ~[reactor-netty-0.9.8.RELEASE.jar:0.9.8.RELEASE]
    at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:613) ~[reactor-netty-0.9.8.RELEASE.jar:0.9.8.RELEASE]
    at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:96) ~[reactor-netty-0.9.8.RELEASE.jar:0.9.8.RELEASE]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[netty-codec-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) ~[netty-codec-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) ~[netty-codec-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1518) ~[netty-handler-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1267) ~[netty-handler-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1314) ~[netty-handler-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) ~[netty-codec-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440) ~[netty-codec-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[netty-codec-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) ~[netty-transport-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[netty-common-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.50.Final.jar:4.1.50.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.50.Final.jar:4.1.50.Final]
    at java.base/java.lang.Thread.run(Thread.java:830) ~[na:na]


text:
Q: Birt Report: New Line character in Data Field. Birt Report Data Field:
type = String
Database Column:
type = varchar
When i try to fetch the data from database using birt report the data field fetch the data successfully. But the data contain some new line character like "Hello \n World" because i enter the data with some new lines.But the birt report data field print the "Hello World" in one line. it contain spaces but not new line charterer. How to print the data in birt report with new line.


text:
Q: C++ Deleting part of dynamic array Say I have a dynamic array like:
int* integers = new int[100];

Is there a way to delete only part of the array such as:
int* integers2 = integers + 50;
delete[] integers2;

I want to not only delete everything 50 and beyond, but if I call another delete[] on the original integers array, then it would only delete the correct amount of memory and not try to delete the originally allocated amount and seg fault.
Why I want to do this: I have a data structure that is structured in levels of arrays, and I want to be able to create this data structure from a full array.  So I want to be able to say
int* level1 = integers;
int* level2 = integers + 50;
int* level3 = integers + 100;

But when level 3 is no longer needed, the data structure will automatically delete[] level3.  I need to know that this will behave correctly and not just destroy everything in the array.  If it will then I need to just create new arrays and copy the contents over, but it would be nice to avoid doing that for performance reasons.
Edit: Everyone seems to be jumping to the conclusion that I just should use a dynamic resizing container (ie vector, deque) in the first place for my data structure.  I am using levels of arrays for a good reason (and they aren't equally sized like I make it look like in my example).  I was merely looking for a good way to have a constructor to my data structure that takes in an array or vector and not need to copy the original contents over into the new data structure.

A: No, this will not behave correctly. You can only delete[] pointers that you got from new[], else the results are undefined and bad things might happen.
If you really need the array to get smaller you have to allocate a new one and copy the contents manually.

A: Typically when memory gets allocated, there is some housekeeping stuff before the pointer.
i.e. houskeeping (pointer) data
You will mess that up.

A: int* integers2 = integers + 50;
delete[] integers2;

Will not work because new is created on int*, so space of 100 int has been assigned to integers, now integers2 is only a pointer to 50th location of integers, it has no space assigned to it of its own, so using delete will not delete rest of integers2, it'll only give erratic results.
What you can do is copy the first 50 in another array, and delete the previous array completely.
delete will only delete the pointer which has space assigned to it, using delete to another pointer pointing to the space assigned to first pointer will not delete any space assigned to the first pointer.
delete[] integers2 will not delete any space assigned to integers1 or any other pointer.

A: Dynamic allocators (like new) generally don't like you releasing part of the memory they gave you. If you use the <malloc.h> defined library functions malloc() and free() instead of new and delete, then you can use realloc(), though in most cases that you would care about the size difference it's just going to copy for you anyway.
Dynamically sizing containers generally use an exponential rule for resizing: if you run out of space, they (for example) double the allocation (and copy the old data over), if you remove data until you are using (for example) less than half the allocation they copy into a smaller allocation. This means you never waste more than half the memory, and the cost of copying per element added or removed is effectively constant. Implementing all of this is a pain in the ass, though, so just use std::vector and let it do it for you :).

A: No you can't do this with a fixed sized array allocated with new[]. If you want to have a dynamic array use one of the STL containers, such as std::vector.


text:
Q: java class to trust all for sending file to https web service I need to write my own class to tell mule that https connection to service (wsdl) is verified. I already have mule project nearly finnished but last piece is missing, sending file at specific url.
What I want to achieve:

*

*establish connection and send xml to target url

*read response that is also in xml
Server uses security with self signed certificate. What I did so far was that I got cert from that link and imported it in .jks. Then I followed probably all "tutorials" how to connect to server in mule with https connector but nothing worked in my case.
I think that the best thing would be if someone can help me create java class to bypass key checking and return true (as verified). Something like:
URL url = new URL("https://www.google.com");
HttpsURLConnection conn= (HttpsURLConnection) url.openConnection();
conn.setHostnameVerifier(new HostnameVerifier() {
    @Override
    public boolean verify(String arg0, SSLSession arg1) {
        return true;
    }
});

How can I do that in mule? I expect that it would be something like this.
I am using current mule version (3.5.0)
Thank you!
EDIT:
My configuration:
<https:connector name="HttpsConnector" cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" doc:name="HTTP\HTTPS" dynamicNotification="true" >
    <https:tls-server path="${keystore.path}" storePassword="${keystore.pass}" />
</https:connector>

<sub-flow name="toSOAP" doc:name="toSOAP">
    <cxf:proxy-client payload="body" doc:name="SOAP" enableMuleSoapHeaders="false">
        <cxf:outInterceptors>
            <spring:ref bean="WSS4JOutInterceptorBean"/>
        </cxf:outInterceptors>
    </cxf:proxy-client>
    <https:outbound-endpoint exchange-pattern="one-way" host="${pref.host}" port="${pref.port}" path="${pref.path}" method="POST" connector-ref="HttpsConnector" doc:name="HTTP"/>
</sub-flow>

A: What worked for me is to set the TrustManagerFactory on the HTTPS connector.  Here's how I did it.
First, create a keystore that contains the certificate of the SSL server you want to trust. You can create the keystore using the tools included with the JDK (here's an example).
Then, create a FactoryBean that gives you a TrustManagerFactory given a JKS keystore and password.  Here's one I made that uses a Spring resource, so that I can provide the keystore from the classpath or from the filesystem:
public class ExampleFactoryBean implements FactoryBean<TrustManagerFactory> {

    private Resource keystore;
    private String password;

    @Override
    public TrustManagerFactory getObject() throws Exception {
            KeyStore truststore = KeyStore.getInstance("JKS");
            truststore.load(keystore.getInputStream(), password.toCharArray());
            TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
            tmf.init(truststore);
            return tmf;
    }

    @Override
    public Class<?> getObjectType() {
        return TrustManagerFactory.class;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    public void setKeystore(Resource keystore) {
        this.keystore = keystore;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}

Finally, set the TrustManagerFactory on the HTTP connector like so:
<https:connector name="myHttpsConnector">
    <spring:property name="trustManagerFactory">
        <spring:bean class="com.mycompany.ssl.ExampleFactoryBean">
            <spring:property name="keystore" value="classpath:mykeystore.keystore" />
            <spring:property name="password" value="mypassword" />
        </spring:bean>
    </spring:property>
</https:connector>


text:
Q: Membership Built In System I need to have a login area with the ability to add users to groups in my project.
The built in membership account that come with MVC is just what I need, although I've seen on blogs that some people warn against using the built in system and that you should delete it.
I'm new to mvc and .net so the likely hood of me writing something from scratch thats better is un likely at this stage.
Have other people used the built in system or are there any better alternative i should be looking at?
Thanks for any advice.
Jemes

A: It'll work out of the box for simple cases - it's built directly on the ASP.NET 2.0 Membership (read all about it here) and has the same limitations.  There's an open source project called ASP.Net Membership which adds some actions/views for the administration bits.


text:
Q: Disable a compiler warning which is not in the rule set My C# application uses the Code Analysis rule set Microsoft Managed Recommended Rules. I'm using some obsolete classes so I get the warning CS0618. (I cannot replace the obsolete classes because it's defined in a 3rd party API, so I have to use it)
I wanted to disable this warning by editing the default rule set and saving it under a new name, but the CS0618 rule is not part of this rule set.
So I have two questions:

*

*Why does the compiler check against CS0618 although it's not part of the selected rule set?

*How can I disable the warning per project/per solution and not in each single place?

For those who are curious why I cannot simply fix the compiler warning:
see Refactoring XmlSchemaCollection, XmlValidatingReader and ValidationType.XDR to get rid of compiler warning

A: CS0168 isn't part of Code Analysis - it's a simple C# compiler warning. That's got nothing to do with any later code analysis.
To disable it in project properties, go into the project properties, the Build tab, Errors and Warnings section, Suppress Warnings, and specify 0168 (not CS0168).

A: I can't believe I'm going up against Skeet here in an answer, but...
I've had this in the past, where I had a DataAccess class that wrapped a bunch of Oracle Dll calls. Unfortunately MS obsoleted the Oracle classes, and it was throwing the warnings. I didn't like the idea of suppressing the obsolete warning across the board, since it would suppress other obsoletions in our own code, but we didn't have time to fix the issue (the class was used in quite a few places in different apps).
What I did, was use #pragma to disable the warning on that class:
#pragma warning disable 612, 618

public class MyWrapper
{
}

#pragma warning enable 612, 618

This, of course, works best if all the calls into the obsoleted classes are being made through a single point in your code, otherwise you would need to be setting the #pragma flag all over the place.


text:
Q: Admob Interstitial - Back Button Crashes App I have integrated admob interstitial ads into my app. Everything works fine except that when the ad appears, if the user clicks on the ad and then presses the phones 'back' button, the app crashes and quits.
I believe this is a known bug in the Admob SDK but I was wondering if anyone has a workaround for this problem?
Thanks so much.

A: Google AdMobs are no longer supported for windows phone apps. They had launched AdMobs in Beta phase and the ads often caused crashes when clicked. They no longer support apps on windows phone platform. Heres a screenshot of my dashboard with a notification from AdMobs where they have mentioned that WP apps wont be supported after 30th September 2013.


text:
Q: tranpose of multidimension with permute the axes For higher dimensional arrays, transpose will accept a tuple of axis numbers to permute the axes (for extra mind bending):
In [115]: arr = np.arange(16).reshape((2, 2, 4))

In [116]: arr
Out[116]:

array([[[ 0, 1, 2, 3],
[ 4, 5, 6, 7]],
[[ 8, 9, 10, 11],
[12, 13, 14, 15]]])

In [117]: arr.transpose((1, 0, 2))
Out[117]:

array([[[ 0, 1, 2, 3],
[ 8, 9, 10, 11]],
[[ 4, 5, 6, 7],
[12, 13, 14, 15]]])

I am trying to understand how above output is generated for transpose((1, 0, 2). I am not able to understand what is meant is permute the axes? Request to explain in layman terms and how above output is generated.
Thanks

A: The default transpose is to reverse the axes, so an A x B matrix becomes B x A.  For 3D, the default would be to transpose A x B x C to C x B x A.
In your example, transpose(1, 0, 2), it will transpose A x B x C to B x A x C.  That's because the default 3D transpose is (2, 1, 0), but you have (1, 0, 2) which simply swaps the first two axes.
When you are experimenting, it may be more clear if you use an example array of shape 2 x 3 x 4 or some other combination which has no duplicates.

A: Transposing a matrix is essentially switching the order of your dimensions, e.g.: arr.transpose() is in this case equal to arr.transpose((2,1,0)).
On the other hand, if you wish to select the order of your dimensions by hand, you will preserve the original order (i.e. don't change anything) by transposing with arr.transpose((0,1,2)).
In your example you leave the last dimension (2) of your array, e.g. [0,1,2,3], unchanged. However, you switch the first two (0 and 1), thus elements at arr[0,0,0:4] will still be there, but the contents of arr[1,0,0:4] now appear at arr[0,1,0:4] after transposing:
In[]: t_arr = arr.transpose((1,0,2))
In[]: arr[0,0,0:4] == t_arr[0,0,0:4]
Out[]:
array([ True,  True,  True,  True], dtype=bool)

In[]: arr[0,1,0:4] == t_arr[1,0,0:4]   # indices #0,1,0-3 and #1,0,0-3 respectively
Out[]:
array([ True,  True,  True,  True], dtype=bool)

This is also what you expect when transposing a multidimensional matrix. The axes are swapped in a way, so that the elements are located at almost the same indices as before, just with the swapped order, i.e.:
arr[x,y,z] == arr.transpose()[z,y,x]           # True
arr[x,y,z] == arr.transpose((1,0,2))[y,x,z]    # True (your case)

A: Consider an array and its transpose:
arr = np.arange(24).reshape((2, 3, 4))
arrt = arr.transpose((1, 0, 2))

By default transpose just reverses the order of dimensions. The particular transpose command above swaps the first two dimensions but leaves the last dimension untouched. Let's verify in a few examples:
print(arr.shape)
# (2, 3, 4)

print(arrt.shape)
# (3, 2, 4)

# the last dimension is the same in both arrays
print(arr[0, 0, :])
# [0 1 2 3]
print(arrt[0, 0, :])
# [0 1 2 3]

print(arr[:, 0, 0])  # what was before the first dimension
# [ 0 12]
print(arrt[0, :, 0])  # is now the second dimension
# [ 0 12]

# the first two dimensions are swapped - the submatrix is transposed
print(arr[:, :, 0])
# [[ 0  4  8]
#  [12 16 20]]
print(arrt[:, :, 0])
# [[ 0 12]
#  [ 4 16]
#  [ 8 20]]


text:
Q: How can i loop through the entire JSON and get all the empids? I have a JSON as folows
{
  "name": "Employee Fields",
  "id": "Employee",
  "rows": [
    {
      "data": [
        {
          "emp": "111",
          "label": "Name",
          "disabled": false
        },
        {
          "emp": "112",
          "label": "Name",
          "disabled": false
        }
      ]
    },
    {
      "data": [
        {
          "emp": "113",
          "label": "Name",
          "disabled": false
        },
        {
          "emp": "114",
          "label": "Name",
          "disabled": false
        }
      ]
    },
    {
      "data": [
        {
          "emp": "115",
          "label": "Name",
          "disabled": false
        },
        {
          "emp": "116",
          "label": "Name",
          "disabled": false
        }
      ]
    }
  ]
}

How can i loop throuh all the empIds??
https://jsfiddle.net/o2gxgz9r/70859/

A:

$(document).ready(function() {

  var fields =
  {
    "name": "Employee Fields",
    "id": "Employee",
    "rows": [
      {
        "data": [
          {
            "emp": "111",
            "label": "Name",
            "disabled": false
          },
          {
            "emp": "112",
            "label": "Name",
            "disabled": false
          }
        ]
      },
      {
        "data": [
          {
            "emp": "113",
            "label": "Name",
            "disabled": false
          },
          {
            "emp": "114",
            "label": "Name",
            "disabled": false
          }
        ]
      },
      {
        "data": [
          {
            "emp": "115",
            "label": "Name",
            "disabled": false
          },
          {
            "emp": "116",
            "label": "Name",
            "disabled": false
          }
        ]
      }
    ]
  };

  $.each(fields.rows, function(index, row) {
    $.each(row.data, function(index, emp) {
      console.log("Label: ", emp.label);
      console.log("Disabled: ", emp.disabled);
      console.log("ID: ", emp.emp);
      console.log("----");
    });
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

A:

    var foo = {
      "name": "Employee Fields",
      "id": "Employee",
      "rows": [
        {
          "data": [
            {
              "emp": "111",
              "label": "Name",
              "disabled": false
            },
            {
              "emp": "112",
              "label": "Name",
              "disabled": false
            }
          ]
        },
        {
          "data": [
            {
              "emp": "113",
              "label": "Name",
              "disabled": false
            },
            {
              "emp": "114",
              "label": "Name",
              "disabled": false
            }
          ]
        },
        {
          "data": [
            {
              "emp": "115",
              "label": "Name",
              "disabled": false
            },
            {
              "emp": "116",
              "label": "Name",
              "disabled": false
            }
          ]
        }
      ]
    }

    foo.rows.forEach(row => {
     row.data.forEach(e => {
      console.log(e.emp)
     })
    })

A: You could use map() and concat()

var data ={"name":"Employee Fields","id":"Employee","rows":[{"data":[{"emp":"111","label":"Name","disabled":false},{"emp":"112","label":"Name","disabled":false}]},{"data":[{"emp":"113","label":"Name","disabled":false},{"emp":"114","label":"Name","disabled":false}]},{"data":[{"emp":"115","label":"Name","disabled":false},{"emp":"116","label":"Name","disabled":false}]}]}
let result =[].concat.apply([],data.rows.map(({data})=>data.map(({emp})=>emp)))

console.log(result)

And also use reduce(), map() and concat().

var data ={"name":"Employee Fields","id":"Employee","rows":[{"data":[{"emp":"111","label":"Name","disabled":false},{"emp":"112","label":"Name","disabled":false}]},{"data":[{"emp":"113","label":"Name","disabled":false},{"emp":"114","label":"Name","disabled":false}]},{"data":[{"emp":"115","label":"Name","disabled":false},{"emp":"116","label":"Name","disabled":false}]}]}
let result = data.rows.reduce((r,{data})=>r.concat(data.map(({emp})=>emp)),[]);

console.log(result)

A: You can achieve the desired result by using the ES6 map and reduce methods.
You will store this JSON object to a variable.
const response = <JSON VARIABLE ABOVE>
const rows = { response }; //destructure the rows from the response variable
To retrieve an array of the IDs, you can do the following:
const ids = rows.map((row) => {
    return row.data.map((d) => {
    return d.emp;
  })
}).reduce((a, b) => a.concat(b), []);


text:
Q: Geoprocessing/Clip fails in QGIS 2.18.3 for Ubuntu I am trying to obtain a clipping of a contour map into a polygon by using the command
Vector-> Geoprocessing tools -> Clip

in QGIS 2.18.13 freshly installed on Ubuntu 14.04.
I run the command on a contour lines layer whose files are within a directory since it is a DXF file (to be imported to autocad) and a shapefile (a polygon basically)
But when I run the command I get the message:

"NameError: global name 'features' is not defined"

Is this error due to some coding glitch in the new release? What is the global name Features referring to?

A: This is a known bug in version 2.18.13 of QGIS.
https://issues.qgis.org/issues/17248

A: are your contour lines shapefiles line type? If so, you need to convert to polygon to clip another polygon; you should also ensure projections are the same on both shapes


text: Q: Removing Change Request from a reviewer I recently pushed a Pull Request(PR) from a feature branch into main in GitHub. This PR was reviewed by one of the team members and he added a change request to my branch, which I did. Unfortunately, last week he got sick and hasn't been in working condition for some time now so I'm stuck until he approves the PR. I've gotten someone else to review my branch, but until the change request is resolved, I'm completely stuck. How do I remove the change request of the other user?


text:
Q: how to parse a file Alright, i have an assignment and i dont know how to parse the file. Is string tokenizer my best option?
The file has commas, newlines and spaces. S is the starting state and small a is the input and the big A is the next state. Should i parse the file into seperate variables and run it through a switch case to simulate a state machine?
This is the file
'Ends in a
2
S, a, A
S, b, S
A, a, A
A, b, S
F: A
aba
bbaabba
bbabab
aaaab
b
a

Thank you so much because i just cant seem to get started...

A:
My biggest question is how can i parse the file?

Like any other text file.  There are literally millions of examples on how to do this on the web.
I would look for examples using the Scanner class.

I am not very good at parsing files. Especially in this situation.

With practice it will get easier.  Doing this assignment will help.

Should i use dilimeters?

The file has delimiters so I don't why you wouldn't.

comma and newline?

Your file has commas, newlines and spaces.

and put the states into an array and the inputs ( a,b) into a second array?

Java is an object orientated programming language. Perhaps using Collections like Map and Objects is a better choice.

Should i check for digits, isaplha?

I would just assume the file is formatter correctly and read numbers when you expect to have a number and strings when you expect to have a word/token.

lower case and uppercase alpha?

Not sure if this is a consideration.

i am thinking i need a switch and a couple of cases to handle the state transitions?

If your states were handled in Java code, I would say yes. However you states are being read from a text files and stored in a data structure. In this case its simpler not to use switches.

Can someone explain how i should go about handling this file so i can process it?

Read it, store the data in a structure, process the inputs.

I am also confused on how to handle the :F A in that file..

This is information you need to record to determine when your DFA stops.

A: Java is an object-oriented language so build a series of classes that reflect the real world.
Example:
What do you have? And what do they need to be able to do

*

*DFA

*

*has a series of states

*needs to be able to accept/reject input strings

*State

*

*has a collection of inputs to look for and states to transition to based on input

*needs to be able to check for a token and transition to a new state

So these kind govern how you should lay out your classes (members and methods).  So you should make a DFA class and it should have a method: public boolean process(String input).


text:
Q: compiling DotNetNuke 06.02.05 throws exception in Globals.cs I just installed a fresh copy with source code of DotNetNuke 06.02.05.
I have compiled using VS 2010 but couldn't complete because of the following exception in globals.cs
Object reference not set to an instance of an object.

Source:
string strMessage = DataProvider.Instance().GetProviderPath();

i didn't change anything in the code, just opened the solution and compile.
Any suggestions.

A: Remove the web.config renamed release.config to web.config.


text:
Q: Alternatives to table view within a table view for two levels of detail view Imagine an app that allowed the Beatles to work on multiple albums at the same time. So on the left you have a list of two albums (Abbey Road and Sergent Pepper's) and if you select Abbey Road, it gives you a list of all the songs on Abbey Road. If you select one of those songs ("Come Together" in the example below), it opens the text of that song in a detail view and allows you to edit the song lyrics. So instead of a Master Detail set up, it's like a Master Master Detail arrangement with two table views and a detail view. Persistence will be done with Core Data.
Is this the recommended way to do it? I've seen some comments online that nesting table views is not great UI.

TableView                 TableView                                 Detail

    Albums (list)              **AbbeyRoad**   (songlist)            Come Together (songtext)

    1.AbbeyRoad            ComeTogether                       Here come old flattop blah blah
    2.Sergent Pepper's     Something
                           Maxwell's Silver Hammer

A: Never, ever, ever put one table view inside another. Gack. That's a user interface disaster in the making.
You could use a sectioned table view, where the sections are albums, and the rows within a section are the songs.
For iPad, you could have side-by-side table views, but that doesn't work on iPhone.
Apple intends you to use a split view controller for that on iPad, and a sequence of master>detail>sub_detail view controllers on iPhone. You can go down as many levels as needed.


text:
Q: Rails subtracting one variable from another I have the following code:
<script>

        var target = <%= @main.sum(&:target) %>;
        var forecast = <%= @main.sum(&:forecast) %>;
        var achieved = <%= @main.sum(&:achieved) %>;

    var pieData = [
            {
                value: target,
                color:"#ed1c24"
            },
            {
                value : achieved,
                color : "#000"
            }

        ];

        var opt = {
            scaleFontFamily : "'Trebuchet'",
            segmentStrokeColor : "#fff",

        }

and I need to see how much of the target has been achieved on a pie chart. The code works, I just need a way to subtract the achieved figure from the target figure

A: If this is an important piece of your code, you could insert this into your model. The code would read:
model.rb

def difference
  self.sum(&:target) - self.sum(&:acheived)
end

js:

var difference = @main.difference;

While you could put this in the javascript, since this is within a view it might be good to keep the calculation in your model so you can have a degree of visibility as to what is going on within your application logic, within one file.


text:
Q: Label a subplot based on the ylabel's x coordinate and title's y co-coordinate How could I set a label for a plot ('1' and '2' in the screenshot below) based on ylabel's x coordinate and title's y co-coordinate?
Use case: I would like such alignment to automate the formatting of multipanel figures where the ylabels are aligned first using fig.align_ylabels. Then would be very likely that the corner labels of the subplots would be aligned too.

This is what I tried but did not work:
For x, I tried ax.yaxis.get_label_position() which provided 'left' as output. This is not what I am looking for. Then I tried ax.yaxis.get_label().get_position(). The output looked to be in terms of the axes fractions.
For y, I used ax.title.get_position()[1], which provided location which is in terms of the axis fractions.
Here's the test code:
import matplotlib.pyplot as plt
fig,axs=plt.subplots(1,2,figsize=[6,3])
for i,ax in enumerate(axs):
    ax.set(title='title',xlabel='xlabel',ylabel='ylabel',xlim=[0,10],ylim=[0,10])
    x,y=ax.yaxis.get_label().get_position()[0],ax.title.get_position()[1]
    ax.text(x=x,y=y,s=i+1,ha='left',va='center',transform=ax.transAxes)
    print(f"for subplot#{i+1} coordinates of the label, x,y={x},{y}",)
## outputs
#for subplot#1 coordinates of the label, x,y=0,1.0
#for subplot#2 coordinates of the label, x,y=0,1.0

A possible solution may lie in converting the coordinates from one to another, but I am not experienced enough in that to intuitively figure that out. But I hope somebody would.


text:
Q: How to configure vim spellcheck to use two languages In my blog I write blog posts in German language. But as my blog is mostly about technology, there are many English words appearing as well.
I recently enabled German spell-checking in vim with
set spell spelllang=de_de

Of course, it is highlighting all the English words now. Is there any way to use en_US and de_DE at the same time?

A: :help 'spelllang' tells that the option can contain "A comma separated list of word list names." So, the following should work already:
:set spelllang=en_us,de_de


text:
Q: Codename one video crashing on iOS when fast foward/ reverse button pressed We have a video supply app written in Codename one.
We are using com.codename1.media.MediaPlayer to show the video full screen using the native player components.
Our client has noticed that when you press the fast forward(>>) button or the reverse button(<<) then the video is kicking you back to the app.
The code which plays the video looks something like this;
...
private Media video;
...
(on EDT:)
InputStream input = {get video InputStream from path}
video = MediaManager.createMedia(input, "video/mp4", this::videoFinished);
video.setFullScreen(true);
video.setNativePlayerMode(true);
....
(after pressing the play button:)
if (video.isPlaying()) {
     video.setTime(0);
    video.pause();
}
video.prepare();
video.play();
...
private void videoFinished() {
    {update UI after video has finished}
}

I collected the following log from the console if that helps;
2018-11-01 15:08:38.290366+1300 Main[2000:481106] [] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)
2018-11-01 15:08:39.058905+1300 Main[2000:481106] [] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_Presence (client: Main)
2018-11-01 15:09:00.005725+1300 Main[2000:481106] Status bar could not find cached time string image. Rendering in-process.
2018-11-01 15:09:00.144446+1300 Main[2000:481106] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
    (1) look at each constraint and try to figure out which you don't expect;
    (2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x10eb09790 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.midY == _UIBackdropView:0x108d59fb0.midY   (active)>",
"<NSAutoresizingMaskLayoutConstraint:0x10eb0abd0 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.height == _UIBackdropView:0x108d59fb0.height   (active)>",
"<NSLayoutConstraint:0x10ccf2440 V:|-(0)-[UIStatusBar:0x102922200]   (active, names: '|':_UIBackdropContentView:0x108d4a310 )>",
"<NSLayoutConstraint:0x10ccf24e0 UIStatusBar:0x102922200.height == 20   (active)>",
"<NSLayoutConstraint:0x10ccf2bf0 UIView:0x10cce7e10.top == _UIBackdropView:0x108d59fb0.top + 40   (active)>",
"<NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10]   (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10]   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-11-01 15:09:00.687662+1300 Main[2000:481106] [] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)

Everything works correctly on Android.
Edit:
Refactored the code to use file URL's instead of input streams but it still has the same error on iOS
Edit:
This is a problem even when using web urls.
Here is a very simple test case which illustrates the issue;
public class MyApplication {

    private Form current;
    private Resources theme;
    private Media video;

    public void init(Object context) {
        // use two network threads instead of one
        updateNetworkThreadCount(2);

        theme = UIManager.initFirstTheme("/theme");

        // Enable Toolbar on all Forms by default
        Toolbar.setGlobalToolbar(true);

        // Pro only feature
        Log.bindCrashProtection(true);

        addNetworkErrorListener(err -> {
            // prevent the event from propagating
            err.consume();
            if(err.getError() != null) {
                Log.e(err.getError());
            }
            Log.sendLogAsync();
            Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
        });
    }

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        Form hi = new Form("Hi World", BoxLayout.y());
        //hi.add(new Label("Hi World"));
        Button play = new Button("Play");
        play.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                playVideo();
            }

        });
        hi.add(play);
        hi.show();
    }

    private void playVideo() {
        try {
            String path = getPath();
            video = MediaManager.createMedia(path, true, null);
            video.setFullScreen(true);
            video.setNativePlayerMode(true);

            video.prepare();
            video.play();
        } catch (IOException ex) {
            Log.e(ex);
        }
    }

    private String getPath() {
        return "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
    }
    public void stop() {
        current = getCurrentForm();
        if(current instanceof Dialog) {
            ((Dialog)current).dispose();
            current = getCurrentForm();
        }
    }

    public void destroy() {
    }
}

Note: To run this on ios you need to add the security exception to the plistInject build hint. Add this into the codenameone_settings.properties file;
codename1.arg.ios.plistInject=<key>UIRequiresFullScreen</key><true/><key>ITSAppUsesNonExemptEncryption</key><false/><key>NSAppTransportSecurity</key><dict><key>NSExceptionDomains</key><dict><key>commondatastorage.googleapis.com</key><dict><key>NSIncludesSubdomains</key><true/><key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>

A: Seeking with an input stream might be a bit problematic as we can't rewind/skip in the stream effectively while communicating with the native layer. That's why we always recommend using the version that accepts a URL as an argument. You can use a file URL which should work well for all platforms.


text:
Q: I have an inflating class android.support.design.widget.BottomNavigationView Error. Any thoughts? I tried going through my XML files as well as checking all of my dependencies. But I haven't been able to pinpoint what's wrong yet.
This is the build Gradle.
The error summary is listed at the bottom.
Build Gradle (app)
apply plugin: 'com.android.application'
android {
 compileSdkVersion 29
 buildToolsVersion "29.0.2"
 defaultConfig {
     applicationId "com.example.hasanat"
     minSdkVersion 21
     targetSdkVersion 29
     versionCode 1
     versionName "1.0"
     testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 }
 buildTypes {
     release {
         minifyEnabled false
         proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
     }
    }
}

dependencies {
 implementation fileTree(dir: 'libs', include: ['*.jar'])
 implementation 'androidx.appcompat:appcompat:1.1.0'
 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
 implementation 'androidx.recyclerview:recyclerview:1.0.0'
 \

 //material view for android
 implementation 'com.google.android.material:material:1.2.0-alpha01'
 //AndroidX
 implementation 'androidx.cardview:cardview:1.0.0'
 implementation 'androidx.legacy:legacy-support-v4:1.0.0'
 testImplementation 'junit:junit:4.12'
 androidTestImplementation 'androidx.test:runner:1.2.0'
 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
 implementation 'androidx.navigation:navigation-fragment:2.1.0-alpha02'
 implementation 'androidx.navigation:navigation-ui:2.1.0-alpha02'
}

Main activity file for reference
activity_main
<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="wrap_content">

<!--   Adding a Navigation Host  -->
  <fragment
     android:id="@+id/nav_host"
     android:layout_weight="1"
     android:layout_width="match_parent"
     android:layout_height="0dp"
     android:name="androidx.navigation.fragment.NavHostFragment"
     app:navGraph="@navigation/hasanav"
     app:defaultNavHost="true"/>

<!--  Bottom Navigation Bar  -->

  <android.support.design.widget.BottomNavigationView
     android:id="@+id/bottom_navigation"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     app:menu="@menu/bottomnav"
     app:itemBackground="@color/colorPrimary"
     app:itemIconTint="@android:color/white"
     app:itemTextColor="@android:color/white" />

 <androidx.recyclerview.widget.RecyclerView
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:id="@+id/CharityOrgs"
     android:scrollbars="vertical">

 </androidx.recyclerview.widget.RecyclerView>

 </LinearLayout>

Error Summary
Process: com.example.hasanat, PID: 32190
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hasanat/com.example.hasanat.MainActivity}: android.view.InflateException: Binary XML file line #21: Binary XML file line #21: Error inflating class android.support.design.widget.BottomNavigationView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2946)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3081)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6810)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
     Caused by: android.view.InflateException: Binary XML file line #21: Binary XML file line #21: Error inflating class android.support.design.widget.BottomNavigationView
     Caused by: android.view.InflateException: Binary XML file line #21: Error inflating class android.support.design.widget.BottomNavigationView
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.BottomNavigationView" on path: DexPathList[[zip file "/data/app/com.example.hasanat-bWDmwmjIn_JgyVV7mVt1hQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.hasanat-bWDmwmjIn_JgyVV7mVt1hQ==/lib/arm64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.view.LayoutInflater.createView(LayoutInflater.java:610)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
        at com.example.hasanat.MainActivity.onCreate(MainActivity.java:38)
        at android.app.Activity.performCreate(Activity.java:7224)
        at android.app.Activity.performCreate(Activity.java:7213)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2926)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3081)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at         android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6810)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

A: You are using dependencies  of androidx so You need to use com.google.android.material.bottomnavigation.BottomNavigationView
Use this
<com.google.android.material.bottomnavigation.BottomNavigationView
     android:id="@+id/bottom_navigation"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     app:menu="@menu/bottomnav"
     app:itemBackground="@color/colorPrimary"
     app:itemIconTint="@android:color/white"
     app:itemTextColor="@android:color/white" />

Instead of this
<android.support.design.widget.BottomNavigationView
     android:id="@+id/bottom_navigation"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     app:menu="@menu/bottomnav"
     app:itemBackground="@color/colorPrimary"
     app:itemIconTint="@android:color/white"
     app:itemTextColor="@android:color/white" />


text:
Q: How to set an operator friendly name when configuring Wifi Network(s) on iOS (Hotspot 2.0/Passpoint specifically)? I have the following code to configure a hotspot 2.0 network profile and it works and auths as expected.
However, I know that this type of profile contains a friendly operator name property that should be allowed to be set.
The property name may differ but basically it is a property set as a display text when previewing your Wifi list in the device settings once a user auths.
Android has this property so my best assumption is that iOS (Swift) should too, as it's a standard for Passpoint/Hotspot 2.0 profiles.
// Configure profile
      let hotspotSettings = NEHotspotHS20Settings.init(domainName: result.domain, roamingEnabled: result.roaming)
      hotspotSettings.naiRealmNames = result.nai_realms
      hotspotSettings.roamingConsortiumOIs = result.roaming_ois

      print("SETTING123 : ", hotspotSettings)

      let hotspotEAPSettings = NEHotspotEAPSettings()
      hotspotEAPSettings.username = result.username
      hotspotEAPSettings.password = result.password
      hotspotEAPSettings.isTLSClientCertificateRequired = result.client_cert_required
      hotspotEAPSettings.supportedEAPTypes = result.eap_types
      hotspotEAPSettings.preferredTLSVersion = NEHotspotEAPSettings.TLSVersion(rawValue: Int(Double(1.2)))!
      hotspotEAPSettings.trustedServerNames = result.trusted_server_names
      hotspotEAPSettings.outerIdentity = result.outer_identity
      if(result.eap_inner_type == "mschapv2") {
        print("MSCHAP HERE")
        hotspotEAPSettings.ttlsInnerAuthenticationType = .eapttlsInnerAuthenticationMSCHAPv2
      }

      print("EAP SETTINGS123: ", hotspotEAPSettings)

      let hotspotConfig = NEHotspotConfiguration.init(hs20Settings: hotspotSettings, eapSettings: hotspotEAPSettings)

      let manager = NEHotspotConfigurationManager.shared;

        manager.apply(hotspotConfig) { (error) in
          print("Error 1: ",error?.localizedDescription as Any)
          print("Error 2: ", error as Any)
          if let error = error {
            print("Error: ", error)
            successCallback([false])
          } else {
            print("successfully installed ")
            successCallback([true])
          }
        }

Example profile for Android
The following subtree nodes are used under HomeSP:

FriendlyName: Must be set; used as display text
FQDN: Required
RoamingConsortiumOI
The following subtree nodes are used under Credential:

Realm: Must be a nonempty string
UsernamePassword: Required for EAP-TTLS with the following nodes set:

Username: String that contains the username
Password: Base64-encoded string (set to cGFzc3dvcmQ=, the base64-encoded string for "password", in the example below)
EAPMethod/EAPType: Must be set to 21
EAPMethod/InnerMethod: Must be set to one of PAP, CHAP, MS-CHAP, or MS-CHAP-V2
DigitalCertificate: Required for EAP-TLS. The following nodes must be set:

CertificateType set to x509v3

Top Swift classes used to configure and create a Passpoint profile:
https://developer.apple.com/documentation/networkextension/nehotspoths20settings
https://developer.apple.com/documentation/networkextension/nehotspoteapsettings
https://developer.apple.com/documentation/networkextension/nehotspotconfiguration
https://developer.apple.com/documentation/networkextension/nehotspotconfigurationmanager


text:
Q: How to run pentaho pig job in java I have created job in spoon where i am using pig script executor.in UI it works fine.it is calling pig script and giving desired output

Output(s): Successfully stored 445454 records (15256953 bytes) in:
  "/hive/warehouse/weblogs/aggregate_pig_test3"
Counters: Total records written : 445454 Total bytes written :
  15256953 Spillable Memory Manager spill count : 0 Total bags
  proactively spilled: 0 Total records proactively spilled: 0
Job DAG: job_local270305097_0001 2016/04/06 17:24:12 - Pig Script
  Executor - 2016/04/06 17:24:12 - Success! 2016/04/06 17:24:12 - Pig
  Script Executor - Num successful jobs: 1 num failed jobs: 0

now when i use same .kjb file in java i dont get desired output.it seems like my script is not executed still i am not getting any exception
my java code
         KettleEnvironment.init();
         Properties props = new Properties();
        JobMeta  metadata = new JobMeta("pig.kjb",null);
        Job  job = new Job (null, metadata);
        job.start();
        job.waitUntilFinished();

        System.err.println(job.getStatus());
          if (job.getErrors()!=0) {
            System.out.println("Error encountered!");
         }

    } catch (KettleException e) {
        e.printStackTrace();
    }
}

output of java method:

2016/04/06 18:25:59 - pig - Start of job execution 2016/04/06 18:25:59
  - pig - Starting entry [Pig Script Executor] 2016/04/06 18:25:59 - pig - Finished job entry [Pig Script Executor] (result= 2016/04/06 18:25:59 - pig - Job execution finished

But nothing happens.like above in spoon UI it stores file. I dont know what is missing. Why is my java code is not executing.

A: I missed -DKETTLE_PLUGIN_BASE_FOLDERS which was required for hadoop configuration in pentaho.


text:
Q: Error: $rootScope:inprog Action Already In Progress mvc with angularjs i am creating a web app with mvc with angularjs,
i am trying to insert the records in my database but i am getting the following error

Error: [$rootScope:inprog]
  http://errors.angularjs.org/1.6.4/$rootScope/inprog?p0=%24digest
      at angular.js:38
      at n (angular.js:18524)
      at m.$apply (angular.js:18259)
      at HTMLAnchorElement. (angular.js:26999)
      at HTMLAnchorElement.dispatch (jquery-3.1.1.js:5201)
      at HTMLAnchorElement.elemData.handle (jquery-3.1.1.js:5009)
      at Object.trigger (jquery-3.1.1.js:8171)
      at HTMLAnchorElement. (jquery-3.1.1.js:8239)
      at Function.each (jquery-3.1.1.js:368)
      at jQuery.fn.init.each (jquery-3.1.1.js:157)

this is how my code looks
    $scope.insertdata = function () {
        $scope.students = {};
        $scope.students.name = $scope.stdname;
        $scope.students.fullname = $scope.stdfname;
        $scope.students.address = $scope.stdaddress;
        $scope.students.city = $scope.stdcity;
        $scope.students.country = $scope.stdcountry;
        $scope.students.contno = $scope.stdcontno;
        $http({
            method: "post",
            url: "/dashboardquot/insert_employee",
            datatype: "json",
            contentType: "application/json",
            data: $scope.students
        }).then(function (response) {
            angular.element('#closemodel').trigger('click');
        })
    }

the data is being inserted but still getting this error
what is wrong with this code?

A: Below line is causing the error:
angular.element('#closemodel').trigger('click');

This is because the click event is bound to some code that is lead to call $digest multiple times. Try wrapping this line in $timeout.


text:
Q: SQL Server Mirroring - endpoint permissions - why grant connect to SQL service account? SQL 2008 R2
Implementing database mirroring.
Mirroring endopoints created on both partner servers (principal and mirror) and on the witness.
Was planning to GRANT CONNECT permissions on the mirroring endpoints to the domain account under which the database servers (partners and witness) are running.
Question: Why do we need to create a database server login for this domain account on each database server? The domain account should already have full priviliges on the database servers.

A: The requirement to create a login for the peer and grant connect permission is required only if such a permission is necessary. If the peers (and witness) run under a service account that already has the required privileges, then the grant is not technically required.
However I would recommend that, whatever you do, do it consistently. If all your DBM deployments always create a login for the peer(s) and grant connect permission on the DBM endpoint, then do it everywhere, even if not required. If you decide that the explicit logic/connect permission is not necessary, be consistent and don't add this login anywhere.


text:
Q: On submit of model form want to post value in a php variable Thank all for you great help for my previous question.
now again i am stuck in problem.
Question : i am using model form to submit password. on submit of model form i want to call action as $_POST or $_REQUEST. but i am not able to get post action in php code. below is my code
File Name:  password.php
          <?php
            // i try both method
            if($_SERVER['REQUEST_METHOD'] == 'POST')
            {
            var_dump($_REQUEST['data']); die;
            }

            /*if($_REQUEST['data'])
            {
                $password=$_REQUEST['data'];

                var_dump($password);
             die;
            }*/
            ?>
            <!doctype html>

            <meta charset="utf-8">
            <title>Reset Password</title>
            <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">

                    <form>
                        <fieldset>
                            Password
                            <input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all">
                            Re-Password
                            <input type="password" name="RePassword" id="RePassword" class="text ui-widget-content ui-corner-all">
                        </fieldset>
                    </form>

for more details kindly comment.

A: Looks like you forgot to add the response received to the web page when using ajax. The form is submitted but you don't see changes in the web page because you actually didn't specify what should be done with the data. You may use $(#elementID).html(html_) to set an element's inner HTML to the data received assuming that elementID is the element ID where you want to put your data and html_ is the data received from ajax.
Example
The following should work assuming that a file of name adq.php exists, the element of ID dialog-form is the element which you want to change its inner HTML to the one received from ajax and the data you want to submit is RePassword.val().
$.ajax({
    type: "POST",
    url : 'adq.php',
    data: {password: RePassword.val()},
    success: function(e)
    {
       $("#dialog-form").html(e);
       // console.log("successfull");
    }
});

Full contents of the PHP file
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
    var_dump($_REQUEST['password']);
}

/*if($_REQUEST['data'])
{
    $password=$_REQUEST['data'];

    var_dump($password);
 die;
}*/
?>
<!doctype html>

<meta charset="utf-8">
<title>Reset Password</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">

        <form>
            <fieldset>
                Password
                <input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all">
                Re-Password
                <input type="password" name="RePassword" id="RePassword" class="text ui-widget-content ui-corner-all">
            </fieldset>
        </form>

Notice You should also use $_REQUEST['password'] in PHP to get the value submitted instead of $_REQUEST['data'] as the name of the field indicated in the HTML was password and not data as Jon stated.