text:
Q: How can I approximate a character's jump in terrestrial circumstances in 2 dimensions? I'd like to start with the 2-dimensional case to establish simple algorithms for an engine in a simulated environment to approximate physics of a human-sized character jumping long distances with gravity and air resistance, except to approximate air resistance so as to reduce the computational strain.
For a typical human, this air resistance doesn't come into play often because we're so massive in proportion to our small jumps, but, I'm trying to model this for a character that can jump large distances with a lot of strength.
Let's say a character jumps diagonally with some initial velocity, at any angle for that matter (both up from the ground or down from the ceiling after clinging to it). How do I model the fact that air gradually tries to stop the character no matter what direction they jump in? There is some degree of friction in proportion to the velocity itself.
I'm guessing there's a system of differential equations that model this, but I haven't studied physics in some years, so the specifics of what I need to do for this are lost on me.
Can we obtain an exact solution of the x-y velocities in terms of elementary functions (or at least known functions)? Or if not, can we approximate the differential system with a Taylor expansion or linearization? We may lose attributes like "terminal" velocity in that case, but as long as there is an approximation of friction in proportion to the velocity that gradually stops the character, that is sufficient.
Correct me if I'm wrong, but "aerodynamics" can, in some sense, be approximated by fluid mechanics, and since I didn't see an aerodynamics tag, I put "fluid-dynamics".

A: you can choose to make the air resistance proportional to $v$ or $v^2$, which I believe to be more physically realistic.  I'll choose $v$ because it's mathematically simpler, then we have the following in two dimensions:
$${\ddot x} = -c {\dot x} \;\;\;\; {\ddot y} = -g - c {\dot y}$$
The second equation has the same form as the first, so let's only worry about integrating it.  Dividing by the LHS and integrating (and choosing the  expression $\frac{1}{c}\ln C$ for our integration constant for later simplicity), we have${}^{1}$:
$$\begin{align}
\int \frac{{\ddot y} dt}{g + c{\dot y}} &= \int -1 dt\\
\frac{1}{c}\ln\left(g + c{\dot y}\right) &= \frac{1}{c}\ln C - t\\
g + c {\dot y} &= Ce^{-ct}\\
c{\dot y} &= Ce^{-ct} - g\\
cy &= cy_{0} - gt - \frac{C}{c}e^{-ct}\\
y &= y_{0} - \frac{g}{c}t - \frac{C}{c^{2}}e^{-ct}
\end{align}$$
We can fix the value of $C$ by saying, at time $t=0$, $v = v_{y0}$, and we have:
$cv_{y0} = C - g \rightarrow C = cv_{y0} +g$
And, noting that the x direction is the same derivation, but with $g=0$, we get the general solution:
$$y = y_{0} - \frac{g}{c}t - \frac{cv_{y0} +g}{c^{2}}e^{-ct}$$
$$x = x_{0}  - \frac{v_{x0}}{c}e^{-ct}$$
it's a bit of a tricky calculus game to show that your normal kinematics pop back out if you take the limit $c \rightarrow 0$, but it does work out [though I should point out that there is a bit of dishonesty in the names $x_{0}$ and $y_{0}$ above if you do this].
Also, I'd second the objection above -- you probably could completely get away with computing a terminal velocity for each character using that value of $c$ and the speed above, and then just treating them as quadratic until they hit terminal velocity, and then they just stay at terminal velocity.
EDIT:
Ok, so, now let's do some analysis of the behavior:
$$\dot y = v_{y} = \frac{cv_{y0} + g}{c}e^{-ct} - \frac{g}{c}$$
$$\dot x = v_{x} = v_{x0}e^{-ct}$$
So, that constant $c$ defines a unit with which the x velocity decays to zero, and with which the $y$ velocity decays from an initial velocity of $v_{y0}$ to a late-time velocity $-\frac{g}{c}$, which is the terminal velocity of the motion.  So, for a high value of $c$, the motion both decays more quickly, and reaches a lower terminal velocity.  Now, going back to a vectorized version of Newton's Second law that I used to derive the initial equations, we have:
$$m{\vec a} = \sum{\vec F} = -m {\vec g} - mc {\vec v}$$
for mathematical simplicity (I wanted a simple equation to show how easy this equation is to solve), I cheated a bit in naming this $mc$ here.  Realistically, we'd call this $mc$ some variable $\alpha$, which would depend on the shape of the object, and how well it catches the air, and then we'd have the above equation written as:
$$m{\vec a} = \sum{\vec F} = -m {\vec g} - \alpha {\vec v}$$
which then would give what I called $c$ as "really" being $\alpha/m$.  So, the larger the mass of an object, the smaller the value of $c$, and the less air resistance matters for that object.
${}^{1}$choosing $c$ to be some constant that depends on the mass of the object, how much area it takes up passing through the air, how sticky it is to the air, and the density of the air


text:
Q: Rankine Hugoniot condition for non-scalar initial data Going off the example the following question (The Rankine-Hugoniot condition), how do we calculate the Rankine Hugoniot condition for nonscalar initial data? For $t \leq 1$ I understand how the author obtains the piecewise solution, but I am unclear how he obtains the bounds for each solution. Would anyone be able to explain this? Thanks!

