text:
Q: Red Screen Error type 'String' is not a subtype of type 'int' of 'index' Flutter When I navigate my chat page, I see this error in red screen on emulator.
No idea why it does not work. Does anyone know how to solve it?
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import '../chat/chat.dart';

class ChatHome extends StatefulWidget {
  @override
  _ChatHomeState createState() => _ChatHomeState();
}

class _ChatHomeState extends State<ChatHome> {
  var _db = FirebaseFirestore.instance;
  TextEditingController userController;
  final _scaffKey = GlobalKey<ScaffoldState>();
  @override
  void initState() {
    super.initState();
    userController = new TextEditingController();
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffKey,
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          showDialog(
            // barrierDismissible: false,
            context: context,
            builder: (context) => _buildPopUpMessage(context),
          );
        },
        splashColor: Theme.of(context).colorScheme.onSecondary,
        child: Icon(
          Icons.add,
        ),
      ),
      body: FutureBuilder(
        future: getPosts(),
        builder: (_, snapshot) {
          if (snapshot.hasData) {
            String myId = snapshot.data['id'];
            return StreamBuilder(
              stream: getChats(myId),
              builder: (context, snapshot) {
                if (snapshot.hasData) {
                  QuerySnapshot qSnap = snapshot.data;
                  List<DocumentSnapshot> docs = qSnap.docs;
                  if (docs.length == 0)
                    return Center(
                      child: Text('No Chats yet!'),
                    );
                  return ListView.builder(
                    itemCount: docs.length,
                    itemBuilder: (context, index) {
                      List<dynamic> members = docs[index].data()['members'];
                      String userId;
                      userId = members.elementAt(0) == myId
                          ? members.elementAt(1)
                          : members.elementAt(0);
                      return FutureBuilder(
                        future: getUserByUsername(userId),
                        builder: (context, _snapshot) {
                          if (_snapshot.hasData) {
                            DocumentSnapshot docSnapUser = _snapshot.data;
                            Map<String, dynamic> _user = docSnapUser.data();
                            return Card(
                              margin: EdgeInsets.all(8.0),
                              elevation: 8.0,
                              shape: RoundedRectangleBorder(
                                borderRadius: BorderRadius.circular(5.0),
                              ),
                              child: InkWell(
                                splashColor:
                                    Theme.of(context).colorScheme.primary,
                                onTap: () => Navigator.push(
                                    context,
                                    MaterialPageRoute(
                                        builder: (context) => Chat(
                                              peerId: _user["id"],
                                              peerAvatar: _user['photoUrl'],
                                            ))),
                                child: Container(
                                  margin: EdgeInsets.all(10.0),
                                  height:
                                      MediaQuery.of(context).size.height * 0.08,
                                  child: Center(
                                    child: Row(
                                      children: [
                                        Hero(
                                          tag: _user['photoUrl'],
                                          child: Container(
                                            width: MediaQuery.of(context)
                                                    .size
                                                    .width *
                                                0.15,
                                            height: MediaQuery.of(context)
                                                    .size
                                                    .width *
                                                0.15,
                                            decoration: new BoxDecoration(
                                              shape: BoxShape.circle,
                                              image: new DecorationImage(
                                                fit: BoxFit.cover,
                                                image: new NetworkImage(
                                                    _user['photoUrl']),
                                              ),
                                            ),
                                          ),
                                        ),
                                        SizedBox(
                                          width: MediaQuery.of(context)
                                                  .size
                                                  .width *
                                              0.02,
                                        ),
                                        SizedBox(
                                          width: MediaQuery.of(context)
                                                  .size
                                                  .width *
                                              0.43,
                                          child: Text(
                                            _user['nickname'],
                                            style: TextStyle(
                                              fontSize: 16,
                                              fontWeight: FontWeight.w600,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                ),
                              ),
                            );
                          }
                          return Card(
                            margin: EdgeInsets.all(8.0),
                            elevation: 8.0,
                            shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(5.0),
                            ),
                            child: Container(
                              margin: EdgeInsets.all(10.0),
                              height: MediaQuery.of(context).size.height * 0.08,
                              child: Center(
                                child: CircularProgressIndicator(
                                  valueColor: new AlwaysStoppedAnimation(
                                    Theme.of(context).colorScheme.primary,
                                  ),
                                ),
                              ),
                            ),
                          );
                        },
                      );
                    },
                  );
                }
                return Center(
                  child: CircularProgressIndicator(
                    valueColor: new AlwaysStoppedAnimation(
                      Theme.of(context).colorScheme.primary,
                    ),
                  ),
                );
              },
            );
          }
          return Center(
            child: CircularProgressIndicator(
              valueColor: new AlwaysStoppedAnimation(
                Theme.of(context).colorScheme.primary,
              ),
            ),
          );
        },
      ),
    );
  }

  Widget _timeDivider(Timestamp time) {
    DateTime t = time.toDate();
    String minute =
        t.minute > 9 ? t.minute.toString() : '0' + t.minute.toString();
    String ampm = t.hour >= 12 ? "PM" : "AM";
    int hour = t.hour >= 12 ? t.hour % 12 : t.hour;
    DateTime press = DateTime.now();
    if (press.year == t.year && press.month == t.month && press.day == t.day)
      return Text(hour.toString() + ':' + minute + ' ' + ampm);
    return Text(t.day.toString() +
        '/' +
        (t.month + 1).toString() +
        '/' +
        t.year.toString());
  }

  Widget _buildPopUpMessage(context) {
    return Align(
      alignment: Alignment.topCenter,
      child: Container(
        padding: EdgeInsets.all(8.0),
        height: MediaQuery.of(context).size.width * .5,
        width: MediaQuery.of(context).size.width * .6,
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(40),
        ),
        margin: EdgeInsets.only(bottom: 50, left: 12, right: 12, top: 50),
        child: SingleChildScrollView(
          child: Column(
            children: <Widget>[
              SizedBox(
                height: MediaQuery.of(context).size.width * .1,
                child: Center(
                  child: new RichText(
                    text: new TextSpan(
                      style: new TextStyle(
                        fontSize: 14.0,
                        color: Colors.black,
                      ),
                      children: <TextSpan>[
                        new TextSpan(
                          text: 'username',
                          style: new TextStyle(
                              color: Theme.of(context).colorScheme.primary,
                              fontWeight: FontWeight.bold),
                        ),
                        new TextSpan(
                          text: '@gmail.com',
                        ),
                      ],
                    ),
                  ),
                ),
              ),
              SizedBox(
                height: MediaQuery.of(context).size.width * .2,
                child: Center(
                  child: Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Material(
                      child: TextField(
                        autofocus: true,
                        controller: userController,
                        decoration: new InputDecoration(
                          border: new OutlineInputBorder(
                            borderSide: BorderSide(
                              color: Theme.of(context).colorScheme.primary,
                            ),
                            borderRadius: const BorderRadius.all(
                              const Radius.circular(10.0),
                            ),
                          ),
                          focusedBorder: new OutlineInputBorder(
                            borderSide: BorderSide(
                              color: Theme.of(context).colorScheme.primary,
                            ),
                            borderRadius: const BorderRadius.all(
                              const Radius.circular(10.0),
                            ),
                          ),
                          enabledBorder: new OutlineInputBorder(
                            borderSide: BorderSide(
                              color: Theme.of(context).colorScheme.primary,
                            ),
                            borderRadius: const BorderRadius.all(
                              const Radius.circular(10.0),
                            ),
                          ),
                          errorBorder: new OutlineInputBorder(
                            borderSide: BorderSide(
                              color: Theme.of(context).colorScheme.error,
                            ),
                            borderRadius: const BorderRadius.all(
                              const Radius.circular(10.0),
                            ),
                          ),
                          filled: true,
                          hintText: "Type in only Username",
                          hintStyle: TextStyle(fontSize: 16.0),
                        ),
                      ),
                    ),
                  ),
                ),
              ),
              SizedBox(
                height: MediaQuery.of(context).size.width * .1,
                child: Center(
                  child: Align(
                    alignment: Alignment.center,
                    child: RaisedButton(
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(18.0),
                      ),
                      color: Theme.of(context).colorScheme.secondary,
                      child: Text(
                        'Let\'s chat with your friend.',
                        style: TextStyle(
                            color: Theme.of(context).colorScheme.onSecondary),
                      ),
                      onPressed: () async {
                        if (userController.text.isNotEmpty) {
                          String username = userController.text.toString();
                          userController.clear();
                          QuerySnapshot doc =
                              getUserByEmail(username + '@gmail.com');
                          if (doc.docs.length != 0) {
                            DocumentSnapshot user = doc.docs[0];
                            Map<String, dynamic> userData = user.data();
                            Navigator.pop(context);
                            Navigator.push(
                                context,
                                MaterialPageRoute(
                                    builder: (context) => Chat(
                                          peerId: userData["id"],
                                          peerAvatar: userData['photoUrl'],
                                        )));
                            print(user.data()['nickname'].toString());
                          } else {
                            showSnackPlz(context, username);
                            Navigator.pop(context);
                          }
                        } else {
                          showSnackPlzWithMessage(context, 'Empty Username');
                          Navigator.pop(context);
                        }
                      },
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  showSnackPlz(BuildContext context, String username) {
    final SnackBar snackMe = SnackBar(
      content: new RichText(
        text: new TextSpan(
          style: new TextStyle(
            fontSize: 14.0,
          ),
          children: <TextSpan>[
            new TextSpan(
              text: 'User with email ',
            ),
            new TextSpan(
              text: username,
              style: new TextStyle(fontWeight: FontWeight.bold),
            ),
            new TextSpan(
              text: '@gmail.com not in the database!',
            ),
          ],
        ),
      ),
    );
    _scaffKey.currentState.showSnackBar(snackMe);
  }

  showSnackPlzWithMessage(BuildContext context, String message) {
    final SnackBar snackMe = SnackBar(
      content: new Text(message),
    );
    _scaffKey.currentState.showSnackBar(snackMe);
  }

  getChats(String uid) {
    return FirebaseFirestore.instance
        .collection('messages')
        .where('members', arrayContains: uid)
        .snapshots();
  }

  getUserByUsername(String username) async {
    return await _db.collection('users').doc(username).get();
  }

  getUserByEmail(String email) async {
    return await _db.collection('users').where('email', isEqualTo: email).get();
  }

  Future getPosts() async {
    var firestore = FirebaseFirestore.instance;
    QuerySnapshot qn = await firestore.collection('users').get();
    return qn.docs;
  }
}

Can't find which code-row causes this.
Tried many changes but nothing helped.

Screenshot of the error
I've been facing this problem for whole day. Being rookie in flutterworld sometimes take bunch of time.

A: I can only assume what the problem could be please send the logs... So
List<dynamic> members = docs[index].data()['members'];
                  String userId;
                  userId = members.elementAt(0) == myId
                      ? members.elementAt(1)
                      : members.elementAt(0);

You are using this to get the userId (String) from a dynamic list.
check whether you dynamic list only contains String values before handling a value as a string. Please do this for all other occurrences of dynamic...
This error means that you cast an int to a string. That is illegal. Just check all your String occurrences.


text:
Q: Componente complejo como una modal. Angular 2 ¿Cómo usar un componente de formulario complejo (con servicios, inyecciones, etc) como un modal sin tener que poner su html en el componente padre?
Mi estructura es la siguiente:
src
----- app.component.ts
----- app.component.html
----- modals/
------------- modal_one.ts
------------- modal_one.html
------------- modal_other.ts
------------- modal_other.html

¿Cómo utilizo  < modal_one > sin ponerlo en el html de app.component?

A: Buenas,
Puedes usar componentFactoryResolver para ello, y crear e inyectar componentes dinamicamente desde Typescript.
Ademas, te aconsejaria usar un framework pensado para angular 2, ya que la version normal de bootstrap esta basada en el arbol DOM y en jQuery, y para nada es el mismo sistema que usar angular 2 ya que el DOM va cambiando con cada interaccion del routing.
Enlace para el componentFactoryResolver:

https://medium.com/@tudorgergely/injecting-components-dynamically-in-angular-2-3d36594d49a0#.xauq6bc83

Enlace para ng-bootstrap for Angular 2:

https://ng-bootstrap.github.io/#/components/modal

Espero que te sirva ;)

A: Yo dividí mi componente en dos partes; una contiene el modal en sí (el padre) pero carga la forma en otro (componente hijo), de esta manera no cargas todo el contenido en un solo. No sé si te sirva pero si quieres utilizar modales en angular sin tanto problema, ésta debería ser tu mejor solución.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can you specify output length of an encrypted string using AES? I am running into an issue with encryption and I am looking for some guidance.
I am using AES encryption (Rijndael) to encrypt and decrypt user passwords, security question answers, and PIN numbers. These encrypted values are then put into a database where the fields are defined as bin(16), bin(32), and bin(64). Originally I was using custom padding to ensure then length of the data, but for security reasons I am moving to PKCS7 padding. Unfortunately, this change has made the length of the encrypted string unpredictable, at least for the password and the security question answers. For example, valid passwords could be either 16 or 32 bytes long when encrypted, and security answers could be 16, 32, or 64 bytes when encrypted. I know what the block size is and how it works, but even using a block size of 32 bytes (the largest blocks ize available) I am still unable to control the length of the security answer (it could be 32 OR 64 bytes).
Is there a way to force my encrypted strings to be a particular length while still using AES and PCKS7 padding, without adding restrictions on the input?

A: You're essentially asking for the Pigeonhole Principle to go away (which it won't).
I know you say you understand the block size, but it appears that you do not based on the sentence immediately following that claim.  The block size defines the length of the bit-string that is passed in to the algorithm and out of the algorithm.  That is it.  If you pass in 2.5 lots of 256-bits (which will be padded up to 3 blocks), then you're going to get 3 blocks of output.  Also, AES with a 256-bit block size isn't AES anymore, its Rijndael.
You can predict the output size for a given input under AES with PKCS7 padding, but you can't cap it to, say, 32 bytes.
If you weren't encrypting these fields, you'd still need to set a maximum field size in the database - the fact that they are encrypted doesn't change this.


text:
Q: Formula for the number of integer solutions of an equation (using generating functions) Let $a_n$ be the number of integer solutions of $$i+3j+3k=n$$ where $i \geq 0, j \geq 2, k \geq 3$.
I want to use the generating function of $(a_n)_{n \in \mathbb N}$ to get a formula for $a_n$.
We just introduced generating functions, so I'm fairly new to this stuff and hope you can help me solve this problem.
I began by interpreting the problem as a power series. Without the restrictions for $i, j, k$ I get
$$(1+x+x^2+x^3+\dots)(1+x^3+x^6+x^9+\dots)^2.$$
Accounting for $i \geq 0, j \geq 2, k \geq 3$ should get me something like
$$(1+x+x^2+x^3+\dots)(x^6+x^9+x^{12}+\dots)(x^9++x^{12}+x^{15}+\dots).$$
Is that correct?
Now I tried to simplify this like this:
$$1+x+x^2+x^3+\dots = \frac{1}{1-x}$$
$$x^6+x^9+x^{12}+\dots
=(1+x^3+x^6+x^9+x^{12}+\dots)-(1+x^3)
=\frac{1}{1-x^3}-(1+x^3)
=\frac{x^6}{1-x^3}$$
and likewise
$$x^9++x^{12}+x^{15}+\dots = \frac{x^9}{1-x^3}.$$
So I have
$$(1+x+x^2+x^3+\dots)(x^6+x^9+x^{12}+\dots)(x^9++x^{12}+x^{15}+\dots)
=\frac{x^{15}}{(1-x)(1-x^3)^2}.$$
I hope I didn't make a mistake already. In any case, here I'm stuck. I have to find a formula for the $n$-th coefficient in this power series, but I don't know how to do it.

[edit]
I'm still quite confused, but I'll try to go over it again one by one. Here is again the complete (and hopefully correct) partial fraction decomposition and my try to expand it:
$$\frac{1}{(1 - x)^3 (x^2 + x + 1)^2} \\
=\frac{1}{27} \frac{7x + 8}{x^2 + x + 1}
+ \frac{1}{9} \frac{2x+1}{(x^2 + x + 1)^2}
+ \frac{1}{27} \frac{7}{1-x}
- \frac{1}{9} \frac{2}{(1-x)^2}
+ \frac{1}{9} \frac{1}{(1-x)^3} \\
=\frac{1}{27} \frac{(7x + 8)(1-x)}{(1-x^3)}
+ \frac{1}{9} \frac{(2x+1)(1-x)^2}{(1-x^3)^2}
+ \frac{1}{27} \frac{7}{1-x}
- \frac{1}{9} \frac{2}{(1-x)^2}
+ \frac{1}{9} \frac{-1}{(1-x)^3} \\
=\frac{ (7x + 8)(1-x)}{27} \sum x^{3n}
+ \frac{ (2x+1)(1-x)^2}{9} \sum (n+1) x^{3n}
+ \frac{7}{27} \sum x^n
- \frac{2}{9} \sum (n+1) x^n
+ \frac{1}{9} \sum x^{3n}.$$
Still to do: Multiply by $x^{15}$ and find the coefficient of $x^k$.

A: Since you seem to have run out of steam, I'll finish off what you've started.  First note that you have a sign error in the second to last term: it should be $+ \frac{2}{9} \sum (n+1) x^n$.  Thus the series expansion for the generating function is
\begin{align*}
\frac{-7x^2 - x + 8}{27} \sum_{n \geq 0} x^{3n}
&+ \frac{2x^3 - 3x^2 + 1}{9} \sum_{n \geq 0} (n+1) x^{3n}\\
&+ \frac{7}{27} \sum_{n \geq 0} x^n
+ \frac{2}{9} \sum_{n \geq 0} (n+1) x^n + \frac{1}{18} \sum_{n \geq 0} (n^2 + 3n + 2) x^n \, .
\end{align*}
The coefficient of $x^m$ in these series depends on whether $m \equiv 0, 1$ or $2$ mod ${3}$.  If $m \equiv 0 \pmod{3}$, then the coefficient is
\begin{align}
&\frac{8}{27} + \frac{1}{9}\left(2 \left(\frac{m-3}{3} + 1\right) + \frac{m}{3} + 1 \right) + \frac{7}{27} + \frac{2}{9}(m+1) + \frac{1}{18}(m^2 + 3m + 2)\\
&= \frac{1}{18}m^2 + \frac{1}{2}m + 1 \, .
\end{align}
(Note that the second sum contributes two terms since $3n+3 \equiv 0 \pmod{3}$ as well.)  The last $3$ terms in the first line of the above formula remain the same whether $m \equiv 0, 1$ or $2$ mod ${3}$.
[Edit: A bit more on how I got this.  Let's consider the coefficient of $x^m$ in the first sum $\frac{-7x^2 - x + 8}{27} \sum_{n \geq 0} x^{3n}$.  Distributing, this sum is equal to
$$
\frac{-7}{27}\sum_{n \geq 0} x^{3n+2} + \frac{-1}{27} \sum_{n \geq 0} x^{3n+1} + \frac{8}{27} \sum_{n \geq 0} x^{3n} \, .
$$
If $m \equiv 0 \pmod{3}$, then the first to sums do not contribute to the coefficient of $x^m$.  Why?  Because all their powers of $x$ are congruent to $2$ and $1$, respectively.  Only the last sum contributes $\frac{8}{27}$ to the coefficient of $x^m$ when $n = m/3$.  Similarly, only the second sum contributes when $m \equiv 1 \pmod{3}$, and the first when $m \equiv 2 \pmod{3}$.  The same considerations work for finding the coefficient of $x^m$ in $\frac{2x^3 - 3x^2 + 1}{9} \sum_{n \geq 0} (n+1) x^{3n}$.]
Similar calculations for $m \equiv 1, 2 \pmod{3}$ imply that the coefficient of $x^m$ is
$$
\begin{cases}
\frac{1}{18}m^2 + \frac{1}{2}m + 1 & \text{if } m \equiv 0 \pmod{3}\\
\frac{1}{18}m^2 + \frac{7}{18}m + \frac{5}{9} & \text{if } m \equiv 1 \pmod{3}\\
\frac{1}{18}m^2 + \frac{5}{18}m + \frac{2}{9} & \text{if } m \equiv 2 \pmod{3}
\end{cases} \, .
$$
As vonbrand points out in his answer, we could've instead factored the quadratic $1 + x + x^2$ into linear factors with third roots of unity, which would have lead to the same periodic behavior with period $3$.
Finally, as you pointed out, we still haven't taken care of that $x^{15}$.  It's very simple, though: to obtain the coefficient of $x^m$ in $\frac{x^{15}}{(1 - x)^3 (x^2 + x + 1)^2}$, we simply take the coefficient of $x^{m-15}$ in $\frac{1}{(1 - x)^3 (x^2 + x + 1)^2}$.  For instance, to compute the coefficient of $x^{22}$, we substitute $m = 22 - 15 = 7$ into the formula for $m \equiv 1 \pmod{3}$, which yields $6$.
It turns out that these formulas can be simplified dramatically.  Using the formulas above (or Wolfram Alpha), we find that the Maclaurin series for the generating function is
$$
x^{15}+x^{16}+x^{17}+3 x^{18}+3 x^{19}+3 x^{20}+6 x^{21}+6 x^{22}+6 x^{23}+10 x^{24}+10 x^{25}+10 x^{26}+15 x^{27}+15 x^{28}+15 x^{29}+ \cdots \, .
$$
These coefficients are the triangular numbers $T_n = \binom{n+2}{2} = \frac{(n+2)(n+1)}{2}$ repeated $3$ times each.  This can also be seen from the formulas above: letting
\begin{align*}
f(m) &= \frac{1}{18}m^2 + \frac{1}{2}m + 1\\
g(m) &= \frac{1}{18}m^2 + \frac{7}{18}m + \frac{5}{9}\\
h(m) &= \frac{1}{18}m^2 + \frac{5}{18}m + \frac{2}{9}
\end{align*}
then
$$
f(3n) = g(3n+1) = h(3n+2) = \frac{1}{2} n^2 + \frac{3}{2}n + 1 = \binom{n+2}{2} \, .
$$
Thus a simpler formula for the coefficient of $x^n$ is
$$
\frac{1}{2} \left(\left\lfloor \frac{n-15}{3} \right\rfloor + 2\right) \left(\left\lfloor \frac{n-15}{3} \right\rfloor + 1\right) \, .
$$

A: OK, use generating functions. Note that $1 - z^3 = (1 - \omega z) (1 - \omega^2 z) (1 - z)$, where $\omega = -\frac{1}{2} + \mathrm{i} \frac{\sqrt{3}}{2}$ and $\omega^3 = 1$:
\begin{align}
[z^n] z^{15} (1 + z &+ z^2 + \ldots) (1 + z^3 + z^6 + \ldots)^2 \\
  &= [z^{n - 15}] \frac{1}{(1 - z) (1 - z^3)^2} \\
  &= [z^{n - 15}] \frac{1}{(1 - z)^3 (1 - \omega z)^2 (1 - \omega^2 z)^2}
\end{align}
This can be split into partial fractions, but the coefficients are very ugly. They can be simplified by $\omega^2 + \omega + 1 = 0$ and $\omega^3 = 1$. Use of a computer algebra system is mandatory.
Once you've got the partial fractions, you can use:
$$
\binom{-m}{k} = (-1)^k \binom{k + m - 1}{m - 1}
$$
The imaginary components cancel out, and you get real coefficients. One way to express them is to use Euler's formula:
$$
\omega^n
  = \exp( \mathrm{i} \frac{2 \pi n}{3} )
  = \cos \frac{2 \pi n}{3} + \mathrm{i} \sin \frac{2 \pi n}{3}
$$


text:
Q: form action not navigating in include page I have a page calledemp.php in which i have the following code
 <form action="emp-action" method="post" enctype="multipart/form-data">
          include("conn.php");

 $sud=$_SESSION['login_user'];

            $sqlc=mysql_query("SELECT * FROM emp where un='".$sud."' ");

            $countc=mysql_num_rows($sqlc);
            if($countc<99)
            {

         include("inc-profile.php");
            }
            else
            {
            echo "SORRY !!!!you have posted more than 100 jobs";

            }

</form>

now this is working properly and navigates to inc-profile page according to condition
in inc-profile.php page I have
<form action="include-action" method="post" enctype="multipart/form-data">

//some codes

 </form>

But form action is not nvigating toinclude-action.php page but navigating emp-action.phppage ..What might be the error
PLZ NOT I HAVE REMOVED .PHP WITH HELP OF .HTACCES

A: You have one form inside another form.
This is forbidden by the HTML specification and causes undesirable results.
Don't nest forms.

A: as per your code you have 2 forms like this
<form action="emp-action" method="post" enctype="multipart/form-data">
      <form action="include-action" method="post" enctype="multipart/form-data">
      </form>
</form>

so when you submit the the first Form action will be initiated. please do like below
<form action="emp-action" method="post" enctype="multipart/form-data">

</form>
  include("conn.php");

 $sud=$_SESSION['login_user'];

            $sqlc=mysql_query("SELECT * FROM emp where un='".$sud."' ");

            $countc=mysql_num_rows($sqlc);
            if($countc<99)
            {

         include("inc-profile.php");
            }
            else
            {
            echo "SORRY !!!!you have posted more than 100 jobs";

            }

A: There are more than one problems in your code.
As D.Kasipovic said you have to use session_start().
But you have also to differentiate html from php for
example with php tag <?php ?>
like this
 <form action="emp-action" method="post" enctype="multipart/form-data">
<?php
       include("conn.php");

        $sud=$_SESSION['login_user'];

        $sqlc=mysql_query("SELECT * FROM emp where un='".$sud."' ");

        $countc=mysql_num_rows($sqlc);
        if($countc<99)
        {

     include("inc-profile.php");
        }
        else
        {
        echo "SORRY !!!!you have posted more than 100 jobs";

        } ?>
</form>


text:
Q: Yocto (Intel IoT Image), installing packages Good day.
In debian I can to run:
sudo apt-get install python-opencv python-serial python-pyparsing python-numpy python-wxgtk2.8

How to do it on yocto (Intel IoT Image)?
1) build from source it all with building from source all dependencies?
2) is a good solution - install apt-get on yocto?
3) Maybe, I can to use opkg for installing it, (but in "opkg list" I can't see, for example, python-wxgtk2.8 ), where can I find good repository, default repository is very poor?

A: Yes you can install packages using opkg. You can use the repos. Refer this excellent blog from Alex on package configuration.


text:
Q: Is there a way to animate a word cloud in R? Currently, I am using the library("wordcloud") to make a word cloud of frequent terms some text data that I have. The text data also comes with an associated year, and I want to be able to generate new word clouds based on the year, and I want it to be automatically animated using a library like gganimate. Is there any way to do this? I want to visualize the most frequent keywords over time, but I am struggling. Any tips?

A: Yes, with the help of the ggwordcloud package. I'll use the babynames dataset as an interesting example to see how the 5 most common baby names have changed over 100 years. First, load the required packages and load the data.
library(babynames)   # Data
library(dplyr)       # Data management
library(ggplot2)     # Graph framework
library(ggwordcloud) # Wordcloud using ggplot
library(gganimate)   # Animation

data(babynames)

The next command finds the top 5 names for each sex in 1915 and 2015, grouped by year.
babies <- babynames %>%
  filter(year %in% c(1915, 2015)) %>%
  group_by(name, sex, year) %>%
  summarise(n=sum(n)) %>%
  arrange(desc(n)) %>%
  group_by(year, sex) %>%
  top_n(n=5) %>%

# A tibble: 20 x 4
# Groups:   sex, year [4]
   name     sex    year     n
   <chr>    <chr> <dbl> <int>
 1 Mary     F      1915 58187
 2 John     M      1915 47577
 3 William  M      1915 38564
 4 James    M      1915 33776
 5 Helen    F      1915 30866
 6 Robert   M      1915 28738
 7 Dorothy  F      1915 25154
 8 Margaret F      1915 23054
 9 Joseph   M      1915 23052
10 Ruth     F      1915 21878
11 Emma     F      2015 20435
12 Olivia   F      2015 19669
13 Noah     M      2015 19613
14 Liam     M      2015 18355
15 Sophia   F      2015 17402
16 Mason    M      2015 16610
17 Ava      F      2015 16361
18 Jacob    M      2015 15938
19 William  M      2015 15889
20 Isabella F      2015 15594

  ungroup() %>%
  select(name, sex)

I halted it before the end just to show you which names were returned before omitting the years and frequency because I want to merge this data with the original to get the frequency for every 5 years between 1915 and 2015, not every year because it takes too long to plot.
Here's the join.
babyyears <- babynames %>%
  inner_join(babies, by=c("name","sex")) %>%
  filter(year>=1915 & year %% 5 == 0) %>%  # Keep all years if you like
  mutate(year=as.integer(year))  # For animation. Not sure why this is required.

So that's just setting up the data for the plot. If we just wanted a static wordcloud, we'd aggregate on the year. But we keep the years for the animation.
For plotting, we use ggplot with the geom_text_wordcloud function.
gg <- babyyears %>%
  ggplot(aes(label = name, size=n)) +
  geom_text_wordcloud() +
  theme_classic()

Then transition through the years.
gg2 <- gg + transition_time(year) +
  labs(title = 'Year: {frame_time}')

I like to add a pause at the end, otherwise the animation rolls around to the start immediately after finishing.
animate(gg2, end_pause=30)
anim_save("gg_anim_wc.gif")

It's hard to keep track of all the names (especially the boys) with them all being placed in random locations. Maybe slowing it down will help. But the name that stands out the most from this graphic is "Mary", which was the most common name in 1915 but then slowly started to lose popularity towards the latter half of the century.


text:
Q: bash: source: filename argument required source: usage: source filename [arguments] i run ubuntu os.
i read  similar question but my problem is different
whenever i launch the terminal it hangs for few seconds showing this message:
bash: source: filename argument required
source: usage: source filename [arguments]

how to get rid of this problem?
my .bashrc file content is:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)
    color_prompt=yes
    else
    color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
source $venvwrap

export NVM_DIR="/home/tartoor/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

A: You get the error message because .bashrc, towards the end, contains the line
source $venvwrap

As far as I can see, the variable $venvwrap is never assigned a value.
I'm not sure what the purpose of this line is, but if you recently inserted it, then you may know better than I what it's supposed to do.
My guess is that you are using virtualenvwrapper, in which case the variable should have the value of the path to the virtualenvwrapper.sh script.
The suggested way to set this up involves adding the following to .bashrc:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

This obviously has to be adjusted for your local setup.


text:
Q: Giving access to execute SQL queries on a static database I am working on a project where i want to give people the possibility to execute SQL queries on an PostgreSQL database. I then only need to prevent people from hacking/attacking my database.
I thought that maybe a way to do that, is by giving only view access to de database connection. And using EXPLAIN ANALYSE to calculating the cost of the SQL query.
Is EXPLAIN ANALYSE trustworthy enough to make sure there are no cheap ways to get the website down?
Do you have suggestions?

A: EXPLAIN ANALYSE will execute the query, including any side-effects it may have. PostgreSQL also allows running arbitrary Perl and Python code if configured to do so, so be careful. You're likely better off running PostgreSQL instances in per-request VMs or in similar highly isolated environments.


text: Q: Magento Full Page Cache and Theme I am using magento full page cache, EE 1.11.2.  For some reason my secondary mobile theme is displaying on some of my catalog pages. e.g. two out of 6.  This only happens with FPC on.  It is reoccurring and happens on the same pages.  The cache can be valid or invalid.  I have not found any information on a topic similar to this.  Any ideas or suggestions on how to solve this?


text:
Q: column packed save space in PostgreSQL Based on this tutorial we can see that column alignment of the same integer size will save space. That's very good. But I'm still confused. Is it based on data type alignment or data type size?  I believe in that based on data type size, rather than data type.

A: The length of a data type (column typlen in pg_type) determines how much space a value will use, but it has nothing to do with padding or wasted space between columns owing to alignment (column typalign).
You only waste space if the next column has a bigger alignment than the current one, and padding bytes are needed to fill up the space in between.
For example:
CREATE TABLE test (
   x boolean NOT NULL,
   y boolean NOT NULL,
   z integer NOT NULL
);

Each boolean has an alignment and length of 1 byte, and integer has an alignment of 4 bytes. So the bytes will look like this:
┌──────────────┐
│       x      │
├──────────────┤
│       y      │
├──────────────┤
│ padding byte │
├──────────────┤
│ padding byte │
├──────────────┤
│       z      │
├──────────────┤
│       z      │
├──────────────┤
│       z      │
├──────────────┤
│       z      │
└──────────────┘

The first column starts at an offset that is maximally aligned (that is, the address is divisible by eight). Column z must start at an address that is divisible by 4, so two padding nytes are necessary.


text:
Q: Is Mongodb ObjectID unique between documents? Lets consider an example of blog site where I want to save questions and replies in two different documents. I know this can also be done with Embedding documents but lets assume we want two different documents.
And I have Like option on both question and reply. If user likes a question that particular question's objectID is stored inside a Like document and similarly for likes in reply.
Now I wonder whether the objectID's that I store in Like documents could create a conflict. Like if the question's objectid is same as any reply's objectid. IS it possible to have such conflicts??
In Mongodb ObjectID documentation the following is provided:

ObjectId is a 12-byte BSON type, constructed using:
a 4-byte value representing the seconds since the Unix epoch,
a 3-bytemachine identifier,
a 2-byte process id, and
a 3-byte counter, starting with a random value.

A: It is unique for all practical purposes. The non- uniqueness mentioned is a rather theoretical one.
The ObjectId is constructed out of

*

*a time stamp (seconds since epoch)

*a machine identifier

*the process id

*and a 3 byte counter starting with a random value each second
So, at median, unless you write in excess of 3080 documents per second per client, you should be safe.
It is to note that _id has an unique constraint: Even if you'd try to write the same ObjectId twice, there'd be an exception.
Side note: even hash algorithms like MD5 or (to a lesser extent) SHA256 have a slight chance of collision. But with a unique constraint, you are safe.
Edit: Since an exception is thrown in the very, Very, VERY rare case that two identical ObjectIds are generated and tried to be written concurrently, you simply handle them by generating a new ObjectId and try to save the document again.

A: From the Documentation, it is most likely unique, not unique.


text:
Q: What does the * do in this scenario?: int year;
int month;
int day;

ADate * date = new ADate(year, month, day);

I know it's usually used for pointers but I don't know what it's doing here. Without it that line obviously creates a new ADate with those int variables passed in but I'm not sure what the * does that changes this?

A: With the *, date is declared as a pointer type, which stores the address of a ADate object (points to a ADate object). Otherwise, date would be declared as a ADate object type.
The operator new returns a pointer. Thus without the *, your program wouldn't be successfully compiled.
http://www.cplusplus.com/reference/new/operator%20new/


text:
Q: How to satisfy totally_ordered for a custom type without spaceship comparison operator (ranges::is_sorted, ranges::sort) Consider the following code:
#include <vector>
#include <algorithm>
#include <ranges>
#include <cassert>

// The type is defined in legacy code and we can not change it
struct A
{
   int a;
};

bool operator <(const A &a1, const A &a2)
{
   return a1.a < a2.a;
}

int main()
{
   assert(A {} < A{}); // OK
   std::vector<A> c;
   assert(std::ranges::is_sorted(c)); // compilation error
}

The code can be fixed by adding the "spaceship" comparison operator to A:
auto operator<=>(const A &) const = default;

However, defining it outside of a class works with the first assert, but not the second:
auto operator <=>(const A &a1, const A &a2) { return a1.a <=> a2.a; }

Is it possible to satisfy the requirements of ranges::less without modifying A?

A: You need to provide an == as well as <=>. std::ranges::less requires std::totally_ordered not just std::strict_weak_order, so == is also needed. Unless defaulted, <=> doesn't synthesize ==.
#include <vector>
#include <algorithm>
#include <ranges>
#include <cassert>

// The type is defined in legacy code and we can not change it
struct A
{
   int a;
};

auto operator <=>(const A &a1, const A &a2) { return a1.a <=> a2.a; }
auto operator ==(const A &a1, const A &a2) { return a1.a == a2.a; }

int main()
{
   assert(A {} < A{}); // Comparison exists
   std::vector<A> c;
   assert(std::ranges::is_sorted(c)); // Comparison exists
}


text:
Q: ( MVC 5 ) I loss styling when access my web application outside my PC (Only with IE) I appreciate if someone helped me with this:
I use MVC5 & EF6 & Bootstrap and every thing works great except when I try to access my application from outside my PC using IE.
I tried using Firefox & Chrome and it works as expected, but with IE (11):(
I tried with bundles and with old way , nothing work


text:
Q: Could the Imperius curse be used to control werewolves? We know that the Imperius curse works against non-human animals as well as humans, so it should work on transfigured humans. A werewolf could probably be considered a transfigured human so it should work on them.
If so, why not use the Imperius curse to keep them in check?
Is it just because using the Imperius curse on a human can earn you a life sentence in Azkaban? Isn't it still better than killing somebody? If both, the possible victim and the werewolf, for example, someone like Lupin) is willing to the idea, is the only reason stopping an arrangement like this from happening is a legal technicality?
In Prisoner of Azkaban, Lupin would never have been hired without Dumbledore, so Dumbledore was already willing to take risks. If Dumbledore would do it himself without bringing in the authorities no one would even know about it. We also know that it is possible for a powerful enough wizard to cast an Imperius curse on someone then just leave them alone to go about their daily life, in such a way that they will till be subservient to the caster. Why wouldn't Dumbledore do something like this with Lupin (just for the duration of his transformation, since Lupin would probably consent to it as well)?
We know that forgetting to drink the potion didn't turn out well for Lupin. If an arrangement like this had been made since the beginning, they would never have had to worry about not being able to drink the potion. Also it might be easier to keep the werewolves in the wild in check this way, which is still better than killing them (if imperious curse on a werewolf is illegal because it is technically being done on a human being, then killing a werewolf should also be illegal since it technically still a human being.
So why isn't this done with werewolves?

A:  Likely Explanation: No. Because Werewolves Are Immune to normal Magic
1. Potions that could help werewolves are a recent invention

In the second half of the twentieth century, several potions were devised to soften the effects of lycanthropy. The most successful was the Wolfsbane Potion ... a relatively recent discovery that allows werewolves to remain safe during the full moon.

Wolfsbane in the real world is a very toxic plant that was often used to kill wolves (hence the name); in HP it's a magical plant that's best known as an important ingredient of the Wolfbane Potion, which makes it a likely assumption that the ability to affect werewolves is one of its magical properties.
It also mentions that all these are very recent inventions. Werewolves have been around for centuries - and most of them have been adult Witches and Wizards when bitten.
If simple non-specialized potions could affect Werewolves the same way they do humans, it is hard to believe that the only option in front of generations of werewolves was to barricade themselves best as they could - instead of brewing a Sleeping Potion for themselves when they were human, and taking it just before Full Moon hit.
But they don't do it. Why? Maybe because normal potions don't affect werewolves in their transformed state?
2. Neither potions nor spells could help Remus as a child

Lyall did all he could to find a cure, but neither potions nor spells could help his son....
... While Remus was small, his containment during his transformation was not difficult; a locked room and plenty of silencing spells usually sufficed. However, as he grew, so did his wolfish self, and by the time he was ten years old, he was capable of pounding down doors and smashing windows. Ever more powerful spells were needed to contain him and both Hope and Lyall grew thin with worry and fear.

Now the first sentence could mean that nothing would cure Remus permanently, but it seems unlikely, that parents as protective of Remus, as the Lupins became, would only be willing to find an all-or-nothing solution. So the implication that potions and spells had no effect on Remus's 'problem' aka 'wolfing' out, seems a much more likely reading of the sentence.
Lyall, a competent wizard, could surely brew a decent Sleeping Potion himself, or know where to get some if he couldn't, or cast a Sleeping Spell - but apparently potions and spells don't help.
The second paragraph is also revealing: The only thing that could help was keeping Remus locked up, and the spells used were only those that helped in containment, and even those spells needed to be ever more powerful as Remus grew.
This seems to be implying not just a resistance to direct magic, but possibly also an ability to 'break through' magical bonds / shields. Since the bonds and barriers are themselves magical in nature, being able to break them via pure brute strength seems a bit odd - so the possibility of an 'ability' to overcome/'break' magic becomes implicit.
All this falls neatly into the pop cultural expectation of extreme resilience to anything but the most specialized weapons that Werewolves enjoy in large swathes of fiction, which makes this unconscious assumption, not very far-fetched. Even if it's fairly likely that this is something that JKR just didn't think about, there is enough evidence in the canon to put together this theory, and none to contradict it, as far as I am aware.


text:
Q: How come i keep getting a memory leak when i run this function in my C program? So basically im writing code for a linkedList, but I keep getting a memoryLeak as a result of this code here. Could anyone help me find why, and also explain to me what im doing wrong?
struct Node* deleteNode(int data, struct Node* head){

    struct Node* current = head;
    struct Node* previous = NULL;

    if(head == NULL){
        return NULL;
    }
    while(current->data != data){
            if(current->next == NULL){
                return NULL;
            }else{
                previous = current;
                current = current->next;
            }
    }
    if(current == head){
        struct Node* temp = head;
        head = head->next;
        free(temp);
    }else
    {
        previous->next = current->next;
    }
    current = NULL;
    return head;
}

A: You never call free() on the deleted list node when its not the first element of your linked list.

A: You are getting a memory leak because you are not calling free in the case where current != temp. All you are doing in the else portion is simply assigning previous->next = current->next without deleting the current node.
You have already found the node you wish to delete using your while loop, so add free(current) after previous->next = current->next.


text:
Q: Positive SemiDefinite Matrix. Theory vs Matlab For my problem, I am looking for optimal vector $q$ that minimizes mean squared error (MSE) that has a form $$MSE=q^{T}(R_{xx}-R_{yx}^{T}R_{yy}^{-1}R_{yx}^{})q^{}.\tag{1}$$
Since $MSE\geq0$, it turns out that $P=R_{xx}-R_{yx}^{T}R_{yy}^{-1}R_{yx}^{}$ is a positive semi-definite matrix. Note that $R_{xx}^{}, R_{yy}^{}$ are correlation matrices and $R_{yx}^{}$ is a cross-correlation matrix.
I know that solution to eq(1) comes from eigen value decomposition of $P$.
However when I try to implement in MATLAB, some of the eigen values of $P$ are coming out to be negative. Can someone please point out how should I go about this issue.

A: Aren't you simply seeing the effects of finite precision in floating-point numerics?
Simple MATLAB example. This should trivially be positive semidefinite
x = ones(10,1);
X = x*x';

but it is not in floating-point numerics
>> min(eig(X))
ans =
 -2.3078e-16

A: Since $P=R_{xx}-R_{yx}^{T}R_{yy}^{-1}R_{yx}^{}$ is the Schur complement of the block matrix
$$
R:=\left[
\begin{matrix}
R_{xx} & R_{yx}^T \\
R_{yx} & R_{yy}
\end{matrix}
\right]
$$
(w.r.t. the block $R_{yy}$) the Schur complement lemma states that $P$ is p.d. iff $R$ is p.d..
So you definitely have an issue within MATLAB.


text:
Q: Можно ли используя LVM извлечь физический том без потери данных? Можно ли используя LVM извлечь физический том без потери данных?

A: Сначала переносишь LV которые там лежат на другой pv
pvmove /dev/sda /dev/sdb

Потом вынимаешь его из группы
vgreduce vg0 /dev/sda

Дальше можешь его отформатировать или извлечь


text:
Q: Run a PHPUnit Selenium test case programatically ("within PHP") How can I run a test "within PHP" instead of using the 'phpunit' command? Example:
<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class MySeleniumTest extends PHPUnit_Extensions_SeleniumTestCase {

    protected function setUp() {
        $this->setBrowser("*firefox");
        $this->setBrowserUrl("http://example.com/");
    }

    public function testMyTestCase() {
        $this->open("/");
        $this->click("//a[@href='/contact/']");
    }

}

$test = new MySeleniumTest();
//I want to run the test and get information about the results so I can store them in the database, send an email etc.
?>

Or do I have to write the test to a file, invoke phpunit via system()/exec() and parse the output? :(

A: Just use the Driver that's included.
require_once 'PHPUnit/Extensions/SeleniumTestCase/Driver.php';
//You may need to load a few other libraries.  Try it.

Then you need to set it up like SeleniumTestCase does:
$driver = new PHPUnit_Extensions_SeleniumTestCase_Driver;
$driver->setName($browser['name']);
$driver->setBrowser($browser['browser']);
$driver->setHost($browser['host']);
$driver->setPort($browser['port']);
$driver->setTimeout($browser['timeout']);
$driver->setHttpTimeout($browser['httpTimeout']);

Then just:
$driver->open('/');
$driver->click("//a[@href='/contact/']");

A: Here's an example from the phpunit docs:
<?php
require_once 'PHPUnit/Framework.php';

require_once 'ArrayTest.php';
require_once 'SimpleTestListener.php';

// Create a test suite that contains the tests
// from the ArrayTest class.
$suite = new PHPUnit_Framework_TestSuite('ArrayTest');

// Create a test result and attach a SimpleTestListener
// object as an observer to it.
$result = new PHPUnit_Framework_TestResult;
$result->addListener(new SimpleTestListener);

// Run the tests.
$suite->run($result);
?>

The code for SimpleTestListener is on the same page.


text:
Q: How to display texts from JavaScript multiple times? I'm familiar with using ID's to help display your JavaScript string text onto your HTML webpage like so:

<button onClick = "display()">Press Me</button>

But what if I wanted to display "hello" multiple times by the press of the button? I don't want to keep adding id's the same way I did "text" to appear. Is there anyway I could simply print out the text once you press the button for however many times you'd like in vanilla JavaScript?
Also, I am aware of "repeat()" but that's not what I'm looking for.

A:
But what if I wanted to display "hello" multiple times by the press of
the button?

It's enough to change this line:
message.innerHTML = string;

to:
message.innerHTML += string;   // add at the end....

<button onClick = "display()">Press Me</button>


text:
Q: GA4 + GTM: Remove URL query params from all page data How do I remove URL params from getting pushed to GA4 through GTM? I have tried many solutions but none seem to be working.
Which key in "Fields to Set" do I need to use so GTM replaces the url query param from all dimensions like page_path, page_location, path_referrer?

A: This article has been my life saver when dealing with URL params in GA4, but please use my experience and avoid the mistake of applying the script directly to page_location.
page_location is what I call a technical dimension that GA4 uses to sort referring websites according to its internal rules and do any other GA4 things. Remove URL params from page_location using GTM, and you'll stop seeing all channels, reliant on UTMs—so paid search, display, paid social, email etc (provided you use UTMs, of course). Don't forget: in this case, you remove the URL params in GTM before they get in GA, so if GTM strips params out, GA doesn't see them.
To illustrate my mistake, this is how my GA4 configuration tag in GTM looked like initially:

Bad idea. Don't touch page_location.
The best approach is to just create your own dimension which you would use to store 'clean' URLs, say, page_URI. The reason: you stop relying on GA built-in dimensions that (potentially) are prone to change and you create something of your own that you will have control over and can add to any event as a dimension.
Below is my version of the script in GTM, deployed as a Custom Javascript Variable:
function() {
  var params = ['hash', 'email', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'fbclid', 'mc_cid', 'mc_eid', 'msclkid']; //Add URL params to be excluded from page URI
  var a = document.createElement('a');
  var param,
      qps,
      iop,
      ioe,
      i;
  a.href = {{Page URL}};
  if (a.search) {
    qps = '&' + a.search.replace('?', '') + '&';
    for (i = 0; i < params.length; i++) {
      param = params[i];
      iop = qps.indexOf('&' + param + '=');
      if(iop > -1) {
        ioe = qps.indexOf('&', iop + 1);
        qps = qps.slice(0, iop) + qps.slice(ioe, qps.length);
      }
    }
    a.search = qps.slice(1, qps.length - 1);
  }
  return a.href;
}

Two things to mention about the code:

*

*List all params you want to strip out in the array params;

*a.href = {{Page URL}} - the code makes use of GTM's built-in variable Page URL (hence double curly brackets) that captures the full URL (without hostname, though). If you feel fancy, you can replace it with plain JS.

So the code above now populates the GTM field/GA4 dimension page_URI in the main configuration tag and any other tags, where I think having a clean URI is useful:

I do realize that this approach uses up one GA4 dimension, but it's a price I'm willing to pay to have a clean URL in the absence of a better solution.

A: In the GA4 tag in GTM try to set page_location as Field to Set and a Custom JavaScript Variable as value with this definition:
function(){
  return document.location.hostname + document.location.pathname;
}

i.e. (note: App+Web is old name of GA4):

A: You can also use the following JavaScript in the custom JavaScript variable instead of the custom JavaScript mentioned above.
In this custom JavaScript instead of creating a new anchor element, we simply are taking the full page URL and then using the JavaScript's in-built URL() method to convert it to a proper URL that can be programmatically managed and then manage it according to the need.
I'm sharing my script below:
Step 1
Create a custom JavaScript variable inside your GTM and add the following JavaScript code into it.
function() {
    // Set the array with the list of query string you would like to remove being shown up in Google Analytics 4
    var excuded_query_params = [
        'add',
        'the',
        'query',
        'strings',
        'you',
        'would',
        'like',
        'to',
        'be',
        'removed',
        'from',
        'GA4',
        'analytics',
        'report'
    ]

    // Get the full Page URL from GTM in-build variables
    var page_url_string = {{Page URL}}

    // Convert the received URL from string format to URL format
    var page_url = new URL( page_url_string )
    var page_url_copy = new URL( page_url_string )

    // Loop through the query parameters in the URL and if there is any query param which is in the excluded list,
    // remove that from the full URL
    page_url_copy.searchParams.forEach( function(param_value, param_name) {
        if( excuded_query_params.includes( param_name ) ) {
            page_url.searchParams.delete( param_name )
        }
    } )

    // Return the final URL
    return page_url.toString()
}

Please Note: as we are going to replace the value of page_location a default GA4 variable's data - it is highly recommended that you do not remove the utm_ query parameters from the URL as GA4 reports use that data internally and that may lead to report breaking. So, it's best that you do not remove query parameters like utm_souyrce, utm_campaign etc.
Step 2
Inside your GA4 Configuration Tag, click on Fields to Set and add a new field with the Field Name set as page_location and value set as this custom JavaScript variable.

Step 3
Now it's time to preview inside GTM and deeply.


text:
Q: Count and average Having
(deffacts people
(customer (name a) (money 20) )
(customer (name b) (money 30) )
(customer (name c) (money 40) )
)

I want to calculate the average money. How can I count how many customers I have and then, the average?

A: CLIPS> (deftemplate customer (slot name) (slot money))
CLIPS>
(deffacts people
   (customer (name a) (money 20))
   (customer (name b) (money 30))
   (customer (name c) (money 40)))
CLIPS> (reset)
CLIPS>
(defrule average
   (exists (customer))
   =>
   (bind ?count 0)
   (bind ?sum 0)
   (do-for-all-facts ((?f customer)) TRUE
      (bind ?count (+ ?count 1))
      (bind ?sum (+ ?sum ?f:money)))
   (printout t "There are " ?count " customers with average money of " (/ ?sum ?count) crlf))
CLIPS> (reset)
CLIPS> (run)
There are 3 customers with average money of 30.0
CLIPS>


text:
Q: Image properties display In Excel i would like to know how to achieve the following:
I would like to insert an image into a cell then once inserted other cells in that row show the properties of that image eg. date modified, file name etc.
Thanks


text:
Q: Split single form into multiple tabs with next/previous button in Yii2 I want to incorporate tabs in my form(it is dependent on multiple models) with next and previous button, and onclick of these buttons should validate the fields with comes only in their respective tabs but form should be submitted/saved to DB only at the end.
I have gone through my tabs example but they don't seem to have next and previous button in yii2.
Is there anyway to do this??


text:
Q: Only output value if x > y in awk INPUT:
0:root@server:/root # vmstat 60 2

System configuration: lcpu=52 mem=131072MB ent=10.00

kthr    memory              page              faults              cpu
----- ----------- ------------------------ ------------ -----------------------
 r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa    pc    ec
 5  0 13254063 12378057   0   0   0   0    0   0 3411 22516 9063 10  2 88  0  1.94  19.4
 5  0 13341251 12290955   0   0   0   0    0   0 3507 20192 9062  9  2 89  0  1.88  18.8
0:root@server:/root #

NEEDED OUTPUT:
0

It is zero, since the average r < lcpu. The "id" values are not important in this case.
another INPUT:
0:root@server:/root # vmstat 60 2

System configuration: lcpu=52 mem=131072MB ent=10.00

kthr    memory              page              faults              cpu
----- ----------- ------------------------ ------------ -----------------------
 r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa    pc    ec
 52  0 13254063 12378057   0   0   0   0    0   0 3411 22516 9063 10  2 6  0  1.94  19.4
 53  0 13341251 12290955   0   0   0   0    0   0 3507 20192 9062  9  2 4  0  1.88  18.8
0:root@server:/root #

NEEDED OUTPUT:
95

It is 95, because the average r > lcpu.
And it is 95, because id means idle, but we need the cpu consumption. So 6+4 is the idle value, the average from them is 5. So 100-5 = 95% is the cpu load.
Average is needed in the "r"'s too! Not just in "id". In the last example it is 52.5, so it was greater than 52.
This is a general UNIX problem to measure CPU consumption. If r > lcpu and the cpu usage % is very high, then we have a CPU bottleneck.
It is interesting that there is no solution for the processing of the vmstat output, that's why I'm asking the awk grandmasters about it.
Question: So I need something like this: "vmstat 60 2 | GODLY-AWK-MAGIC-HERE"
For more details, please see (I couldn't find a better link):
http://aix4admins.blogspot.com/2011/09/vmstat-t-5-3-shows-3-statistics-in-5.html

If runnable threads (r) divided by the number of CPU is greater than
  one -> possible CPU bottleneck

A: Very crude:
awk '
    BEGIN { d = -1 }
    /lcpu/ { lcpu = substr($3, 6); next }
    $1 == "r" { ++d; next }
    d < 0 { next }
    {
        ++d
        r += $1
        id += $16
        next
    }
    END {
        if (r / d > lcpu)
            print 100 - id / d
        else
            print 0
    }
'

or if you like:
awk '
    /lcpu/ { lcpu=substr($3, 6) }
    $1 ~ /[0-9]+/ {
        ++d
        r += $1
        id += $16
        next
    }
    END {
        print (r/d>lcpu) ? 100 - id / d : 0
    }
'

to:
awk '/lcpu/{lcpu=substr($3,6)}$1~/[0-9]+/{++d;r+=$1;id+=$16;next;}END{print(r/d>lcpu)?100-id/d:0}'

Does it give the results you want?


text:
Q: CSS doesn't respond and also the Images don't load The main.css is located in a folder named css, and the index.html is outside the folder.
<head>
    <title>Tornike's Page</title>
    <link rel = "stylesheet" type="text/css" href = "css/main.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

My Code

The Website and developer tools

A: I think you don't have folder structure. If you really have it and does not works then you can try ./css/main.css. Otherwise I'd tried to go with main.css.

A: I fixed it guys, Just needed to edit my path so it would say : "Website/css/main.css" , Thanks for answers.


text:
Q: Radius of Convergence for a Complex Function I'm really rusty on my series convergence, and I guess I was more asking for a bit of clarification on a question I'm working on.
I've been asked to find the power series expansion for $\frac{1}{3 - z}$ about the point $4i$, and to then give the radius of convergence.
After a bit of tedium, I got the power series expansion as follows;
$$\frac{1}{3 - z} = \frac{1}{3 - 4i - (z - 4i)}$$
$$ = \frac{1}{3-4i} \frac{1}{1 - \frac{z-4i}{3-4i}}$$
$$ = \sum_{n = 0}^{\infty} \frac{1}{3-4i} (\frac{z-4i}{3-4i})^n$$
$$ = \sum_{n = 0}^{\infty} \frac{1}{(3-4i)^{n+1}} (z-4i)^n$$
Now, I know this will hold true for $\frac{|z - 4i|}{5} < 1$, which is equivalent to $|z-4i| < 5$, so is it correct to say that the radius of convergence for this function is 5 (ie; the ball of radius 5, centred at 4i)??

A: Your answer is correct and also the method is reasonable. Let me just add a result that would tell you right way what radius of covergence to expect. You could use this as a check.

For any rational function (and this holds in more generality) the radius of convergence of the series development around a point is the distance to the nearest pole of the function.

The only pole of the function being at $3$ and the distance of $3$ and $4i$ being $5$ you can confirm the radius of convergence.


text:
Q: Most efficient Database representation of hierarchical data? I have a web app that I've made that I now want to make WELL. It contains a large tree that I want to persist in a database. The tree will be about 50 nodes wide and 30 nodes deep. It will have frequent reads and writes to mostly single nodes, but copying/pasting subtrees is possible.
I've already implemented it using Nested Intervals. But the implementation of this that I used  (Node key encoding) causes very large integers to occur when the tree gets deep.
My question is: what is the most efficient representation of hierarchical data that we know of today?
Thanks,
Marco.


text:
Q: Stopping a timer in java sorry for bothering again.
I'm having troubles with stopping a timer.
I tried doing a boolean to which, after one run, it would get a false value and then cancel the timer, but it didn't work out.
The timer is supposed to run once at a specific time. Using timer.cancel() it canceled before running the task.
I figured that I could add a couple of milliseconds to the date so that it would stop (along with the timer.cancel()), but it didn't work.
I'm letting you know the code:
public class MyTimeTask extends TimerTask {
    private String name;

    public MyTimeTask(String name) {
        this.name = name;
    }
    @Override
    public void run() {
        System.out.println(this.name);
    }
}

public static void main(String[] args) throws ParseException {
        DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String yearMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
        String day = "05";
        Date date = dateFormatter.parse(yearMonth + "-" + day + " 02:10:08PM");

        System.out.println(yearMonth);
        Timer timer = new Timer();
        TimerTask task = new MyTimeTask("Patrick");
        timer.schedule(task, date);
        long expiremilis = 10l;
        Date expireDate = new Date(date.getTime() + expiremilis);
        timer.cancel();
}

This was one of the ways I tried to fix this, but I couldn't, nor do I know if adding milliseconds to the chosen date is appropriate at all to make it stop.
What am I doing wrong?
Thanks


text:
Q: using Link from react-router-dom with button I am using react-bootstrap Cards on my project. I have great view with that. I have horizontal search button on it. I would like to use this button for routing.
I set my settings on my app.js class. Actually, I can change route with <Link> but my search button looks bad with it. I would like to use Search button while keeping visual design.
Sorry for my explanation, It's hard to explain without any visual support. if it is not clear please leave comment and I would try to clarify with onether way.
Here is my codes;
<Card bg="dark" text="white" style={{ width: "18rem" }}>
    <Card.Header>SWITCH</Card.Header>
    <Card.Body>
        <Card.Title>Dark Card Title</Card.Title>
        <Card.Text>
            Some quick example text to build on the card title and make up
            the bulk of the card's content.
        </Card.Text>
    </Card.Body>
    <Button variant="secondary">SEARCH</Button>
</Card>

I can do routing with  wit this code;
<Card bg="dark" text="white" style={{ width: "18rem" }}>
  <Card.Header>SWITCH</Card.Header>
  <Card.Body>
      <Card.Title>Dark Card Title</Card.Title>
      <Card.Text>
          Some quick example text to build on the card title and make up
          the bulk of the card's content.
      </Card.Text>
  </Card.Body>
  <Link to={"/route which I defined in app.js"}>
  <Button variant="secondary">SEARCH</Button></Link>
</Card>

But this time, search button's size decrease. Are there any way to stretch it? Or should I change usage of <Link> ?

A: You probably will need to do some custom css styling still. You can open up your elements browser by clicking inspect in chrome and find the class of the link, then you can overwrite that class to match your styling needs.
Also try wrapping the link with the button
<Button variant="secondary"><Link>SEARCH</Link></Button>

NOTE: Even though it's not recommended and you should normally avoid it, you might need to use !important in your css when overwriting bootstrap.

A: You can use a package called react-router-bootstrap  from npm and use it. It's very simple and for your use case find the below snippet.
<Link to={"/route which I defined in app.js"}><Button]>Foo</Button></Link>

becomes
import { LinkContainer } from 'react-router-bootstrap'

<LinkContainer to={"/route which I defined in app.js"}>
  <Button>Foo</Button>
</LinkContainer>

find more on react-router-bootstrap

A: you can try,
<Button as={Link} to="/your_destination">Foo</Button>


text:
Q: Passing parameters to the class while passing the class as a `class literal` I am trying to schedule a job using Quartz library. Below is the method belong to the class which schedules the job.
private void Reminder1()
    {
        String[] firstReminderTime = getFirstReminderTime().split(":");
        Integer firstReminderHour = Integer.parseInt(firstReminderTime[0]);
        Integer firstReminderMinute = Integer.parseInt(firstReminderTime[1]);

        if(firstReminderHour==null || firstReminderMinute==null)
        {

            return;
        }

        JobDetail job = newJob(PJob.class).withIdentity("p1").build();

        Trigger trigger = newTrigger()
         .withIdentity(triggerKey("pTrigger1", "pTriggerGroup1"))
         .withSchedule(dailyAtHourAndMinute(firstReminderHour, firstReminderMinute))
         .startAt(new Date()).build();

        try {
            Scheduler scheduler = new StdSchedulerFactory().getScheduler();
            scheduler.start();
            scheduler.scheduleJob(job, trigger);

        } catch (SchedulerException ex) {
            ex.printStackTrace();
        }
    }

Below is the job class.
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RemindeWorker.PJob;

import RemindeWorker.Listener.ReminderCommon;
import java.util.Properties;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

/**
 *
 * @author Yohan
 */
public class PJob implements Job
{
    private String host;
    private String userName;
    private String password;
    private String firstReminderTime;
    private String secondReminderTime;

    public PJob(String host, String userName, String password, String firstReminderTime, String secondReminderTime)
    {
        setHost(host);
        setUserName(userName);
        setPassword(password);
        setFirstReminderTime(firstReminderTime);
        setSecondReminderTime(secondReminderTime);
    }

    @Override
    public void execute(JobExecutionContext jec) throws JobExecutionException
    {
          String host=getHost();
          final String user=getUserName();//change accordingly
          final String password=getPassword();//change accordingly

          String to="xxx@gmail.com";//change accordingly

           //Get the session object
           Properties props = new Properties();
           props.put("mail.smtp.host",host);
           props.put("mail.smtp.auth", "true");

           Session session = Session.getDefaultInstance(props,
            new javax.mail.Authenticator() {
              @Override
              protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(user,password);
              }
            });

           //Compose the message
            try {
             MimeMessage message = new MimeMessage(session);
             message.setFrom(new InternetAddress(user));
             message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
             message.setSubject("Subject");
             message.setText("This is simple program of sending email using JavaMail API");

            //send the message
             Transport.send(message);

             System.out.println("message sent successfully...");

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

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

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

    public String getFirstReminderTime() {
        return firstReminderTime;
    }

    public void setFirstReminderTime(String firstReminderTime) {
        this.firstReminderTime = firstReminderTime;
    }

    public String getSecondReminderTime() {
        return secondReminderTime;
    }

    public void setSecondReminderTime(String secondReminderTime) {
        this.secondReminderTime = secondReminderTime;
    }

}

However I have an issue. Please pay attention to the below
 JobDetail job = newJob(PJob.class).withIdentity("p1").build();

Here we call the "class literal". But, I need to execute the constructor of the Job class, because it does accept the parameters. Passing parameters to this class is mandatory.
So my question is, since when passing the class literal, there is no way of passing the parameters, how I can pass them to the job class?

A: Create fake job which:

*

*reads parameters from somewhere (properties, db etc)

*creates real job using constructor with parameters

and schedule this fake job to quartz.


text:
Q: Combobox in sencha touch How we can realize a Combobox with sencha touch??
I tried with selectfield but when I install my app on an Android Phone, the select field doesn't work.

A:  xtype: 'selectfield',
 label: 'Choose one',
 options: [
            {text: 'First Option',  value: 'first'},
            {text: 'Second Option', value: 'second'},
            {text: 'Third Option',  value: 'third'}
          ]

This is code straight from the sencha site. Select field works on Android. There must be something else wrong in your code.


text:
Q: Can't append a set of values from a Class I am doing a card game.
The class is called Card:
It can give a random value with the deal() method to display a random card from the numbers 1-13
The other file will import the file name that contains the Class Card. It will call the class 5 times and be able to store it by appending it on a list and displaying it in another def called display_hand
Here is the class file:
import random

class Card:
    def __init__(self):
        self.__value = 0

    def deal(self):
        self.__value = random.randint(1, 13)

    def set_value(self, value):
        self.__value = value

    def get_value(self):
        return self.__value

    def find_face_value(self):
        faces = ['Joker','Ace','Two','Three','Four','Five','Six',
             'Seven','Eight','Nine','Ten','Jack','Queen','King']
        return faces[self.__value]

    def __str__(self):
        return self.find_face_value()

The program is too big so this is the def for calling the function 5 times:
def deal_hand():
    # Create an empty list to append the cards.
    hand = []
    deal_hand = classcard3.Card()

    for i in range(1, 6):
        deal_hand = classcard3.Card()
        deal_hand.deal()
        # Create a new object in memory and assign it to the
        # hand variable
        w = classcard3.Card(deal_hand)
        # add it to the list
        hand.append(w)

    return hand

Here is the display function:
def display_hand(hand):
    print ("The 5-card hand is: ")
    for item in hand:
        print(hand)

This is not showing anything except for the print inside the loop. How can I pass it to the display hand to show the cards?
This is the only thing that shows whenever I use the print function inside the loop. I'm trying to use it outside and I have no idea what I'm doing wrong. My apologies if I'm not explaining this too well. I'm a beginner at python and new to this website. Thanks
deal Four
deal Three
deal Five
deal Six
deal Queen

The only error that I'm getting from this is:
line 274, in deal_hand
    w = classcard3.Card(deal_hand)
TypeError: __init__() takes 1 positional argument but 2 were given

This doesn't make sense, because I'm doing it just as the book says and is not willing to display the values


text:
Q: SQLAlchemy not detecting ForeignKeys on _determine_joins, NoForeignKeysError I'm having an issue where SQLAlchemy throws a NoForeignKeysError when it attempts to determine the primary join for two tables. The odd thing is this issue only occurs on the second instantiation of the models (i.e. if I drop the tables and recreate them it works the first time I run the script but not the subsequent times). Even odder is if I use inspect to view the ForeignKeys of the child tables I can clearly see that they exist (psql and just looking at the declarative base's metadata confirms this as well). My models are generated by a script and all other tables with similar or more complex relations work as expected however it is only this particular set of tables that has this issue.
The specific errors it throws are:

sqlalchemy.exc.NoForeignKeysError: Can't find any foreign key relationships between 'task_statuses' and 'task_data'.

and

sqlalchemy.exc.NoForeignKeysError: Could not determine join condition between parent/child tables on relationship task_statuses.task_data - there are no foreign keys linking these tables.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify a 'primaryjoin' expression.

Code snippet:
class TaskData(db_base):
    __tablename__ = 'task_data'
    __table_args__ = ({'extend_existing' : True})
    id = Column(Integer, primary_key=True)
    tags = relationship('TaskTags', backref='task_data', cascade='all, delete-orphan', passive_deletes=True)
    statuses = relationship('TaskStatuses', backref='task_data', cascade='all, delete-orphan', passive_deletes=True)

class TaskTags(db_base):
    __tablename__ = 'task_tags'
    __table_args__ = ({'extend_existing' : True})
    id = Column(Integer, primary_key=True)
    taskdata_id = Column(Integer, ForeignKey('task_data.id', ondelete='CASCADE'))

class TagStatuses(db_base):
    __tablename__ = 'task_statuses'
    __table_args__ = ({'extend_existing' : True})
    id = Column(Integer, primary_key=True)
    taskdata_id = Column(Integer, ForeignKey('task_data.id', ondelete='CASCADE'))

Update:
After rereading the error message, I've realized that SQLAlchemy seems to think that task_statuses is the parent table when in fact it's the child. That still explains nothing and is actually more confusing but may be noteworthy. Even if a primaryjoin is specified the error persists.

A: The problem ended up being with Graphene-SQLAlchemy
For whatever reason, defining the SQLAlchemy model and the Graphene-SQLAlchemy equivalent in the same file was causing SQLAlchemy to have some unexpected behavior.
I resolved the issue by placing the models in a different file then generating the required Graphene-SQLAlchemy objects in the original file


text:
Q: How to improve latex table In this table, how can I have the upper line that matches between the two tables? I would like to have two tables with the same height. Here is the code that I used to create the table
\documentclass{article}
\usepackage{geometry}
\usepackage{textcomp}
\usepackage{adjustbox}
\usepackage{mathtools}
\usepackage{booktabs} %
\usepackage[group-separator={,}]{siunitx}
\usepackage{changepage}
\newcommand{\undepth}[1]{%
    \smash[b]{%
        \begin{varwidth}[t]{\linewidth}#1\end{varwidth}
    }%
}
\usepackage{makecell}%To keep spacing of text in tables

\begin{document}

\begin{table}[htbp!]
    \centering
    \footnotesize
    \caption{caption}
    \begin{tabular}{lSSSS}
        \toprule
        \makecell[cc]{column1 \\ second line} & \multicolumn{1}{l}{column2} & \multicolumn{1}{l}{column3} & \multicolumn{1}{l}{column4} & \multicolumn{1}{l}{column5} \\
        \midrule
        A     & 4     & 0     & 0.00 & 4     \\
        B     & 30    & 0     & 0.00 & 30   \\

    \bottomrule
    \end{tabular}
    \quad
    \footnotesize
    \begin{tabular}{lSS}
        \toprule
        & {Column1.1 } & {Column2.1}\\
        \midrule
        A     & 0.02 & 0.00 \\
        B     & 0.04 & 0.00  \\

        \bottomrule
    \end{tabular}%
\end{table}%
\end{document}

A: Quick hack:
Put some invisible dummy header of the same height as in the other table
\documentclass{article}
\usepackage{geometry}
\usepackage{textcomp}
\usepackage{adjustbox}
\usepackage{mathtools}
\usepackage{booktabs} %
\usepackage[group-separator={,}]{siunitx}
\usepackage{changepage}
\newcommand{\undepth}[1]{%
    \smash[b]{%
        \begin{varwidth}[t]{\linewidth}#1\end{varwidth}
    }%
}
\usepackage{makecell}%To keep spacing of text in tables

\begin{document}

\begin{table}[htbp!]
    \centering
    \footnotesize
    \caption{caption}
    \begin{tabular}{lSSSS}
        \toprule
        \makecell[cc]{column1 \\ second line} & \multicolumn{1}{l}{column2} & \multicolumn{1}{l}{column3} & \multicolumn{1}{l}{column4} & \multicolumn{1}{l}{column5} \\
        \midrule
        A     & 4     & 0     & 0.00 & 4     \\
        B     & 30    & 0     & 0.00 & 30   \\

    \bottomrule
    \end{tabular}
    \quad
    \footnotesize
    \begin{tabular}{lSS}
        \toprule
        \makecell[cc]{\mbox{} \\ \mbox{}} & {Column1.1 } & {Column2.1}\\
        \midrule
        A     & 0.02 & 0.00 \\
        B     & 0.04 & 0.00  \\

        \bottomrule
    \end{tabular}%
\end{table}%
\end{document}

Cleaner solution:
Use only one tabular
\documentclass{article}
\usepackage{geometry}
\usepackage{textcomp}
\usepackage{adjustbox}
\usepackage{mathtools}
\usepackage{booktabs} %
\usepackage[group-separator={,}]{siunitx}
\usepackage{changepage}
\newcommand{\undepth}[1]{%
    \smash[b]{%
        \begin{varwidth}[t]{\linewidth}#1\end{varwidth}
    }%
}
\usepackage{makecell}%To keep spacing of text in tables

\begin{document}

\begin{table}[htbp!]
    \centering
    \footnotesize
    \caption{caption}
    \begin{tabular}{lSSSSSS}
        \cmidrule[\heavyrulewidth](r){1-5}\cmidrule[\heavyrulewidth](l){6-7}
        \makecell[cc]{column1 \\ second line} & \multicolumn{1}{l}{column2} & \multicolumn{1}{l}{column3} & \multicolumn{1}{l}{column4} & \multicolumn{1}{l}{column5} & {Column1.1 } & {Column2.1} \\
        \cmidrule(r){1-5}\cmidrule(l){6-7}
        A     & 4     & 0     & 0.00 & 4   & 0.02 & 0.00 \\
        B     & 30    & 0     & 0.00 & 30   & 0.04 & 0.00  \\
        \cmidrule[\heavyrulewidth](r){1-5}\cmidrule[\heavyrulewidth](l){6-7}
    \end{tabular}%
\end{table}%
\end{document}


text:
Q: Refresh/restart a javascript on click? I use the "mixitup"-script and I want to refresh/restart only this script, not the whole page, by pressing a button.
$(function(){
  $('.container').mixItUp();
});

Is that possible?
My fiddle


text:
Q: jsPlumb connectors not drag-able I'm trying to create a flow digram using data from the server, I am able to draw the states and connection correctly, states are draggable but same is not working with the connectors.
please see the sample code below.

    <title>Getting started with jsPlumb</title>

I need to make the connectors drag-able, any help is apprenticed.

A: issue is solved
used jsPlumb.connect()  instesd of firstInstance.connect().


text:
Q: php add days to date in PHP I want to add or remove a day (or more) depending on a dynamic value. Some times i want to remove / add 4 days, and next time maybe 9. How would i be able to do this in PHP? I was hoping there was i timestamp solution so i could use number of secounds.
Example: 2012-04-21 + 86400 // Add one day
Is there any good solution for this? or is there other good methods where i can use dynamic values to remove or add any number of days i wanted.
Please feel free to suggest!

A: Have a look at strtotime()
http://fr2.php.net/manual/en/function.strtotime.php
$unix_time = strtotime("+1 day", strtotime("2012-11-01"));
echo date("Y-m-d H:i:s", $unix_time);

A: you can use strtotime
$new_date = date('Y-m-d', strtotime($old_date . ' +1 day'));


text:
Q: Should I use PIVOT or something else I have SQL code using many CTE statements to summerise data which eventually gets me to something like this
Bldgcode     Business        Seat_Count     Area
A012345      Bus 1            1             1234
A012345      Bus 2            3             3456
B1234        Bus 1            4             6789
B1234        Bus 3            6             4321

I want to transpose / pivot this to show a final result set that looks like this
Bldgcode    Bus 1 Seat    Bus 1 Area    Bus 2 Seat    Bus 2 Area   Bus 3 Seat  Bus 3 Area
A012345     1              1234           3             3456        0          0
B1234       4              6789           0              0          6          4321

I would like the Business columns to be dynamic as I have over 15 of them and don't want to list each individually, plus there may be a time when a new Business will appear in the data which I need another set of columns for.
I've looked at PIVOT but can't get it to work as my knowledge is limited, any help with coding would be greatly appreciated
Thanks

A: Just use conditional aggregation:
select Bldgcode,
       max(case when Business = 'Bus 1' then Seat_Count end) as bus1_seats,
       max(case when Business = 'Bus 1' then area end) as bus1_area,
       max(case when Business = 'Bus 2' then Seat_Count end) as bus2_seats,
       max(case when Business = 'Bus 2' then area end) as bus2_area
from t
group by Bldgcode;


text:
Q: Programmatically scroll QScrollArea I have a Widget with QScrollArea in it and I want it to be scrolled down right after the widget containing it is shown. I tried:
scrollArea->ensureVisible(0,100, 20, 20);

It works only when invoked by user (pushing button for example). Putting it in widget contstructor or showEvent doesn't work. Can it be done automatically?

A: I have spent some time with the debugger and find out that scriollArea has 0 sizes in the constructor, so it looks like it is possible to scroll something only when all the widgets are created and visible. Scrolling in the showEvent of window works fine.

A: I believe you can scroll the QScrollArea content by setting positions to its horizontal and vertical scrollbars. Smth, like this:
scrollArea->verticalScrollBar()->setValue(scrollArea->verticalScrollBar()->value() + 10);
scrollArea->horizontalScrollBar()->setValue(scrollArea->horizontalScrollBar()->value() + 10);

code above should scroll contents of the scroll area 10 pixels down and 10 pixels right each time it gets called
hope this helps, regards
Edit0: extra code snippet showing how to scroll the area in the form's constructor:
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QLabel *imageLabel = new QLabel;
    QImage image("my_large_image_file.JPG");
    imageLabel->setPixmap(QPixmap::fromImage(image));

    ui->scrollArea->setBackgroundRole(QPalette::Dark);
    ui->scrollArea->setWidget(imageLabel);

    ui->scrollArea->horizontalScrollBar()->setValue(100);
    ui->scrollArea->verticalScrollBar()->setValue(100);
}


text:
Q: JButton with padding between its border and the button itself I've a JButton that has its background green-colored and its border as a LineBorder. I would like to insert a space between the button and the border, a kind of padding.
I've tried with setMargin(new Insets(x,y,t,z)) but it seems not working.
This is my piece of code.
JButton JBtn=new JButton("sdfd");
JBtn.setBorder(BorderFactory.createLineBorder(Color.CYAN,5));
JBtn.setBackground(Color.GREEN);
JBtn.setMargin(new Insets(5,5,10,10));

Any advice?

A: The borders are part of the button and clicking on them will click the button. You can set the background as green, then paint borders over the background:
jBtn.setBackground(Color.GREEN);
jBtn.setBorder(BorderFactory.createCompoundBorder(
               BorderFactory.createLineBorder(Color.CYAN, 5),
               BorderFactory.createLineBorder(Color.BLACK, 20)));

I've tried with setMargin(new Insets(x,y,t,z)) but it seems not working.

Because if you read the documentation for setMargin you'll see that

[...] if a non-default border is set on the button, it is that Border object's responsibility to create the appropriate margin space (else this property will effectively be ignored).

Also, reserve uppercase names for classes, rename JBtn to jBtn.

A: The change to the Border is changing the way the margins work (they don't seem to be included in the decisions for determining the layout any more).
Instead, you can use a CompoundBorder, for example...
JBtn.setBorder(BorderFactory.createCompoundBorder(
        BorderFactory.createLineBorder(Color.CYAN, 5),
        BorderFactory.createEmptyBorder(5, 5, 10, 10)));


text:
Q: How to merge a Git branch using a different identity? We are using Git for a website project where the develop branch will be the source of the test server, and the master branch will serve as the source for the live, production site.  The reason being to keep the git-related steps (switching branches, pushing and pulling) to a minimum for the intended user population.  It should be possible for these (not extremely technical) users to run a script that will merge develop into master, after being alerted that this would be pushed to live. master cannot be modified by normal users, only one special user can do the merge.
This is where I'm not sure how to integrate this identity change into my code below:
https://gist.github.com/jfix/9fb7d9e2510d112e83ee49af0fb9e27f
I'm using the simple-git npm library.  But more generally, I'm not sure whether what I want to do is actually possible as I can't seem to find information about this anywhere.
My intention would be of course to use a Github personal token instead of a password.

A: Git itself doesn't do anything about user or permission management. So, the short answer is, don't try to do anything sneaky. Rather, use Github's user accounts they way they were intended.
What I suggest is to give this special user their own Github account, with their own copy of the repo. Let's say the main repo is at https://github.com/yourteam/repo, and the special repo is at https://github.com/special/repo.
The script will pull changes from the team repo's develop branch, and merge this into it's own master branch and push to https://github.com/special/repo.
Then, it will push its changes to the team's master branch. This step can optionally be a forced push, since no one else is supposed to mess with master, anyway. (In case someone does, using a forced push here means they have to fix their local repo to match the team repo later on, rather than having the script fail until someone fixes the team repo.)
At the same time, your CI software will notice that master has changed at https://github.com/special/repo, and will publish as you normally would. This is the linchpin: the CI doesn't pay attention to the team repo, so although your team has permission to change it, those changes don't make it into production.
This special user will need commit access to the team repo, in addition to its own GitHub repo. The easiest way is probably to use an SSH key, and run the git push command from the script, rather than trying to use the GitHub API.


text:
Q: AnnounceForAccessibility with ExplorationByTouch turn off I keep trying to make my custom input method for blind people more accessible.
I had a problem AnnounceForAccessibility() doesn't work with ExplorationByTouch turn off (TalkBack is turn on). How can I resolve this problem?
Can I turn off ExplorationByTouch only for my View?


text:
Q: How can I style a Toolbar to act like an AppBar It looks like a Toolbar is a more customizable version of the AppBar. I would like to stick a few icons into the AppBar. I would like to replace the AppBar with a Toolbar. However, I'm currently using the lightUITheme.
It looks like Toolbars look different. Is there a way I can style a Toolbar just like an Appbar and still honor the theme so that if the theme changes, my toolbar still looks like an Appbar?

A: You can use the style property of the Toolbar.
For example:
const toolbarStyle = {
      backgroundColor: indigo500
    }

<Toolbar style={toolbarStyle}>
  <ToolbarGroup firstChild={true}>
    <ToolbarTitle text="Options" />
    <RaisedButton onTouchTap={this.handleOpenMenu} label="Downloads" />
  </ToolbarGroup>
</Toolbar>

If you use the built in colours then be sure to include them too e.g.:
import {indigo500} from 'material-ui/styles/colors';