A: In the case of systems of conservation laws
$$
\boldsymbol{u}_t + \boldsymbol{f}(\boldsymbol{u})_x = \boldsymbol{0}
$$
where bold characters are vectors (it works also in the scalar case),
the Rankine-Hugoniot condition (RH) for shock waves of speed $s$ is obtained by writing the scalar RH condition for each entry, i.e.
$$
[\! [ \boldsymbol{f}(\boldsymbol{u}) ]\!] = s [\! [ \boldsymbol{u} ]\!] .
$$
If $\boldsymbol{f}(\boldsymbol{u}) = \boldsymbol{A}\boldsymbol{u}+\boldsymbol{b}$ is linear, we end up with the eigenvalue problem
$$
\boldsymbol{A} [\! [ \boldsymbol{u} ]\!] = s [\! [ \boldsymbol{u} ]\!] .
$$
(The other query was answered directly in the comments of OP's linked post)

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to arrange/edit multiple arrays | Javascript I have three sets of data
var item = ['item1', 'item2', 'item3', ...]

var price = ['price1', 'price2', 'price3', ...]

var date = ['date1', 'date2', 'date3', ...]

Is there any way that I can arrange this into a specific order like
[
    ['item1', 'price1', 'date1'],
    ['item2', 'price2', 'date2'],
    ['item3', 'price3', 'date3'],
    .....
]

Thanks in advance.

A: You can try with for loop or map function
const item = ['item1', 'item2', 'item3'];
const price = ['price1', 'price2', 'price3'];
const date = ['date1', 'date2', 'date3'];

const result = item.map((v, i) => [v, price[i], date[i]]);

A: Given that your arrays are all in the same length, below is a short way that you could achieve your expected result

var item = ['item1', 'item2', 'item3']
var price = ['price1', 'price2', 'price3']
var date = ['date1', 'date2', 'date3']

const res = Array.from({
  length: item.length
}, (_, i) => [item[i], price[i], date[i]])

console.log(res)

A: I assume your data is sorted as intended, even the length of different array is not the same the code below should work
const arranged = []
const length  = Math.min(item.length, price.length, date.length)
for (let index = 0; index < length; ++index){
    arranged.push([item[index], price[index], date[index]])
}

console.log(arranged)

A: I suggest you do objects instead

var item = ['item1', 'item2', 'item3']
var price = ['price1', 'price2', 'price3']
var date = ['date1', 'date2', 'date3']

const res = item.reduce((acc,cur,i) => {
  acc[i] = {item:cur,price:price[i], date:date[i] }
  return acc
}, [])

console.log(res)


text:
Q: Maven projects versions stored in a database managed by a version server and a web interface? I am thinking to have a Database that store all projects and their versions: both "under development" (let's say on TRUNK) and "RELEASED" (on some release branch).
So, keeping them so, we can link them and their versions and keep control of all these through an centralized GUI. Like everytime when we change a project version from GUI, all projects versions are changing according with their POMs versions as are stored inside of the Database.
An example would be this:
Projects A, B, C, D, E, F

*

*Project A version 1.0.0 depends of Project B version 2.3.0 and Project C version 1.2.5

*Project C version 1.2.5 depends of Project D Version 3.1.0

*Project D version 3.1.0 dependes of Project E 1.2.1 and
Project F 3.2.4

A 1.0.0
       \_ B 2.3.0
       |_ C 1.2.5
                 \_ D 3.1.0
                           \_E 1.2.1
                           |_F 3.2.4

and

*

*Project A version 1.1.0 depends of Project B version 2.4.0 Project C version 1.3.5

*Project C version 1.3.5 depends of Project D Version 3.2.0

*Project D version 3.2.0 dependes of Project E 1.3.1 and Project F 3.3.4

  A 1.1.0
         \_ B 2.4.0
         |_ C 1.3.5
                   \_ D 3.2.0
                             \_E 1.3.1
                             |_F 3.3.4

So, when we change the Project A version from the UI, all the dependencies versions are changing accordingly, based on the Database stored versions and links between projects.
So that you have "the big picture" every time when you're curious to see how your project version si looking from the dependecies perspective and what projects versions have been changed from a release to another.
On the other hand, this maybe could be extended like when we want to perform a project release, we should just change versions through UI and these changes are passed to the projects POMs.
Is this a feasible idea from your perspective, guys?
Thanks


text:
Q: array indexing method a tricky case #include<stdio.h>
int main() {
int buff[] = {1,2,3,4,5,6,9,10};
char c = (buff+1)[5];
printf("%d\n",c);//output is 9
return 0;
}

Can someone explain it clearly how this is happening and why

A: Recall:
In C the square braces [ ] are  implicitly *( ... ).

What is going on in the snippet of code you provided is not obvious pointer arithmetic. This line:
char c = (buff+1)[5];

... is equivalent to the following (by the C standard):
char c = *( ( buff + 1 ) + 5 );

... which points to the 7th element in the array (6th position) and dereferences it. It should output 9, not 19.
Remark:
Following the note about square braces, it's important to see that the following is equivalent.
arr[ n ] <=> n[ arr ]

... where arr is an array and n is a numerical value. A more complicated example:
' '[ "]; i < 0; i++; while ( 1 ); do something awesome (y)." ];

... of entirely valid pointer arithmetic.

A: {1,    2,  3,  4,  5,  6,  9,  10};
 |     |
 buff  buff+1 = {2, 3, 4, 5, 6, 9, 10} (say buff_1)
                                |
 buff_1[5]    =                 9


text:
Q: Solving colebrook (nonlinear) equation with Newton Raphson method in python I have tried solving the colebrook (nonlinear) equation for frictional factor in python but I keep getting this error:
Traceback (most recent call last):
  File "c:/Users/WWW/Desktop/WWWWWWWW/WWWWWWWWWWW/DDD/WWWWW.py", line 46, in <module>
    F_factor = Newton(f=0.1)
  File "c:/Users/WWW/Desktop/WWWWWWWW/WWWWWWWWWWW/DDD/WWWWW.py", line 22, in Newton
    eps_new = float(func(f))/dydf(f)
TypeError: only size-1 arrays can be converted to Python scalars

I know something is wrong but not sure what is.
I am trying to find the friction factor (f) for this equation
-0.86 * log(2.51 / (Re * sqrt(f)) + e / D / 3.7) = 1 / sqrt(f)

at varying values of Reynold's number Re and plotting f against Re.
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import time

#Parameters
e_D = 1e-4
Re = np.linspace(10**4,10**7,10)
eps=1e-7

def func(f):
    return -0.86*np.log((e_D/3.7)+(2.51/Re)*f**0.5)-f**0.5

def dydf(f):
    return (((-1.255/Re)*f**-1.5)/((e_D/3.7)+((2.51/Re)*f**-0.5)))-((f**-1.5)/1.72)

def Newton(f,conv_hist=True):
    eps_new = float(func(f))/dydf(f)
    #y_value = func(f)
    iteration_counter = 0
    history = []
    while abs(eps_new) >= eps and iteration_counter < 100:
        eps_new = float(func(f))/dydf(f)
        f = f - eps_new
        #y_value = func(f)
        iteration_counter += 1
        history.append([iteration_counter, f, eps_new])

    # Here, either a solution is found, or too many iterations
        if abs(dydf(f)) <= eps:
            print('derivative near zero!, dydf =', dydf)
            print(func(f), 'iter# =', iteration_counter, 'eps =', eps_new)
            break

    if conv_hist:
            hist_dataframe = pd.DataFrame(history, columns=['Iteration #', 'f', 'eps'])
            print(hist_dataframe.style.hide_index())

    return f, iteration_counter
startTime = time.time()
F_factor = Newton(f=0.1)
endTime = time.time()
print(F_factor)

print('Total process took %f seconds!' % (endTime - startTime))
plt.loglog(F_factor, Re, marker='o')
plt.title('f vs Re')
plt.grid(b=True, which='minor')
plt.grid(b=True, which='major')
plt.xlabel('Re')
plt.ylabel('f')
plt.savefig('fvsRe.png')
plt.show()

A: The function func returns an array object, so
float(func(f))

is not valid Python. The issue is that the way you have written the code you can only use a specific Reynold's value for each call to Newton i.e.
def func(f, re):
    return -0.86*np.log((e_D/3.7)+(2.51/re)*f**0.5)-f**0.5

def dydf(f, re):
    return (((-1.255/re)*f**-1.5)/((e_D/3.7)+((2.51/re)*f**-0.5)))-((f**-1.5)/1.72)

def Newton(f, re, conv_hist=True):
    eps_new = func(f, re)/dydf(f, re)
    # ...
    while abs(eps_new) >= eps and iteration_counter < 100:
        eps_new = func(f, re)/dydf(f, re)
        # ...
        if abs(dydf(f, re)) <= eps:
            # ...

Will run without the error, but it will return nan for every Reynold's number - but that would be the subject of another question. I would recommend asking a new question with the physics tag if you need help fixing the code so it gets a useful result instead of nan.
Complete runnable code:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import time

#Parameters
e_D = 1e-4
Re = np.linspace(10**4,10**7,10)
eps=1e-7

def func(f, re):
    return -0.86*np.log((e_D/3.7)+(2.51/re)*f**0.5)-f**0.5

def dydf(f, re):
    return (-1.255/re*f**-1.5) / (e_D/3.7 + 2.51/re*f**-0.5) - (f**-1.5) / 1.72

def Newton(f, re, conv_hist=True):
    eps_new = func(f, re)/dydf(f, re)
    iteration_counter = 0
    history = []
    while abs(eps_new) >= eps and iteration_counter < 100:
        eps_new = func(f, re)/dydf(f, re)
        f = f - eps_new
        iteration_counter += 1
        history.append([iteration_counter, f, eps_new])

        if abs(dydf(f, re)) <= eps:
            print('derivative near zero!, dydf =', dydf)
            print(func(f), 'iter# =', iteration_counter, 'eps =', eps_new)
            break

    if conv_hist:
            hist_dataframe = pd.DataFrame(history, columns=['Iteration #', 'f', 'eps'])

    return f, iteration_counter
startTime = time.time()
F_factors = []
for re in Re:
    F_factors.append(Newton(0.1, re)[0])
endTime = time.time()

print('Total process took %f seconds!' % (endTime - startTime))
plt.loglog(F_factors, Re, marker='o')
plt.title('f vs Re')
plt.grid(b=True, which='minor')
plt.grid(b=True, which='major')
plt.xlabel('Re')
plt.ylabel('f')
plt.savefig('fvsRe.png')
plt.show()


text:
Q: CNContactViewController - change color of cancel and done button When i open CNContactViewController, It opens view without cancel and done button.
This issue only occurs in iOS13 and later.

How can i change the bar button colors?
I tried this link,  but it is not working
Change color of cancel and done button in CNContactPicker
let controller = CNContactViewController(forNewContact: nil)
controller.delegate = self
navigationController?.pushViewController(controller, animated: true)

A: I have checked linked is working fine
change code to
 navigationController?.pushViewController(controller, animated: true)

with this
 self.present(UINavigationController(rootViewController: controller), animated:true)


text:
Q: GUI for image processing in Qt with opencv library I have written the code for image processing that
opens an RGB image,
converts it into gray image ,
thresholds into binary image,
erodes the binary image,
dilates the eroded image,
finds the connected component and label it
in visual studio 2010 with opencv library, but now i have to create a GUI for the steps above like i have to create six pushbuttons in which if i push the first button it should open an image and if i push the second button it should convert it into binary thresholded image etc.
can anyone help me with this? i have implemented the push button to open an image but after that i dont know how to proceed.
thanx

A: try to get hold of the book OpenCV 2 Computer vision application programming cookbook...the first chapter deals with Qt GUI and OpenCV..here is the pdf link


text:
Q: How to merge 2 xml and list unique elements? We need to merge 2 large xml files and list one unique element like IP address,
The uniqueness comes from the tag name, status and type.
Input File 1:-
- <network>
- <node>
  <id>11</id>
  <name>aaa.com</name>
  <status>active</status>
  <ip>1.1.1.1</ip>
  <type>Windows</type>
  </node>
- <node>
  <id>12</id>
  <name>bbb.com</name>
  <status>active</status>
  <ip>2.2.2.2</ip>
  <type>Unix</type>
  </node>

Input File 2:-
- <network>
- <node>
  <id>21</id>
  <name>aaa.com</name>
  <status>active</status>
  <ip>1.1.1.1</ip>
  <type>Windows</type>
  </node>
- <node>
  <id>22</id>
  <name>ccc.com</name>
  <status>active</status>
  <ip>3.3.3.3</ip>
  <type>Unix</type>
  </node>
  </network>

=============
The output has to be the list of active IP addresses based on type
Something like:
Windows.txt
1.1.1.1

Unix.txt
2.2.2.2
3.3.3.3


text:
Q: SQL: If-condition when result does not exist? The following sql snippet below is a subselect of a parent sql.
Is there a way to say, "If customer doesn't exist I want to run a different sql"?
select orderdate,
    (select contactname from customers where customerID = 'ALFKI' or select 'No Customer') as contactname

from orders

I know this can be solved with a join but mainly interested of the possibility?

A: example
IF NOT EXISTS (select * from customers where customerID = 'ALFKI')
BEGIN
    SELECT '1'
END
ELSE
BEGIN
    SELECT '2'
END

A: Please disregard this question. I should have been weary asking because the question sounded even confusing for me.
Turns out I was in the wrong place when the answer was elsewhere. The answer was solved with precedence parenthesis just like that. Sorry for the confusion.
rod.

A: The thing that you're trying to do here is called LEFT JOIN with ISNULL:
select OrderDate, isnull(c.FullName, 'No customer') CustomerName
from Orders o
left join Customers c on o.CustomerId = c.CustomerId


text:
Q: Uncovering items and changing frame title with beamer The usual behavior of beamer when using \framebreak is to change the title of the current frame by adding a "local numbering" of the slide within those "broken frames".
I would like to achieve the same result on some frames (this can't be a global behavior change) when using \uncover, \only, \alt and such, but for now, I do it by hand, e.g.
\documentclass[svgnames,smaller]{beamer}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usetheme{Warsaw}

\begin{document}

\begin{frame}
\frametitle{HELLO \uncover<1->{I}\uncover<2->{I}\uncover<3->{I}}
\uncover<1->{ A \\}
\uncover<2->{ B \\}
\uncover<3->{ C \\}
\end{frame}

\end{document}

So my two question are pretty straightforward : do you know how to this properly (for example, I can't go beyond a counter value of 3 in this piece of code)? and what is the beamer counter that stores the "local numbering" I was referring to earlier in this post.

A: If I understand correctly your message, you're trying to put in the frame title the Roman number of the slide:
\newcommand{\slidenumber}[1]{%
  \csname @#1\expandafter\endcsname\csname beamer@slideinframe\endcsname}

\begin{document}

\begin{frame}
\frametitle{HELLO \slidenumber{Roman}}
\uncover<1->{ A \\}
\uncover<2->{ B \\}
\uncover<3->{ C \\}
\end{frame}

\end{document}

You can use also \slidenumber{arabic}, \slidenumber{roman} or even \slidenumber{alph} and \slidenumber{Alph}.


text:
Q: Android: convert json key value of list of lists to list of objects I receive the following String response from server (note the square brackets used in the values of users):
{
   "amount": 3,
   "users": [
      [
         "username1",
         "Name1"
      ],
      [
         "username2",
         "Name2"
      ],
      [
         "username3",
         "Name3"
      ]
   ]
}

How can I convert it to a List of User objects?? Preferably using GSON.
P.S. My User class contains fields username and name.
P.S.S. This post is NOT a duplicate for this post, since the formats of the JSON Outputs are completely different (in my case, the format is different from JSONArray fromat) and the answers to that post does not solve my problem...
Thank you!

A: check this
Type listType = new TypeToken<ArrayList<YourClass>>(){}.getType();
List<YourClass> yourClassList = new Gson().fromJson(response.getJSONArray("users"), listType);

A: Use below link to convert your JSON to models
jsonschema

*

*Choose Source type JSON and Annotation style Gson

Gson code:
Gson mGson = new Gson();
Type listType = new TypeToken<List<users>>() {}.getType();
List<users> object = mGson.fromJson(jsonString, listType);

hope this will help your doubt.


text:
Q: php Doesnt Search Database and pops out messagebox I am trying to search from database so that as soon as it searches the database and finds a matching , it pops out a Messagebox and shows "PAID" it doesn't respond in my case
My code is:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Search Payment</title>
<meta name="generator" content="Web Page Maker">

<?php
if(isset($_POST['submit']))
{
    include 'mysqlconn.php';

    $con = mysqli_connect($host, $dbuser, $pass, $db) or die('Cannot Connect');

    $name = mysqli_real_escape_string($con,$_POST['fullname']);

    $sql = "SELECT * FROM fees WHERE fullname = '$name'";
    if(mysqli_num_rows($sql) !=0)
    {
        echo ("");
    }
}
?>

EM Software Nigeria © 2016 All Rights Reserved

<form name="form1" style="margin:0px">
<input name="fullname" type="text" style="position:absolute;width:381px;left:308px;top:186px;z-index:7">
<input name="submit" type="submit" value="Search Database" style="position:absolute;left:548px;top:217px;z-index:8">
</form>

Search Student Name :

What could be Wrong here

A: $sql = "SELECT * FROM fees WHERE fullname = '$name'"; is just assigning a string to a variable.
You actually need to query the database.
$sql = mysqli_query($con, "SELECT * FROM fees WHERE fullname = '$name'");


text:
Q: Images In a Collection View I am coding in Swift 3.2, and inside of a TableView Controller have a TableView (scrolling vertically), and each row of the table holds a CollectionView (scrolling horizontally).
I am not sure if it is acceptable coding practice, but I made my ViewController class inherit UITableViewController and UICollectionViewDelegate and UICollectionViewDataSource.
For now, I have a hard coded array of image names and would like three images to scroll horizontally in each collection view, with each row having distinct images. However, as of now each row shows the same three images ("11.png", "12.png", "13.png"), and I was wondering how to fix this.
Below is my ViewController class.
//for the tableView
let event = generateRandomData()

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return event.count
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
    return cell
}

override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    guard let tableViewCell = cell as? TableViewCell else { return }
    tableViewCell.setCollectionViewDataSourceDelegate(self, forRow: indexPath.row)
}

//for the collectionView
var images: [String] = [
    "11.png", "12.png", "13.png",
    "21.png", "22.png", "23.png",
    "31.png", "32.png", "33.png",
    "41.png", "42.png", "43.png",
    "51.png", "52.png", "53.png",
    "61.png", "62.png", "63.png",
    "71.png", "72.png", "73.png",
    "81.png", "82.png", "83.png",
    "91.png", "92.png", "93.png",
    "101.png", "102.png", "103.png",
]

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return 3
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    collectionView.isPagingEnabled = true;      //makes the horizontal scrolling have no bounce and relatively have a better snap

    let myCell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionViewCell", for: indexPath as IndexPath) as! CollectionViewCell
    let myCellImage = UIImage(named: images[indexPath.row])
    myCell.eventImage.image = myCellImage

    return myCell
}

I am an amateur coder, so any help is greatly appreciated!

A: I am sure this problem already have an answer somewhere, but since I can't find that I'll just give one here.
Your mistake is here:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    /...

    let myCellImage = UIImage(named: images[indexPath.row]) //<< indexPath.row will return 0,1 and 2 for each of your collection view

    /...
}

Each collection view in your table view does not communicate amongst themselves to form a larger collective view. Since all of the are provided the int of 3 for numberOfItemsInSection and their numberOfSections defaulted to 1(you did not set any), each of them will request for item at indexpath (0,0), (0,1) and (0,2) when trying to populate their data.
Your hardcoded array however, is an array with 30 items. So each collection view when requesting for cellForItemAt will only get 0,1 and 2 for images[indexPath.row]. Also you should use indexPath.item for collection view, indexPath.row is for table views, it may or may not work if used wrongly.
Solution
You can just set the tag property of the collection view to mark it's row:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    /...

    //Make sure you have a subclass for UITableViewCell that have an IBOutlet that connects to the collection view
    cell.collectionView.tag = indexPath.row //Note that this only works in your situation where the table view have only 1 section.
    /...
}

Then split your array into a 2D array:
var images = [
    ["11.png", "12.png", "13.png"],
    ["21.png", "22.png", "23.png"],
    ["31.png", "32.png", "33.png"],
    ["41.png", "42.png", "43.png"],
    ["51.png", "52.png", "53.png"],
    ["61.png", "62.png", "63.png"],
    ["71.png", "72.png", "73.png"],
    ["81.png", "82.png", "83.png"],
    ["91.png", "92.png", "93.png"],
    ["101.png", "102.png", "103.png"]
]

Finally read the array in the collection view like:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    /...

    let myCellImage = UIImage(named: images[myCell.tag][indexPath.item])

    /...
}


text:
Q: argument of type "int (*)[2]" is incompatible with parameter of type "int **" C++ I am trying to transpose a matrix but I m getting this error while calling the function:argument of type "int (*)[2]" is incompatible with parameter of type "int **"
This error is occuring at : **int ans = trans(a, r, c);
#include <iostream>
using namespace std;

int **trans(int **arr, int r, int c)
{

    int **transpose = 0;
    int i, j;
    transpose = new int *[r];
    for (i = 0; i < r; ++i)
        for (j = 0; j < c; ++j)
        {
            transpose[j][i] = arr[i][j];
        }

    return transpose;
}
int main()
{

    int r = 3, c = 2, i, j;
    int a[3][2] = {{1, 2}, {3, 4}, {5, 6}};
    int **ans = trans(a, r, c);

    for (i = 0; i < c; ++i)
    {
        for (j = 0; j < r; ++j)
            cout << ans[i][j] << " ";
        cout << endl;
    }
    return 0;
}


text:
Q: Push-уведомления работают некорректно, если на экране есть ПИН-код Суть проблемы: если на экране устройства есть ПИН-код, графический ключ экрана Android, или что-нибудь подобное, то по клику на Push просто вызывается MainActivity приложения. Если ключа нету, то открывает нужную  Activity.
Код моего GCMListener:
@Override
public void onMessageReceived(String from, Bundle data) {
    String id = data.getString("news_id");
    String message = data.getString("message");
    Random random = new Random();
    Intent intent = new Intent(this, SpecificNewsActivity.class);
    intent.putExtra("newsId", id);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, random.nextInt(), intent,
            PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentTitle(getString(R.string.app_name))
            .setContentText(message)
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(random.nextInt(), notificationBuilder.build());
}

В чём может быть ошибка ?
Дополнительно: Выяснилось что такая проблема только на Китайских телефонах (Meizu, Xiaomi например).

A: Если кто еще столкнется с таким. Вопрос решился просто - запросы на сервер перенес из активити в которой был фрагмент, в сам фрагмент. Без этого на ксяоми и мейзу активити падала на этапе транзакции фрагмента в фрейм лейаут.


text:
Q: NullPointerException when trying to read an RDF file using Jena elephas's TriplesInputFormat in Spark I tried to load an RDF file into a Spark RDD using the Apache Jena Elephas. The RDF file is of the Turtle format. The code is as follows.
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.jena.hadoop.rdf.io.input.TriplesInputFormat
import org.apache.hadoop.io.LongWritable
import org.apache.jena.hadoop.rdf.types.TripleWritable
import org.apache.hadoop.conf.Configuration

object RDFTest {

  def main(args: Array[String]) = {

    val conf = new SparkConf()
      .setAppName("RDFTest")
      .setMaster("local")

    val sc = new SparkContext(conf)

    val hadoopConf = new Configuration()

    val rdfTriples = sc.newAPIHadoopFile(
        "file:///media/xinwang/Elements/data/chembl/20.0-uncompressed/cco.ttl",
        classOf[TriplesInputFormat],
        classOf[LongWritable],
        classOf[TripleWritable],
        hadoopConf)

    rdfTriples.take(10).foreach(println)

  }

}

However, when I ran the program, it threw a NullPointerException. The log info of running the program is as follows.
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
15/11/21 11:58:33 INFO SparkContext: Running Spark version 1.5.2
15/11/21 11:58:33 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
15/11/21 11:58:33 WARN Utils: Your hostname, x1 resolves to a loopback address: 127.0.1.1; using 192.168.0.7 instead (on interface wlan0)
15/11/21 11:58:33 WARN Utils: Set SPARK_LOCAL_IP if you need to bind to another address
15/11/21 11:58:33 INFO SecurityManager: Changing view acls to: xinwang
15/11/21 11:58:33 INFO SecurityManager: Changing modify acls to: xinwang
15/11/21 11:58:33 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(xinwang); users with modify permissions: Set(xinwang)
15/11/21 11:58:34 INFO Slf4jLogger: Slf4jLogger started
15/11/21 11:58:34 INFO Remoting: Starting remoting
15/11/21 11:58:34 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriver@192.168.0.7:45252]
15/11/21 11:58:34 INFO Utils: Successfully started service 'sparkDriver' on port 45252.
15/11/21 11:58:34 INFO SparkEnv: Registering MapOutputTracker
15/11/21 11:58:34 INFO SparkEnv: Registering BlockManagerMaster
15/11/21 11:58:34 INFO DiskBlockManager: Created local directory at /tmp/blockmgr-1bc925bc-9bc4-45d2-a67a-00b6d9790d85
15/11/21 11:58:34 INFO MemoryStore: MemoryStore started with capacity 919.9 MB
15/11/21 11:58:34 INFO HttpFileServer: HTTP File server directory is /tmp/spark-3a0e0453-af83-4fab-bf33-457d6e5932c7/httpd-047c004d-435f-474f-906c-78ee07e2ae2d
15/11/21 11:58:34 INFO HttpServer: Starting HTTP Server
15/11/21 11:58:34 INFO Utils: Successfully started service 'HTTP file server' on port 39793.
15/11/21 11:58:34 INFO SparkEnv: Registering OutputCommitCoordinator
15/11/21 11:58:34 WARN Utils: Service 'SparkUI' could not bind on port 4040. Attempting port 4041.
15/11/21 11:58:34 WARN Utils: Service 'SparkUI' could not bind on port 4041. Attempting port 4042.
15/11/21 11:58:34 INFO Utils: Successfully started service 'SparkUI' on port 4042.
15/11/21 11:58:34 INFO SparkUI: Started SparkUI at http://192.168.0.7:4042
15/11/21 11:58:34 WARN MetricsSystem: Using default name DAGScheduler for source because spark.app.id is not set.
15/11/21 11:58:34 INFO Executor: Starting executor ID driver on host localhost
15/11/21 11:58:35 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 45670.
15/11/21 11:58:35 INFO NettyBlockTransferService: Server created on 45670
15/11/21 11:58:35 INFO BlockManagerMaster: Trying to register BlockManager
15/11/21 11:58:35 INFO BlockManagerMasterEndpoint: Registering block manager localhost:45670 with 919.9 MB RAM, BlockManagerId(driver, localhost, 45670)
15/11/21 11:58:35 INFO BlockManagerMaster: Registered BlockManager
15/11/21 11:58:35 INFO MemoryStore: ensureFreeSpace(130896) called with curMem=0, maxMem=964574576
15/11/21 11:58:35 INFO MemoryStore: Block broadcast_0 stored as values in memory (estimated size 127.8 KB, free 919.8 MB)
15/11/21 11:58:35 INFO MemoryStore: ensureFreeSpace(14349) called with curMem=130896, maxMem=964574576
15/11/21 11:58:35 INFO MemoryStore: Block broadcast_0_piece0 stored as bytes in memory (estimated size 14.0 KB, free 919.8 MB)
15/11/21 11:58:35 INFO BlockManagerInfo: Added broadcast_0_piece0 in memory on localhost:45670 (size: 14.0 KB, free: 919.9 MB)
15/11/21 11:58:35 INFO SparkContext: Created broadcast 0 from newAPIHadoopFile at RDFTest.scala:22
15/11/21 11:58:35 INFO FileInputFormat: Total input paths to process : 1
15/11/21 11:58:35 INFO SparkContext: Starting job: take at RDFTest.scala:29
15/11/21 11:58:36 INFO DAGScheduler: Got job 0 (take at RDFTest.scala:29) with 1 output partitions
15/11/21 11:58:36 INFO DAGScheduler: Final stage: ResultStage 0(take at RDFTest.scala:29)
15/11/21 11:58:36 INFO DAGScheduler: Parents of final stage: List()
15/11/21 11:58:36 INFO DAGScheduler: Missing parents: List()
15/11/21 11:58:36 INFO DAGScheduler: Submitting ResultStage 0 (file:///media/xinwang/Elements/data/chembl/20.0-uncompressed/cco.ttl NewHadoopRDD[0] at newAPIHadoopFile at RDFTest.scala:22), which has no missing parents
15/11/21 11:58:36 INFO MemoryStore: ensureFreeSpace(1880) called with curMem=145245, maxMem=964574576
15/11/21 11:58:36 INFO MemoryStore: Block broadcast_1 stored as values in memory (estimated size 1880.0 B, free 919.7 MB)
15/11/21 11:58:36 INFO MemoryStore: ensureFreeSpace(1150) called with curMem=147125, maxMem=964574576
15/11/21 11:58:36 INFO MemoryStore: Block broadcast_1_piece0 stored as bytes in memory (estimated size 1150.0 B, free 919.7 MB)
15/11/21 11:58:36 INFO BlockManagerInfo: Added broadcast_1_piece0 in memory on localhost:45670 (size: 1150.0 B, free: 919.9 MB)
15/11/21 11:58:36 INFO SparkContext: Created broadcast 1 from broadcast at DAGScheduler.scala:861
15/11/21 11:58:36 INFO DAGScheduler: Submitting 1 missing tasks from ResultStage 0 (file:///media/xinwang/Elements/data/chembl/20.0-uncompressed/cco.ttl NewHadoopRDD[0] at newAPIHadoopFile at RDFTest.scala:22)
15/11/21 11:58:36 INFO TaskSchedulerImpl: Adding task set 0.0 with 1 tasks
15/11/21 11:58:36 INFO TaskSetManager: Starting task 0.0 in stage 0.0 (TID 0, localhost, PROCESS_LOCAL, 2207 bytes)
15/11/21 11:58:36 INFO Executor: Running task 0.0 in stage 0.0 (TID 0)
15/11/21 11:58:36 INFO NewHadoopRDD: Input split: file:/media/xinwang/Elements/data/chembl/20.0-uncompressed/cco.ttl:0+61178
15/11/21 11:58:36 WARN AbstractLineBasedNodeTupleReader: Configured to ignore bad tuples, parsing errors will be logged and further parsing aborted but no user visible errors will be thrown.  Consider setting rdf.io.input.ignore-bad-tuples to false to disable this behaviour
15/11/21 11:58:36 INFO AbstractLineBasedNodeTupleReader: Got split with start 0 and length 61178 for file with total length of 61178
15/11/21 11:58:36 ERROR AbstractLineBasedNodeTupleReader: Error parsing whole file, aborting further parsing
java.lang.NullPointerException
    at org.apache.jena.riot.lang.LangTurtleBase.directivePrefix(LangTurtleBase.java:162)
    at org.apache.jena.riot.lang.LangTurtleBase.directive(LangTurtleBase.java:139)
    at org.apache.jena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:78)
    at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
    at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:175)
    at org.apache.jena.hadoop.rdf.io.input.readers.AbstractWholeFileNodeTupleReader$1.run(AbstractWholeFileNodeTupleReader.java:185)
    at java.lang.Thread.run(Thread.java:745)
15/11/21 11:58:36 INFO Executor: Finished task 0.0 in stage 0.0 (TID 0). 2040 bytes result sent to driver
15/11/21 11:58:36 INFO TaskSetManager: Finished task 0.0 in stage 0.0 (TID 0) in 594 ms on localhost (1/1)
15/11/21 11:58:36 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks have all completed, from pool
15/11/21 11:58:36 INFO DAGScheduler: ResultStage 0 (take at RDFTest.scala:29) finished in 0.605 s
15/11/21 11:58:36 INFO DAGScheduler: Job 0 finished: take at RDFTest.scala:29, took 0.660084 s
15/11/21 11:58:36 INFO SparkContext: Invoking stop() from shutdown hook
15/11/21 11:58:36 INFO SparkUI: Stopped Spark web UI at http://192.168.0.7:4042
15/11/21 11:58:36 INFO DAGScheduler: Stopping DAGScheduler
15/11/21 11:58:36 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
15/11/21 11:58:36 INFO MemoryStore: MemoryStore cleared
15/11/21 11:58:36 INFO BlockManager: BlockManager stopped
15/11/21 11:58:36 INFO BlockManagerMaster: BlockManagerMaster stopped
15/11/21 11:58:36 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
15/11/21 11:58:36 INFO SparkContext: Successfully stopped SparkContext
15/11/21 11:58:36 INFO ShutdownHookManager: Shutdown hook called
15/11/21 11:58:36 INFO ShutdownHookManager: Deleting directory /tmp/spark-3a0e0453-af83-4fab-bf33-457d6e5932c7

When I tried to debug, it showed that at org.apache.jena.riot.lang.LangTurtleBase.directivePrefix(LangTurtleBase.java:162) the calling to the getPrefixMap() method returned a null pointer.
Screenshot of the location where the NullPointerException is thrown
Then I found in the Jena source code when the Prologue object is created at RdfIOUtils.createParserProfile(JobContext, Path) line: 60 in the initialization stage, it passes null as the first argument of the constructor.
null passed to the Prologue class constructor
And in the Prologue's constructor the argument pmap whose value is null is just assigned to this.prefixMap.
org.apache.jena.riot.Prologue.java line: 54
public Prologue(PrefixMap pmap, IRIResolver resolver)
{
    this.prefixMap = pmap ;
    this.resolver = resolver ;
}

I think this is probably the reason why the getPrefixMap() method returned a null pointer.
But I'm just wondering how to solve this problem.
Thanks so much for your help.

A: You could try to replace the TriplesInputFormat with the TurtleInputFormat which is in the package org.apache.jena.hadoop.rdf.io.input.turtle. Hoping this helps.

A: This is a bug in Elephas which has been filed as JENA-1075 and has now been fixed
The bug only affects Turtle inputs so you can avoid this by converting your input data to formats other than Turtle.
Alternatively you can point your Maven build to use the latest development snapshots (3.0.1-SNAPSHOT at the time of writing) which will pull down a version which includes the fix


text:
Q: jQuery event when select option What's the event to bind for when a select form is selected?
I have something like this:
<select id='list'>
<option value='1'>Option A</option>
<option value='2'>Option B</option>
<option value='3'>Option C</option>
</select>

When Option B is selected, I want some function to run.
So what do I bind,
$("#list").bind("?", function (){
// How do I check if it's option b that's selected here
//blah blah
});

A: the event you are looking for is change. more info about that event is available in the jquery docs here: http://docs.jquery.com/Events/change#fn

A: This jQuery snippet will get you started:
$('#list').change(function() {
    if ($(this).val() === '2') {
        // Do something for option "b"
    }
});

A: Although few years late, this actually works also if one select already selected option.
jQuery('#list').on('click', 'option', function () {
    if (jQuery(this).val() === '2') {
        // Do something for option "b"
    }
});

A: Maybe select() is a more accurated solution:
$('#list').select(function() {
    if ($(this).val() === '2') {
        // Do something for option "b"
    }
});


text:
Q: Callback in writeCapture I have script which I load this way:
$(funcion() {
    var html = ''
    html += '<script type="text/javascript" src="http://example.com/test.js"></script>'

    $('#divid').html(writeCapture.sanitize(html,function(){
        // if my test.js returns special content i do this:

        var cap = ''
        cap += '<script type="text/javascript" src="http://example.com/example.js"></script>'
        $('#divid').html(writeCapture.sanitize(cap))
    })
})

But I have error NOT_FOUND_ERR: DOM Exception 8. Where is my mistake?

A: Don't load scripts like that. Use the $.getScript() function instead:
$(function() {
    $.getScript('http://example.com/test.js', function() {
        // the script is loaded here => you can use it
    });
});


text:
Q: Dropbox Dropin Saver - Can I upload files from a computer? I am using Dropbox's Dropin Saver to upload files into my Dropbox account. Can I upload a file from my computer (not from a web site)?

A: No. Presumably the user could just do that on dropbox.com if they wanted?

A: As finding the straight-forward solution to your question is still not easy, let me point you to the Dropbox API Explorer:

*

*Create a Dropbox Web-App with a few clicks.

*Use its Access Token in the Dropbox API Explorer/upload to create a code snippet including a preview for what you are looking for.

*Use the cURL or Python code in your code.


text:
Q: deploy Large amount of data in setup I have a VB.NET 2008 desktop application.  My app needs large amounts of data (~4GB) to work.  These include several files types including access databases and DBF files and text files etc.  These are files I cannot change since my app is actually an UI for another program which the user prepares data files (the large number of different files) for.  Visusl studio doesn't let me build large installer due to 2GB memory limit and the /GB switch on boot file doesn't work for me.  Are there any other options ?

A: You could try nsis or innosetup installers (they don't impose such limits, afaik). Alternatively, you could place large files separately and either use some script/small gui wrapper which would copy/link them or even leave it to user. As another option, you could prompt for resource file location from your GUI program when it is started for the first time.
One more option is to build multi-volume installer.


text:
Q: What is the use case of atomFamily in recoil? I did my first experiment with recoil, building an editable table. Each cell has an atom which stores its row, column, and text value.
The way I built this was by

*

*initializing each cell's atom into a dictionary (just a plain object), with keys in a format of [column]x[row]

*I then iterate over these keys in the Table component, and pass only the key to each Cell component

*The Cell component uses useRecoilState and find its specific Atom by accessing the main dictionary using the key it got passed as a prop.

Now, it seems to me that this use case (creating thousands of related atoms with the same shape) is what atomFamily is meant to make easier, but I don't understand how to use it in this way, where you initialize each atom with a specific value.
And, besides that, I don't understand what is the advantage of using atomFamily over storing a collection of atoms. I understand there is memoization involved, but I don't understand what is getting memoized other than, if I am reading correctly, the ability to recall a specific atom by calling the function again with the same id, which would get you pretty much the same behavior I'm getting with a dictionary.

A: There is very little difference: if you want to manually memoize and manage your own collection of atoms, then you certainly can. atomFamily is essentially just sugar for that: it handles the memoization for you, so all that you have to do is use a unique key to access each atom. Verbatim from the documentation for atomFamily:

An atom represents a piece of state with Recoil. An atom is created and registered per <RecoilRoot> by your app. But, what if your state isn't global? What if your state is associated with a particular instance of a control, or with a particular element? For example, maybe your app is a UI prototyping tool where the user can dynamically add elements and each element has state, such as its position. Ideally, each element would get its own atom of state. You could implement this yourself via a memoization pattern. But, Recoil provides this pattern for you with the atomFamily() utility. An Atom Family represents a collection of atoms. When you call atomFamily() it will return a function which provides the RecoilState atom based on the parameters you pass in.

As far as examples for how to use atomFamily: beyond the documentation linked above, there are lots of existing questions and answers on Stack Overflow which already cover exactly that. Here are a couple which I have answered previously:

*

*Dynamic atom keys in Recoil

*Looking for a pattern to normalize state in Recoil without losing the benefit of Suspense


text:
Q: Linking CGAL & BOOSt to qt-creator project I'm trying to use CGAL and BOOST libraries in a QT-Creator project
I'm facing many errors in BOOST,QT headers which are already in their packages not on my code  pic
most errors about BOOST::GET and "normal" methos at "point_3" class..........
================================================================================
Compile output:
    .dr_projmy_polyhedron.cpp(201) : error C2039: 'vertex_index_map' : is not a member of 'CGAL'
..dr_projmy_polyhedron.cpp(201) : error C2780: 'boost::property_traits<boost::property_map<Config::graph_type,Property,void>::const_type>::reference boost::get(Property,const boost::adj_list_helper<Config,Base> &,const Key &)' : expects 3 arguments - 2 provided
C:localboost_1_59_0boost/graph/detail/adjacency_list.hpp(1754) : see declaration of 'boost::get'
..dr_projmy_polyhedron.cpp(201) : error C2780: 'boost::property_traits<boost::property_map<Config::graph_type,Property,void>::type>::reference boost::get(Property,boost::adj_list_helper<Config,Base> &,const Key &)' : expects 3 arguments - 2 provided
C:localboost_1_59_0boost/graph/detail/adjacency_list.hpp(1744) : see declaration of 'boost::get'
..dr_projmy_polyhedron.cpp(201) : error C2784: 'boost::property_map<Config::graph_type,Property,void>::const_type boost::get(Property,const boost::adj_list_helper<Config,Base> &)' : could not deduce template argument for 'const boost::adj_list_helper<Config,Base> &' from 'Surface'
C:localboost_1_59_0boost/graph/detail/adjacency_list.hpp(1733) : see declaration of 'boost::get'
..dr_projmy_polyhedron.cpp(201) : error C2784: 'boost::property_map<Config::graph_type,Property,void>::type boost::get(Property,boost::adj_list_helper<Config,Base> &)' : could not deduce template argument for 'boost::adj_list_helper<Config,Base> &' from 'Surface'
C:localboost_1_59_0boost/graph/detail/adjacency_list.hpp(1725) : see declaration of 'boost::get'
..dr_projmy_polyhedron.cpp(201) : error C2784: 'const property_value<Property,Tag>::type &boost::get(Tag,const boost::detail::stored_ra_edge_iter<Vertex,EdgeVec,Property> &)' : could not deduce template argument for 'const boost::detail::stored_ra_edge_iter<Vertex,EdgeVec,Property> &' from 'Surface'
C:localboost_1_59_0boost/graph/detail/adjacency_list.hpp(394) : see declaration of 'boost::get'
..dr_projmy_polyhedron.cpp(201) : error C2784: 'const property_value<Property,Tag>::type &boost::get(Tag,const boost::detail::stored_edge_iter<Vertex,Iter,Property> &)' : could not deduce template argument for 'const boost::detail::stored_edge_iter<Vertex,Iter,Property> &' from 'Surface'
C:localboost_1_59_0boost/graph/detail/adjacency_list.hpp(386) : see declaration of 'boost::get'
..dr_projmy_polyhedron.cpp(201) : error C2784: 'const property_value<Property,Tag>::type &boost::get(Tag,const boost::detail::stored_edge_property<Vertex,Property> &)' : could not deduce template argument for 'const boost::detail::stored_edge_property<Vertex,Property> &' from 'Surface'
C:localboost_1_59_0boost/graph/detail/adjacency_list.hpp(378) : see declaration of 'boost::get'

see more
.pro file
QT       += core gui
QT += widgets
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x000000

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = dr_proj
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += main.cpp\
        mainwindow.cpp \
    my_polyhedron.cpp \
    myqglwidget.cpp

HEADERS  += mainwindow.h \
    My_CGAL_Config.h \
    My_Face_base.h \
    My_Halfedge_base.h \
    my_polyhedron.h \
    My_Vertex_base.h \
    myqglwidget.h

FORMS    += mainwindow.ui
INCLUDEPATH += .
INCLUDEPATH += C:/dev/CGAL-4.9/auxiliary/gmp/include
INCLUDEPATH += C:/dev/CGAL-4.9/include
INCLUDEPATH += C:/local/boost_1_59_0 -lboost_filesystem
INCLUDEPATH += C:/dev/libQGLViewer-2.7.1/QGLViewer
INCLUDEPATH += C:/dev/CGAL-4.9/build/include
INCLUDEPATH +=C:/Qt/Qt5.7.1/5.7/msvc2013_64/include
INCLUDEPATH +=C:\Qt\Qt5.7.1\5.7\msvc2013_64\include\QtXml
INCLUDEPATH +=C:\Qt\Qt5.7.1\5.7\msvc2013_64\include\QtOpenGL

LIBS += -LC:/dev/CGAL-4.9/lib
LIBS += -LC:/local/boost_1_59_0/lib
LIBS += -LC:/dev/libQGLViewer-2.7.1/QGLViewer -lQGLViewerd2
LIBS += -LC:/Qt/Qt5.7.1/5.7/msvc2013_64/lib
LIBS += -LC:\local\boost_1_59_0\lib64-msvc-12.0
        -libboost_system-vc120-mt-1_59
        -libboost_thread-vc120-mt-1_59

DEPENDPATH += C:/dev/libQGLViewer-2.7.1/QGLViewer
DEPENDPATH += C:/local/boost_1_59_0/lib
DEPENDPATH += C:/dev/CGAL-4.9/lib
DEPENDPATH +=C:/Qt/Qt5.7.1/5.7/msvc2013_64/lib
DEPENDPATH +=C:\local\boost_1_59_0\lib64-msvc-12.0

I appreciate any help , thanks
*updated

A: The problem with Q_FOREACH is due to Qt defining a macro with name foreach: this was worked around in Boost 1.60 (Dec 2015), I suggest you upgrade your Boost installation. Also, Qt docs explain how to prevent the macro from being defined.


text:
Q: Javascript - Pass html string containing variables as parameter I want to execute a function that appends (jQuery) a li to an ul. Now I want to pass a string as a parameter that looks like:
v.name + " by " + v.artist

The problem is that the v.name and v.artist don't exist outside the function, because the function contains an .each loop:
function showAllItems (data, displayText) {
    $("ul.result-list").empty();
    $.each(data.results, function (k, v) {
        var name = eval(displayText);
        if ($("ul.chosen-list input#" + v.name).length == 0) {
            $("ul.result-list")
                .append($("<li>")
                    .append($("<input>", {id: v.name, value: v.name, type: "checkbox"}))
                    .append($("<label>", {html: name, for: v.name, class: "clickable"})));
        }
    });
}

What I am using now is eval(displayText) to convert a string into a real variable. But now I can't pass something like I said earlier (v.name + " by " + v.artist).
In short, I want to print a string containing variables that don't exist until the .each loop.
I hope someone can help me!
Thanks in advance,
Ian Wensink

A: Use a callback function to create the value:
function showAllItems (data, getDisplayText) {
  $("ul.result-list").empty();
  $.each(data.results, function (k, v) {
    if ($("ul.chosen-list input#" + v.name).length == 0) {
      var name = getDisplayText(v);
      $("ul.result-list")
        .append($("<li>")
          .append($("<input>", {id: v.name, value: v.name, type: "checkbox"}))
          .append($("<label>", {html: name, for: v.name, class: "clickable"}))
        );
    }
  });
}

Usage:
showAllItems(data, function(v){ return v.name + " by " + v.artist; });


text:
Q: Fetching only head of a single branch and pushing to an empty repo on Git I have a repo with my codebase, and each project inherits this codebase.
It has it's submodules on it and everything works fine.
When I start a new project from scratch, how is supposed to be cloning this repo (only the master branch) and only the HEAD (since I don't want each project have a lot of commits of the base).
I tried:
    git init
    git remote add -t origin URLtoProjectRepo
    git remote add -t codebase URLtoMainCodeBase
    git pull codebase master --depth=1

When I try to push this to the project repo I get:
    [remote rejected] master -> master (missing necessary objects)
    error: failed to push some refs to 'ProjectURL'

What I'm missing?

A: You cannot push an incomplete history, but making a no-history commit is easy:
git fetch --depth=1 git://wherever master
git checkout -B master $(git cat-file -p FETCH_HEAD|git commit-tree FETCH_HEAD^{tree})

will give you a fairly ugly commit message that includes the original history links as text; plopping |sed 1,/^$/d in there will strip even the documentary links to the past.

A: I had a similar problem to solve. I have a base repository which is essentially the core code for many other projects. The other projects first pull the core repository then check that into the new project repository. By doing that, any time changes are made to the core repo we can easily merge the changes into our projects. Being new to git, this is the result of what I learned while researching this. I took this out of a perl script I use to automate the process. It works great for me. Hope it helps you.
git init
git remote add origin new_repo
git add .
git commit -m 'initial commit'
git push origin master
git remote add base base_repo
git checkout -b base
git pull base master
git checkout master
git merge base
git push origin master
git branch -d base


text:
Q: Plz someone tell me how to solve this problem
Task :app:checkDebugAarMetadata FAILED
4 actionable tasks: 2 executed, 2 up-to-date

FAILURE: Build failed with an exception.

*

*What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.facebook.fresco:fresco:2.2.0.
Searched in the following locations:
- file:/C:/Users/anees/.m2/repository/com/facebook/fresco/fresco/2.2.0/fresco-2.2.0.pom
- file:/R:/project_01/node_modules/react-native/android/com/facebook/fresco/fresco/2.2.0/fresco-2.2.0.pom
- file:/R:/project_01/node_modules/jsc-android/dist/com/facebook/fresco/fresco/2.2.0/fresco-2.2.0.pom
- https://dl.google.com/dl/android/maven2/com/facebook/fresco/fresco/2.2.0/fresco-2.2.0.pom
- https://repo.maven.apache.org/maven2/com/facebook/fresco/fresco/2.2.0/fresco-2.2.0.pom
- https://www.jitpack.io/com/facebook/fresco/fresco/2.2.0/fresco-2.2.0.pom
Required by:
project :app > com.facebook.flipper:flipper-fresco-plugin:0.75.1
project :app > com.facebook.flipper:flipper-fresco-plugin:0.75.1 > com.facebook.fresco:flipper:2.2.0

A: Change your fresco version to 2.3.0.
This worked for me.

A: add this in android/app/build.gradle
     implementation 'com.facebook.fresco:fresco:2.0.0'
     implementation 'com.facebook.fresco:animated-gif:2.0.0'

     debugImplementation("com.facebook.flipper:flipper-fresco-
    plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
     }

A: you should update your FLIPPER_VERSION inside gradle.proprties file


text:
Q: Executing document's Javascript function by using third-party Javascript? Say I have localhost/site/index.php with one Javascript function and one button:
<html>
<head>
    <meta charset="utf-8" />
    <title>Page Title</title>
<script type="text/javascript">
    function my_function(){
        alert('Hello eveeryone!');
    }
</script>

</head>

<body>

<button type="button" onclick="my_function();" />Here is my button</button>

</body>
</html>

Is there a way to execute my_function() without clicking button - by using some kind of bookmarklet or similar kind of in-browser residing Javascript or anything else that not implies clicking on button-default interacting with document's Javascript?
EDIT:
Better explanation of problem:
can I use localhost/site/script.php to trigger above mentioned my_function that resides in localhost/site/index.php?

A: You can use the body onload function:
<body onload="my_function();">

A: You can use jQuery trigger.
$('button').trigger('click')

The button's onclick handler gets called. (Actually ALL buttons' onclick handlers are called. So maybe make a class or id for the specific button to target it)

A: I'm assuming that the web page is not yours so you can't modify it directly.  So, if you have a way of executing javascript in the context of the page (bookmarklet or plug-in or something like that) and you know what the name of the click handler function is, then you can just execute the click handler directly with:
my_function()

EDIT: because now it appears from comments that you are actually asking a question about the security of your own web page.
You cannot prevent the execution of javascript functions in your own web page.  There are numerous ways for people to inject code into your page from their own browser that can call anything in your web page that is globally accessible.  You cannot prevent that.  It's possible to make it more difficult to directly call event handlers, but this just makes it slightly more work, but does not prevent it.
Security MUST be implemented on your server - it cannot be implemented in a web page.  A browser client web page is NOT a secure environment.  It can be freely modified.  Whatever you are trying to protect from must be implemented on the server.


text:
Q: Can two array be traversed through one for-each loop? I have two array say ..
String[] a = {
    "dog", "cat", "turtle"
 };
String[] b = {
    "doog", "caat", "tuurtle"
 };

And I traverse like
for (String s: a) {
Sop(s).
}

like wise again we need to traverse the second Array.
But my Qsn is using one enhanced for loop (for each loop) can I traverse or do some operation using two of the arrays.
Your help would be appreciated..

A: for(int n=0; n<2; n++)
{
   a[n];
   b[n];
}

But in this case u have to know array length and arrays have to have a same size
or
if(a.length == b.length)
{
   for(int n=0; n<2; n++)
   {
       a[n];
       b[n];
    }
}

A: Its not possible with for-each loop. But you can have multiple indexing in for loop. Something like this
    String[] a = {"dog", "cat", "turtle"};
    String[] b = {"doog", "caat", "tuurtle"};

    for (int i = 0, j = 0; i < a.length || j < b.length; i++, j++) {
        if(i < a.length){
            System.out.println(a[i]);
        }
        if(j < b.length){
            System.out.println(b[j]);
        }
    }

A: It is not possible in for each loop. but you can traverse through simply index base loop as other answered.

A: String[] a = {
"dog", "cat", "turtle"
};
String[] b = {
"doog", "caat", "tuurtle"
 };

And I traverse like
if(a.length==b.length){
 int i=0;
for (String s: a) {
Sop(s);
Sop(b[i++]);

}
}

A: There is no language construction for doing this but you can implement it. Build an iterator over the to structures with two fields...


text:
Q: GWT Context2d lineWidth Im trying to draw lines (GWT, Context2d) that are 1 pixel thick, code snippet below:
context.beginPath();
context.setStrokeStyle("rgb(255,0,0)");
context.setLineWidth(1f);
double x = 0;
double gridSize = 10.0f;
while (x < w){
    x += gridSize;
    context.moveTo(x, 0);
    context.lineTo(x, h);
}
context.stroke();

This code draws lines that are at least 2 pixel thick.
Any ideas?

A: Try to add 0.5 to your coordinates.
Browsers apply antialiasing this may cause blurriness or "2 pixel thick lines".


text:
Q: Why is Union() not excluding duplicates like it should? EDIT: Why is Union() not excluding duplicates like it should?
I should have read the documentation before asking the original question. I didn't because everytime I used Union() was on lists of objects that didn't override Equals() and GetHashCode(), so even if the value of the fields of each of my objects in the lists were the same, they would be inside the new list Union() created. At first it would seem as if Union() didn't exclude duplicates and that was what I believed was true. But Union() does, in fact, exclude duplicates. And not only duplicates in both lists, but also duplicates within the same list. If my objects don't override Equals() and GetHashCode() they are not compared by value and that means that they are not seem as duplicates.
This was the confusion that made me ask this question.
Once I create a new List using Union() and then Select() the fields explicitly, "T" would become an anonymous type, which is compared by value. This way, objects with the same value of fields would be seem as duplicates. That is what is causing Union() to behave differently (or rather appear to behave differently). It always excludes duplicates but not always a type is compared by value, so objects with the same value of fields may or may not be seem as duplicates. It depends on the implementation of your custom class.
I guess that should have been the question: Why is Union() not excluding duplicates like it should? (as we've seen, it's because my objects were not really duplicates). Is that right?
----------------------
Original Question: LINQ Union + Select is removing duplicates automatically. Why?
I've always thought that Union() in Linq would return all values from the two lists even if they are the same. But my code is removing duplicates from the first list when I use 'Select()' right after a Union().
Imagine the classic probability problem of ball extraction, where I have different containers and I extract some number of different balls from the containers.
I have two lists of BallExtraction. Each list shows me the Id of the ball, the Id of the container that the ball was in, the number of balls I have extracted (Value) and its Color. But, for some reason, I have two different lists and I want to merge them.
Example Code:
class BallExtraction
{
    public enum BallColor
    {
        Blue = 0,
        Red = 1
    }

    public int Id { get; set; }
    public int IdContainer { get; set; }
    public int ValueExtracted { get; set; }
    public BallColor Color { get; set; }

    public BallExtraction() { }

    public BallExtraction(int id, int idContainer, int valueExtracted, BallColor color)
    {
        this.Id = id;
        this.IdContainer = idContainer;
        this.ValueExtracted = valueExtracted;
        this.Color = color;
    }

}

And now I run the program that follows:
class Program
{
    static void Main(string[] args)
    {
        List<BallExtraction> list1 = new List<BallExtraction>();
        list1.Add(new BallExtraction(1, 1, 20, BallExtraction.BallColor.Blue));
        list1.Add(new BallExtraction(1, 1, 20, BallExtraction.BallColor.Blue));
        list1.Add(new BallExtraction(1, 1, 20, BallExtraction.BallColor.Red));
        list1.Add(new BallExtraction(1, 2, 70, BallExtraction.BallColor.Blue));
        list1.Add(new BallExtraction(2, 1, 10, BallExtraction.BallColor.Blue));

        List<BallExtraction> list2 = new List<BallExtraction>();
        list1.Add(new BallExtraction(3, 2, 80, BallExtraction.BallColor.Blue));
        list1.Add(new BallExtraction(3, 2, 80, BallExtraction.BallColor.Red));

        var mergedList = list1.Where(w => w.Color == BallExtraction.BallColor.Blue).Select(s => new
        {
            Id = s.Id,
            IdContainer = s.IdContainer,
            ValueExtracted = s.ValueExtracted
        }).Union(list2.Where(w => w.Color == BallExtraction.BallColor.Blue).Select(s => new
        {
            Id = s.Id,
            IdContainer = s.IdContainer,
            ValueExtracted = s.ValueExtracted
        }));

        Console.WriteLine("Number of items: {0}", mergedList.Count());

        foreach (var item in mergedList)
        {
            Console.WriteLine("Id: {0}. IdContainer: {1}. # of balls extracted: {2}", item.Id, item.IdContainer, item.ValueExtracted);
        }

        Console.ReadLine();

    }
}

The expected output is:
Number of items: 5
Id: 1. IdContainer: 1. Value: 20.
Id: 1. IdContainer: 1. Value: 20.
Id: 1. IdContainer: 2. Value: 70.
Id: 2. IdContainer: 1. Value: 10.
Id: 3. IdContainer: 2. Value: 80.

But the actual output is:
Number of items: 4
Id: 1. IdContainer: 1. Value: 20.
Id: 1. IdContainer: 2. Value: 70.
Id: 2. IdContainer: 1. Value: 10.
Id: 3. IdContainer: 2. Value: 80.

Notice that the first list contains two extractions with the same values. The Id of the ball is 1, the Id of the container is 1, the number of balls extracted is 20 and they are both blue.
I found that when I switch the 'mergedList' to the code below, I get the expected output:
var mergedList = list1.Where(w => w.Color == BallExtraction.BallColor.Blue).Union(list2.Where(w => w.Color == BallExtraction.BallColor.Blue));

So, it seems that the 'Select' used right after the Union() is removing the duplicates from the first list.
The real problem is that I don't actually have a list of a simple type like in the example but I have a list of IEnumerable< T > (T is an anonymous type) and T has a lot of fields. I only want specific fields but I want all the new anonymous type duplicates. The only workaround I have found is if in the 'Select()' I add some field that is unique to each object T.
Is this working as intended? Should Union + Select remove duplicates?

A: Yes, it's the expected behaviour.
Union's doc states

Return Value Type: System.Collections.Generic.IEnumerable An IEnumerable that contains the elements from both input
  sequences, excluding duplicates.

To keep duplicates, you have to use Concat(), not Union()


text:
Q: configuring 2 digium card in single system? I have two digium cards ,models are TE420 4 port card,TE121 single port card.
After the configuration 4 port card
if i execute "dahdi show status" in asterisk prompt , I got following output
Description                              Alarms  IRQ    bpviol CRC4
T4XXP (PCI) Card 0 Span 1                OK      46      0      0
T4XXP (PCI) Card 0 Span 2                OK      46      0      0
T4XXP (PCI) Card 0 Span 3                OK      46      0      0
T4XXP (PCI) Card 0 Span 4                OK      46      0      0
Wildcard TE121 card 0                    OK      32457   0      0

Why I am not getting the Span 5 for the single port card.

A: check by typing pri show spans in asterisk cli
and also in linux shell type dahdi_cfg -vvvv  it will output all the channesl configured

A: The description you see there is the span description filled in by the DAHDI drivers for each span. When they fill in the description they do not yet know what global span number they were assigned. The 1-4 is just showing the spans that are exported by card 0. Since TE121 only export a single span, they only indicate their card number.
If you're using these cards with PRI, I agree that with striker that 'pri show spans' is a more useful command to see the status of the spans.
Running dahdi_maint from the console is also a good way to see the current status of any DAHDI spans you have configured in your system.


text:
Q: Ruby on Rails - Action Mailer 400 Bad request I'm having the following error when I try send a form with Ruby on Rails 4.1 and Action Mailer:
Started POST "/contact_sponsors" for 127.0.0.1 at 2018-05-17 16:22:35 -0300
Processing by ContactSponsorsController#create as JS
  Parameters: {"utf8"=>"✓", "contact_sponsor"=>{"company_name"=>"godocu@mailinator.com", "company_cnpj"=>"dahok@mailinator.com", "company_cep"=>"watyhib@mailinator.com", "company_address"=>"dofimocah@mailinator.com", "company_number"=>"duki@mailinator.com", "company_existence"=>"mamopiwir@mailinator.net", "company_sponsor_type"=>"", "responsible_name"=>"qomukuf@mailinator.com", "responsible_email"=>"ryhohiqe@mailinator.net", "additional_infos"=>"Eum sit nesciunt occaecat facere delectus vel aut sint animi pariatur Ut ipsum officia ratione est enim est"}}
  HomeConfig Load (4.1ms)  SELECT  `home_configs`.* FROM `home_configs`   ORDER BY `home_configs`.`id` ASC LIMIT 1
   (0.2ms)  BEGIN
   (0.4ms)  ROLLBACK
  Rendered text template (0.0ms)
Completed 400 Bad Request in 16ms (Views: 0.8ms | ActiveRecord: 4.8ms)

Anyone can help me? I've tried to sort this out in many ways but to no avail. Here is my Controller, Mailer and Model:
class ContactSponsorsController < InheritedResources::Base
  def create
    @contact_sponsor = ContactSponsor.new
    if @contact_sponsor.save
      ContactSponsorMailer.delay_for(10.seconds, retry: true).create(@contact_sponsor)
      render nothing: true, status: 200
    else
      render nothing: true, status: 400
    end
  end
end

class ContactSponsorMailer < ActionMailer::Base
  default from: "Facens Lince <no-reply@facens.br>"

  def create(contact_sponsor)
    @contact_sponsor = contact_sponsor
    mail(to: "felipe.marcon@atua.ag", subject: "Contato Através do Site")
  end
end

class ContactSponsor < ActiveRecord::Base
  validates :company_cnpj, :company_address, :company_number, :company_size, :company_existence, :company_sponsor_type, :responsible_name, :responsible_email, presence: true
end

Thanks.

A: @contact_sponsor.save returned false therefore it returns 400.
Check the errors you had with @contact_sponsor.errors.full_messages when it returns false, or use save! to raise an exception (discouraged, use it only for debugging) and see what went wrong.

A: As per the logs shown and code snippet shared, it seems like the attribute "company_sponsor_type" seems to be blank string and in the model you have the written the presence true of the same attribute and thus it is getting rolled back.
So either remove the validation or send some value in the company_sponsor_type key.

A: Look, in the ContactSponsor you have validate those data which must be present but you have not passed any data that means empty that's why

Completed 400 Bad Request

and for this, you need to create a private method for strong parameters look at that below
class ContactSponsorsController < InheritedResources::Base
    def create
        @contact_sponsor = ContactSponsor.new(contact_sponsor_params)
        if @contact_sponsor.save
            ContactSponsorMailer.delay_for(10.seconds, retry: true).create(@contact_sponsor)
            render nothing: true, status: 200
        else
            render nothing: true, status: 400
        end
    end

    private

    def contact_sponsor_params
        params.require(:contact_sponsor).permit(:company_cnpj, :company_address, :company_number, :company_size, :company_existence, :company_sponsor_type, :responsible_name, :responsible_email)
    end
end

I think it will work.


text:
Q: How to get Error details collected by app center Diagnostics report using App Center Open API specification I have a Xamarin Forms mobile app configured on App Center to collect all kind of issues occurred. I am trying to use App Center Open API Specification Errors API. In order to invoke these APIs the accepted tokens are:

*

*User API Token

*App API Token

I have already created these two tokens. As per Docs it says to add X-API-Token key under header property. While I am trying it's not working. Can someone tell what should be the correct key name for these two tokens under header property in order to invoke the API.
Request:

Response:


text:
Q: Java.Lang.RuntimeException: No Activity found to handle Intent { act=android.intent.action.VIEW dat= (has extras) } This is my below code issue happens to navigate browser side
await Browser.OpenAsync(https://www.yyy.com, BrowserLaunchMode.SystemPreferred);

pasted below in stack trace
"stackTrace": "  at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method,
Java.Interop.JniArgumentValue* args) [0x0006e] in :0 \n  at
Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self,
Java.Interop.JniArgumentValue* parameters) [0x00014] in :0 \n  at AndroidX.Browser.CustomTabs.CustomTabsIntent.LaunchUrl (Android.Content.Context context, Android.Net.Uri url) [0x00053] in <9438f96c1dab498fbf52645fed854bcc>:0 \n  at Xamarin.Essentials.Browser.PlatformOpenAsync (System.Uri uri, Xamarin.Essentials.BrowserLaunchOptions options) [0x00113] in :0 \n  at Xamarin.Essentials.Browser.OpenAsync (System.Uri uri, Xamarin.Essentials.BrowserLaunchOptions options) [0x00006] in :0 \n  at Xamarin.Essentials.Browser.OpenAsync (System.Uri uri, Xamarin.Essentials.BrowserLaunchMode launchMode) [0x0000d] in :0 \n  at  [0x00014] in <6e31dbe00f134cddbd6acb93dc0d515f>:0 \n  --- End of managed Java.Lang.RuntimeException stack trace ---\nandroid.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://www.yyy.com/... (has extras) }\n\tat
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2022)\n\tat
android.app.Instrumentation.execStartActivity(Instrumentation.java:1677)\n\tat android.app.Activity.startActivityForResult(Activity.java:4696)\n\tat
androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:584)\n\tat android.app.Activity.startActivityForResult(Activity.java:4654)\n\tat androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:570)\n\tat android.app.Activity.startActivity(Activity.java:5015)\n\tat androidx.core.content.ContextCompat.startActivity(ContextCompat.java:251)\n\tat androidx.browser.customtabs.CustomTabsIntent.launchUrl(CustomTabsIntent.java:376)\n\tat crc643f46942d9dd1fff9.InnerGestureListener.n_onSingleTapUp(Native Method)\n\tat crc643f46942d9dd1fff9.InnerGestureListener.onSingleTapUp(InnerGestureListener.java:79)\n\tat android.view.GestureDetector.onTouchEvent(GestureDetector.java:669)\n\tat crc643f46942d9dd1fff9.Platform_DefaultRenderer.n_dispatchTouchEvent(Native Method)\n\tat crc643f46942d9dd1fff9.Platform_DefaultRenderer.dispatchTouchEvent(Platform_DefaultRenderer.java:56)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat crc643f46942d9dd1fff9.VisualElementRenderer_1.n_dispatchTouchEvent(Native Method)\n\tat crc643f46942d9dd1fff9.VisualElementRenderer_1.dispatchTouchEvent(VisualElementRenderer_1.java:68)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat crc643f46942d9dd1fff9.Platform_DefaultRenderer.n_dispatchTouchEvent(Native Method)\n\tat crc643f46942d9dd1fff9.Platform_DefaultRenderer.dispatchTouchEvent(Platform_DefaultRenderer.java:56)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat crc643f46942d9dd1fff9.Platform_DefaultRenderer.n_dispatchTouchEvent(Native Method)\n\tat crc643f46942d9dd1fff9.Platform_DefaultRenderer.dispatchTouchEvent(Platform_DefaultRenderer.java:56)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat crc643f46942d9dd1fff9.Platform_DefaultRenderer.n_dispatchTouchEvent(Native Method)\n\tat crc643f46942d9dd1fff9.Platform_DefaultRenderer.dispatchTouchEvent(Platform_DefaultRenderer.java:56)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat crc643f46942d9dd1fff9.VisualElementRenderer_1.n_dispatchTouchEvent(Native Method)\n\tat crc643f46942d9dd1fff9.VisualElementRenderer_1.dispatchTouchEvent(VisualElementRenderer_1.java:68)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat crc643f46942d9dd1fff9.VisualElementRenderer_1.n_dispatchTouchEvent(Native Method)\n\tat crc643f46942d9dd1fff9.VisualElementRenderer_1.dispatchTouchEvent(VisualElementRenderer_1.java:68)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat crc643f46942d9dd1fff9.PlatformRenderer.n_dispatchTouchEvent(Native Method)\n\tat crc643f46942d9dd1fff9.PlatformRenderer.dispatchTouchEvent(PlatformRenderer.java:47)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)\n\tat com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:734)\n\tat com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1880)\n\tat android.app.Activity.dispatchTouchEvent(Activity.java:3494)\n\tat androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)\n\tat androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)\n\tat com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:692)\n\tat android.view.View.dispatchPointerEvent(View.java:13721)\n\tat android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6200)\n\tat android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5978)\n\tat android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5427)\n\tat android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5480)\n\tat android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5446)\n\tat android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5605)\n\tat android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5454)\n\tat android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5662)\n\tat android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5427)\n\tat android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5480)\n\tat android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5446)\n\tat android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5454)\n\tat android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5427)\n\tat android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8504)\n\tat android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8424)\n\tat android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8377)\n\tat android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8619)\n\tat android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:198)\n\tat android.os.MessageQueue.nativePollOnce(Native Method)\n\tat android.os.MessageQueue.next(MessageQueue.java:326)\n\tat android.os.Looper.loop(Looper.java:181)\n\tat android.app.ActivityThread.main(ActivityThread.java:7156)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)\n",


text:
Q: Change of variables proof on triangle
Let $f$ be continuous on $[0,1]$ and let $R$ be the triangular region with vertices $(0,0) (1,0),$ and $(0,1)$. Show that $\iint_R f(x+y)\,dA = \int_0^1uf(u)\,du$

I've found $u=x+y$ and $v=y-x$.
when I calculate the Jacobian a $2$ appears and it seems a little bit false.
$$\int_0^1\int_0^1f(u)2\,\,dvdu$$
A little clue will be appreciated

A: Mistake $1$ is to multiply by $2$, in fact it should be divides by $2$.
Mistake $2$ is assuming that the corresponding $(u,v)$-region is going to be a square, it is actually a triangle.
If you fix the $u=0$, $v$ is going to take value from $0$ to $0$.
If you fix $u=1$, $v$ is going to take value from $-1$ to $1$.
If $u=u_0$, $v$ takes value from $-u_0$ to $u_0$.
Hence after transforming the coordinate, the right region is
$$\int_0^1\int_{-u}^u \frac12f(u)\,dv\,du$$


text:
Q: PHP: Trying to get property or methods of non-object I am trying to save an object as property in an another class, PHP throwing notices and fatal errors. Simplified version of my code:
<?php
    class A {
        public function a() {
            // do something
        }
    }
    $A = new A();

    class B {
        private $A;
        public function __constructor($A) {
            $this->A = $A;
        }
        private function b() {
            if($this->A->a()) { // This line is referred by PHP
                // do something
            }
        }
    }

    $B = new B($A);

A: You have a typo. Change __constructor to __construct and PHP will process your code correctly.  Constructors in PHP are always named __construct.  See the documentation for more details.


text:
Q: Custom filter for all event logs that apply for new logs as well I know you can create default filters for your local event logs. When I support customers I often receive an .evt file that I have to look through. I begin every search by going to filter, scrolling to my desired sources, and then beginning to look for issues.
I'm looking for a way to create a default filter that applies to all event logs, even external .evt files that you just open temporarily. How can I do this?

A: There are several workarounds that may help you

*

*Create your default filter for one DEFAULT log file and then, when you need to check your new log file, just rename it to this DEFAULT file name.

*If renaming not possible
make a text document which lists your desired filters as an XPath queries. It will be your filter library.
E.g. *[System[Provider[@Name='Application Error' or @Name='Application Hang']]]
After log opening, go to Filter, then switch to XML, click Edit query manually and modify XML query - replace * with the XPath.
For complex filters, it should work faster than using UI

*A better option - try Event Log Explorer (free for noncommercial use). It lets you set predefined filters for all online logs and log files at once.


text:
Q: Inserir imagem no Ireport Estou tentando inserir uma imagem no Ireport 3.7.5.
Quando arrasto o campo de Imagem para a pagina e coloco a url estática com o endereço da imagem, funciona, mas quando coloco la no Image Expression desse jeito :
System.getProperty("user.dir") + "\\fotos" + "\\"+$F{FOTO}

O código acima gerar o mesmo endereço eu usei na url estática que funciona
Mas dá erro:

Error filling print... Byte data not found at location : C:\Program Files (x86)\Jaspersoft\iReport-3.7.5\fotos\clob46: 'ICONE3.png'
  net.sf.jasperreports.engine.JRException: Byte data not found at location : C:\Program Files (x86)\Jaspersoft\iReport-3.7.5\fotos\clob46: 'ICONE3.png'

[EDIT 1]
Meu método ficou assim:
public void relatorio ( String codigo ){
      String arquivo = null;

       try{

           conn = ConnectionFactory.getConnection();

            arquivo = System.getProperty("user.dir") + "/src/relatorio/rel_cadastro.jrxml";
            //System.out.println("Caminho do arquivo jrml: "+arquivo);
           JasperDesign design = JRXmlLoader.load(arquivo);
       //    InputStream path1 = classLoader.getResourceAsStream("/images/logo.jpg");
           String foto = System.getProperty("user.dir") + "\\fotos\\ICONE3.png";
           InputStream path = ClassLoader.getSystemResourceAsStream( foto );

           JasperReport jr = JasperCompileManager.compileReport( design );

           HashMap valores = new HashMap();
           valores.put("CODIGO", codigo );
           valores.put("imagem", path);

           JasperPrint impressao = JasperFillManager.fillReport(jr,valores,conn);

           JasperViewer jrViewer = new JasperViewer(impressao, false);

           jrViewer.setVisible(true);
           jrViewer.setDefaultCloseOperation(JasperViewer.DISPOSE_ON_CLOSE);

       }
       catch(JRException e){
           System.out.println("Erro no relatorio: \n"+e.getMessage());
       }
   }

A: IReport
Muda o tipo do campo de Imagem do relatório para java.io.InputStream. Cria uma variável de parâmetro  $P{imagem} do tipo InputStream no IReport.
JAVA:
InputStream imgPath =  new FileInputStream("C://images//sua_imagem.jpg");

HashMap<String, Object> params = new HashMap<String, Object>();
params.put("imagem",imgPath );

Você pode recuperar a sim do seu classpath :
String path  = System.getProperty("user.dir") + "\\fotos\\ICONE3.png" );

Ou a sim em aplicação Web  :
    HttpServletRequest request;
    ServletContext context = request.getServletContext();
    InputStream path = context.getResourceAsStream("/images/logo.jpg")

Se tudo o que você quer, é um InputStream  você pode criar usando new FileInputStream(path), ou getResourceAsStream().
Muda esse trecho:
 String foto = System.getProperty("user.dir") + "\\fotos\\ICONE3.png";
 InputStream path = ClassLoader.getSystemResourceAsStream( foto );

Para:
 String foto = System.getProperty("user.dir") + "\\fotos\\ICONE3.png";
 InputStream path =  new FileInputStream(foto);

Assim deu certo em seu casso porque é uma aplicação DESKTOP e a imagem está externa mais com inputStream daria certo também:
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("imagem", System.getProperty("user.dir") + "\\fotos\\ICONE3.png" );

jasper.jrxml
Experimente isso no campo que você deseja imprimir apenas condicionalmente ... No "*Print When Expression*" só exibir quando ($P{imagem} != null).


text:
Q: nuget: "The replacement token 'id' has no value" Executing
nuget.exe pack ..\.nuget\nuget.exe pack ..\pathToProject\myproject.nuspec -IncludeReferencedProjects -Prop Configuration=Release

I get the error
The replacement token 'id' has no value.

The nuspec looks like this
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>$id$</id>
        <version>$version$</version>
        <title>$id$</title>
        <authors>$author$</authors>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>$description$</description>
    </metadata>
</package>

A: When using token replacement, make sure your are trying to nuget pack the csproj file, not the nuspec file
nuget pack myproject.csproj -IncludeReferencedProjects -Prop Configuration=Release

The nuspec is picked up automatically when given the same name as the csproj file.


text:
Q: wrong time using Gedmo Bundle Im using Gedmo bundle to save automatically the time in two rows "created_at" and "updated_at",all works fine but it save the data with a wrong time,for example when I save  something in 2:00 pm I find it put 4:00pm in database...its very weird...

A: Locate the php.ini file on your machine
in my machine file located at "/etc/php5/apache2/php.ini"
Find the line with ;date.timezone = under the [Date] section, and set it to your timezone based on PHP's list of timezones
I chose Asia/Kolkata because i lived there. Also, make sure to remove the semicolon at the beginning of the line!
Don't forget to restart apache -  sudo service apache2 restart

A: Change timezone using below php function.
date_default_timezone_set('YourTimeZone');

For more detail refer : http://php.net/manual/en/function.date-default-timezone-set.php


text:
Q: Trying to draw a filled circle but it has got a black background I want to draw a circle with a certain color, which fills out the whole circle. I'm using auto layout to determine the size of the circle. If I'm doing this the circle is drawn but the background color is black. It should be a clear color so that the background can shine through and the circle should be round of course. This is my code in C#, but it isn't that much difference to Objective-C.
public class Circle : UIView
    {
        private UIColor color;

        public Circle ()
        {
            this.color = UIColor.Red;
        }

        public override void Draw (RectangleF rect)
        {
            base.Draw (rect);

            this.BackgroundColor = UIColor.Clear;

            float red = 0;
            float green = 0;
            float blue = 0;
            float alpha = 0;
            color.GetRGBA (out red, out green, out blue, out alpha);

            float lineWidth = 2.0f;
            RectangleF borderRect = RectangleF.Inflate (rect, -lineWidth/2, -lineWidth/2);

            // Get the context
            CGContext context = UIGraphics.GetCurrentContext ();

            // Set the border width
            context.SetLineWidth (lineWidth);

            // Set the circle fill color
            context.SetRGBFillColor (red, green, blue, alpha);

            // Set the circle border color
            context.SetRGBStrokeColor (red, green, blue, alpha);

            // Fill the circle with the fill color
            context.FillEllipseInRect (borderRect);

            // Draw the circle border
            //context.StrokeEllipseInRect (borderRect);
        }
    }
}

The circle is slightly smaller than the UIView so that is drawn correctly not touching the edges (and so cutting of some parts).
But the background is black as you can see here:

How can I draw a filled circle?

A: Seems that I have to put this
this.BackgroundColor = UIColor.Clear;

into the constructor. Now I don't have a black background anymore.
It seems also that it is sufficient to use these lines of code for drawing:
context.AddEllipseInRect (rect);
context.SetFillColor (color.CGColor);
context.FillPath ();


text:
Q: How to remove the currency symbol form the Matrix Printable view? While I can always export a report's raw data, and create the Matrix/Pivot table in Excel, This misses the point of using SF as a wide tool.
Currently, in the Matrix report

I use the "Printable View", but when opening in Excel, I would like to use the data as a calculated sum.
The main point is to remove the "USD" from each cell. (I know I can do this in Excel replace)  I want it done, export as an Excel format (e.g. with out the USD text)
The excel is shown like this:

Is it possible?

A: One solution would be to create 2 custom formula fields on the object, of type number (not currency) and equal to the corresponding currency field.
Then report on these custom fields : being number, they will not display the currency field.


text:
Q: Anyway to make tasmota imitate a push button click? I was wondering if there is a way to use tasmota to imitate a push button click. I'am using an esp32 with tasmota and wired it to a remote with 2 buttons. There a 2 transistors for each button. It works how it is right now but the logic of the buttons on the Tasmota website toggles the output. So that I have to click and click to send a pulse. Is there a way to make the digital button click like a push button?.
Also is there a way to remember a variable for example from 1 to 6 and display it next to the button?
Thank you!

A: For short impulse can use : PulseTime
1..111 = set PulseTime for Relay in 0.1 second increments
112..64900 = set PulseTime for Relay, offset by 100, in 1 second increments. Add 100 to desired interval in seconds, e.g., PulseTime 113 = 13 seconds and PulseTime 460 = 6 minutes (i.e., 360 seconds)
For save to variables can use like it:
rule1
 on button1#state DO var1=%value% ENDDO
 on button2#state DO var2=%value% ENDDO

For use differ method of action better to use event:
When state of buttons changed then sent event:
 on button1#state DO event#b1 %value% ENDDO
 on button2#state DO event#b2 %value% ENDDO

Then Event that was send expanded on your commands like power1 on/off :
 on event#b1 DO power1 %value% ENDDO
 on event#b2 DO power2 %value% ENDDO

And remote by MQTT can sent event for button1, and should be run same commands like and for your buttons :
mosquitto_pub  -h HOST -t cmnd/tasmota_NNNN/event#b1 -m 1


text:
Q: VIDEOIO ERROR: V4L: can't find camera device I am using ubuntu16.04 and trying to run opencv script.
when i use:
video_capture = cv2.VideoCapture(-1)

it gives me error VIDEOIO ERROR: V4L: can't find camera device
No video window opens
But when i run
video_capture = cv2.VideoCapture('test.jpg')

It opens window shows the picture and close the window.
Please tell me why it is not streaming video directly from camera.

A: The suggestion api55 gave in his comment
video_capture = cv2.VideoCapture(0)

is what I would try first.
Generally, you can list the available cameras with ls /dev/video* or v4l2-ctl --list-devices.  Here sample output:
NZXT-U:rt-trx> v4l2-ctl --list-devices
Microsoft® LifeCam Cinema(TM): (usb-0000:00:14.0-1):
    /dev/video1

Microsoft® LifeCam Cinema(TM): (usb-0000:00:1a.0-1.3):
    /dev/video0

/dev/video0 corresponds to device id 0, etc.
PS: v4l2-ctl is quite useful for solving camera issues and can do much more than --list-devices.  I installed it via packagev4l-utils on a 16.04 machine.

A: Late, but to get mine working i put in terminal:
-ltrh /dev/video*
To get a list of the video devices that are plugged into my computer. Then for each one I did:
sudo chmod 777 /dev/videox
Where x was one of the video files that were listed, giving everything access to them.  Probaly not the most secure solution, but it got my code working.


text:
Q: Bottomsheet Layout height issues I have have a ConstraintLayout with com.google.android.material.bottomsheet.BottomSheetBehavior inside a CoordinatorLayout
The problem is, when I click on the edittext inside the bottomsheet and the keyboard appears, the bottomsheet changes his height. It happens on several cases, for example when I close keyboard, when I click a pin on the map.
Seems more like an android bug, is there a fix for that?

A: I solved the problem by updating the com.google.android.material:material from 1.0.0 to 1.1.0-alpha07  and adding to the bottomsheet behavior the following code:
bottomSheetBehavior.saveFlags = BottomSheetBehavior.SAVE_ALL
Hope it will save time for somebodyelse.


text:
Q: Backbone routes, the application starts inside /profile? So I don't use any backbone logic until the user logs into the app. So for using node.js the application starts on localhost:3000 and the server handles the routes in this portion. So for example after visiting localhost:3000 there are two options, signup, or login which express handles the engineering of this, and a simple routes.js file handles the logic for these routes.  /signup, /login
That part is all server side, no need for backbone.js at this point in my opinion.
Then finally the user successfully logs into the app, which starts in /profile that is where I include backbone and my javascripts, here is where I rely more on client side routing and logic because the user is approved to play, and is granted access.
Now being kind of noobish here, but my question is since my app starts inside /profile why does the router get jacked up? For example I have a chat route and to invoke this route the url doesn't respect a trailing slash localhost:3000/profile#chat works but not this localhost:3000/profile/#chat
I read this Backbone.js route optional parameter I tried  reversing the syntax but no luck.
Here are my routes
module.exports = Router = Marionette.AppRouter.extend({
    appRoutes: {
        ''  : 'home',
        '(/:)chat' : 'chat' // tried playing around here
    }
});

So since starting on the /profile route created by the server how do I get a trailing slash to work?

A: Backbone is a frontend JS framework completely separate from your node/express backend. They don't share any logic as far as routing is concerned.
Use express to serve the /profile route:
app.get('/profile', function(req, res){
  res.render('profile', {somedata:'somevalue'}); // etc..
});

Then on the fronend, your Backbone.Router handles any routes from there on:
var myRouter = Backbone.Router.extend({
  routes: {
    '/' : 'profile', // Actually '/profile/
    '/chat' : 'chat' // Actually '/profile/chat
  }
});

Lastly, remember to call Backbone.history.start() after your router and all routes have been defined to start monitoring for hash changes.