text:
Q: Capacitance for a Cylindrical capacitor, with a hollow inner cylinder I was wondering the following. The formula for a cylindrical capacitor is known. However, the formula shows a solid cylinder inside a hollow cylinder.
How would having a hollow cylinder inside another hollow cylinder change the capacitance of this cylindrical capacitor?
My understanding leads me to think the formula will remain the same, as the conductors will build the same charge regardless.
Please let me know if this is not the way to think about this problem.

A: You are correct.  It makes no difference whether the inner conductor is solid or hollow.  All the charge on a conductor resides on its surface.  When you place a free charge $Q$ on the inner conductor, that charge will all run to the outer surface.  The individual charges repel one another, and they spread out to minimize their  potential energy; this configuration places them all on the outer surface.  Consequently, it does not matter what the internal structure of the conductor is, whether it is solid or hollow (or anything else).
A similar argument actually applies to the outer conductor.  The charge $-Q$ on the outer cylinder will all be located along its inner surface, regardless of how thick the conductor.  Thus the capacitance per unit length of two coaxial cylinders is
$$C_{0}=\frac{2\pi\epsilon}{\ln(b/a)},$$
where $a$ is the outer radius of the inner cylinder, and $b$ is the inner radius of the outer cylinder.  ($\epsilon$ is the permittivity of the insulating material between the cylinders; if there is no dielectric material there, then it takes the vacuum value $\epsilon_{0}$.)


text:
Q: What is the MySQL equivalent of Oracle's Enterprise Manager I understand that Oracle will at some point add support for MySQL to its Enterprise Manager software. However I'd like to know perhaps from other Oracle to MySQL migrants what tools are available for monitoring the queries, activity and resource usage happening on a MySQL database instance.

A: Take a look at MySQL Enterprise Monitor

A: One option would be MySQL Workbench 5.2.  It's still in Beta but development is moving rapidly.  They are replacing the old MySQL administrator with this all in one tool.

redpajama_set_name: RedPajamaStackExchange


text:
Q: open .phtml files displays code in browser I have saved my view file in netbeans IDE as .phtml. File has both php scripting and HTML5 within it.
Through WAMP, when i try to open, only the coding is displayed..
Could anyone help please??
Thanks in advance...

A: Try creating a .htaccess file with the following content
AddType application/x-httpd-php .phtml
AddHandler x-httpd-php5 .phtml

If it works, you know your Server is not configured to run phtml as php by default.
Might also try php5-script instead of x-httpd-php5

A: At times we get posting on the forum where user complain that when they are running a PHP file, the output is the file itself. This means that the script was not recognized as a PHP script and rather it was treated as plain text by the browser. There are two reasons why you can run into this situation to my knowledge.
If you are using short tags for writing PHP script like <? echo 'Hello World' ?>, you should ensure that you have short_open_tag INI directive set to '1' in your PHP INI file. If this is not the case the script will not be treated as PHP script. I would prefer PHP script like <?php echo 'Hello World' ?>. This is more clear and avoids confusion.
Another reason for running into this situation can be if the PHP file is not saved as ASCII/ANSI. Saving the PHP script in UNICODE/Multi-byte format will again fail the script to be recognized as PHP script. Always save the PHP script as plain text file to avoid running into this situation
EDIT AFTER THE COMMENT
AddType application/x-httpd-php .html

Or for .htm
AddType application/x-httpd-php .htm


text:
Q: Empty Directory Size drwxrwxr-x 2 xyz xyz 176128 Jul 29 02:03 20170429
drwxrwxr-x 2 xyz xyz 110592 Jul 31 01:22 20170430

cd 20170429
ls -lart
total 196
drwxrwxr-x   2 xyz xyz 176128 Jul 29 02:03 .
drwxrwxr-x 253 xyz xyz 20480 Aug  4 00:00 ..

du -sh 20170429
176K    20170429

du -sh 20170430
124K    20170430

Referring to the above information, I wanted to know for the empty directories 20170429, 20170429 , why is it still showing having memory space of 176128 and 176128 while we do ls -lrt. Where from do these information comes from? Is it from inode? Also note that even by du -sh they still shows 176k and 124k respectively for the empty directory.

A: My guess is that the directory has contained a large number of files in the past and the filesystem does not truncate the directory entry upon deleting files.
Example:
$ mkdir test_dir

$ du -h test_dir
2.0K    test_dir

$ touch test_dir/file{001..500}-{01..10}

We now have a directory with 5000 empty files in it.
$ du -h test_dir
102K    test_dir

The size comes solely from the directory entries of the empty files.
$ rm test_dir/file*

$ du -h test_dir
102K    test_dir

The size does not decrease (on this filesystem) as the files are deleted.


text:
Q: putting array in cookie I am trying to add 'recent viewed products' feature in my site. So i want to add the products recently watched in cookie. Setting cookie when user go to detail page of the product. So cookie setting code is in detail page.
What i am trying
setcookie('recentviews', $productid, time()+3600,'/')

What i need is
recentviews1 =>1
recentviews2 =>5
recentviews3 =>3

OR
recentviews (
[0] => 1,
[1] => 5,
[2] => 3
)

I tried alot of solutions, like setting cookie in loop, but how to know how many views are already set, so I can increment 'recentviews' and set new cookie.

A: I would probably go about something like this (imagining that the cookie content contains obly safe data):
# basic cookie structure:
$recent_views = array(
    # 'product_id' => 'value',
    32324 => 2,
    32455 => 23,
);

# to add a value in a request handler:
$recent_views = json_decode($_COOKIE['recentviews']);
$recent_views[ 32342 ] = 32;
setcookie('recentviews', json_encode( $recent_views ), $expi_time );

Error checking left out for brevity.
Json really has the advantage that you can easily decode the cookie in javascript in the browser and even make changes there.. (not what I would do, but still a possibility).
Cheers -

A: you can follow below example

$info[7][5]=1;
$info[8][5]=1;

Serialize data:
setcookie('cookie', serialize($info), time()+3600);

Then unserialize data:
$data = unserialize($_COOKIE['cookie']);

After data, $info and $data will have the same content.


text:
Q: How do these matrices form an order-$4$-tensor? I'm reading this paper on a convolutional neural network for modelling sentences, and I'm having some trouble understanding section $3.5$. Please consider the following text:
We denote a feature map of the $i$-th order by $F^i$. As in convolutional networks for object recognition, to increase the number of learnt feature detectors of a certain order, multiple feature maps $F_1^i,\ldots, F_n^i$ may be computed in parellel at the same layer. Each feature map $F_j^i$ is computed by convolving a distinct set of filters arranged in a matrix $m_{j,k}^i$ with each feature map $F_k^{i-1}$ of the lower order $i-1$ and summing the results: $$F_j^i = \sum_{k=1}^n m_{j,k}^i*F_k^{i-1}$$ where $*$ indicates the wide convolution. The weights $m_{j,k}^i$ form an order-$4$-tensor. After the wide convolution, first dynamic $k$-max pooling and then the non-linear function are applied individually to each map.
I've tried to figure out why the matrices of weights $m_{j,k}^i$ form an order-$4$-tensor (even though there are only three indices), by figuring out the feature maps:
For the first layer we have:
$$F_1^1 = \sum_{k=1}^1m_{1,k}^1 * F_k^0 = m_{1,1}^1*F_1^0\\
F_2^1 =\sum_{k=1}^1m_{2,k}^1 * F_k^0 = m_{2,1}^1*F_1^0$$
I think we just sum to one here since the input for the first layer is just the sentence matrix $s$ (so $F_1^0 = s$). For the second layer we have:
$$F_1^2 = \sum_{k=1}^2m_{1,k}^2*F_k^1 = m_{1,1}^2*F_1^1 + m_{1,2}^2*F_2^1\\
F_2^2 = \sum_{k=1}^2m_{2,k}^2*F_k^1 = m_{2,1}^2*F_1^1 + m_{2,2}^2*F_2^1$$
If this is correct that means that we need six different matrices for the two layers combined: $$m_{1,1}^1, m_{2,1}^1, m_{1,1}^2, m_{1,2}^2, m_{2,1}^2, m_{2,2}^2$$
Question: Why/how do these six matrices form a order-$4$-tensor?
The only thing I can think of is that it has something to do with the fact that the word embeddings in this paper have dimension $d = 4$ (there are four different filters), and that there is a different matrix $m_{j,k}^i$ for each of those four dimensions. This doesn't make sense though, since the matrices are used on a two-dimensional input, where one of those two dimensions is the dimension of the filter. In order words: the fact that the $m_{j,k}^i$ are matrices means that every row already corresponds to a filter dimension.

A: Under any reasonable definition, you are right three indices would mean an order 3 tensor. In fact I would call the $m^i_{j,k}$ a set of two dimensional tensors (i.e. matrices) indexed by i.  The point is that the i index is an index that takes finitely many integer values.  The 'j' and 'k' components are different as they index  a set of real numbers.  However, you will have to check the paper to see how he is doing things. As Gertrude Stein once said, a definition is a definition is a definition.


text:
Q: Branch points of global analytic functions (Ahlfors) In Ahlfors' complex analysis text, page 298 he discusses the case of a global analytic function $\mathbf{f}$ which can be continued analytically along all arcs in some punctured disk $\{0<|z|< \rho\}$. He then fixes a point $0<z_0=r<\rho$, and an initial germ of $\mathbf{f}$ over that point, and continues that germ along all integer powers of the circle $C=\{|z|=r\}$. There are are two cases:

*

*The germ obtained after $m$ windings around the circle never equals the initial one.

*There is a smallest integer $h$, such that tracing the circle $h$ times leads back to the initial germ.

Only the second case is considered further: Ahlfors then says that such a function "can be expressed as a single valued analytic function $F(\zeta)$" where $\zeta$ is related to $z$ by the equation $$z=\zeta^h .$$
So far this is only a background, my question regards page 299: On page 299 he constructs $F(\zeta)$ using the initial germ, and expands it in a Laurent series:
$$F(\zeta)=\sum_{-\infty}^\infty A_n \zeta^n. $$
He then writes:

It must be observed that this development depends on the choice of the initial germ; different choices may yield entirely different developments and, in particular, different values of $h$. Actually, even the series $(1)$ yields $h$ different developments, corresponding to the $h$ initial values of
  $z^{1/h}$. If we write $\omega =
e^{2 \pi i/h},$ these developments are represented by $$\tag{2} f_\nu(z)=\sum_{-\infty}^\infty A_n \omega^{\nu n} z^{n/h} \; \; (\nu=0,1,\dots,h-1) $$
  When the germ $(f_\nu,z_0)$ is continued along $C$ it leads to $(f_{\nu+1},z_0)$ with the
  understanding that the subscript $h$ is identified with $0$.

I have a few questions regarding the quoted part above:

*

*What does he mean by the initial values of $z^{1/h}$?

*What does he mean by using the word "developments"?

Obviously, the Laurent development of $F(\zeta)$ holds in the entire punctured disk, but where do these "Puiseux developments" $\{f_\nu\}$ hold?

*

*How can I rigorously show that continuing $(f_\nu,z_0)$ along $C$ leads to $(f_{\nu+1},z_0)$?

Intuitively, I guess as $z$ traces the circle $C$ once, $z$ transforms by the map $z \mapsto e^{2\pi i } z $, and from there $(e^{2 \pi i} z)^{n/h}=\omega^n z^{n/h}$. However, I know that using the power rule $(z w)^r=z^r w^r$ isn't that straightforward for complex numbers...
Any help is greatly appreciated, thanks!

A:
What does he mean by the initial values of $z^{1/h}$?

The initial germ $\mathbf{f}$ is given by a holomorphic function $f_0$ on a small neighbourhood $U$ of $z_0$. We may assume $U$ simply connected. Then there are $h$ branches of the $h$-th root defined on $U$, let's call $p_0$ the branch with $p_0(r) \geqslant 0$, and $p_\nu(z) = \omega^{-\nu}\cdot p_0(z)$, for $\nu = 1,\dotsc,h-1$. Then $\zeta \mapsto f_0(\zeta^h)$ is analytic on each of the $V_\nu = p_\nu(U) = \omega^{-\nu}\cdot V_0$, and we thus get $h$ function elements (in $h$ different points of the annulus $0 < \lvert\zeta\rvert < \rho^{1/h}$) $(g_\nu,V_\nu)$ with the property $g_\nu \circ p_\nu = f_0$. Each of the $g_\nu$ has an analytic continuation to the entire annulus $0 < \lvert\zeta\rvert < \rho^{1/h}$, which we also denote by $g_\nu$.
The "initial values of $z^{1/h}$" are the $p_\nu(z)$ on $U$ from which the analytic continuation is started. Perhaps it would be better to speak of the branches of the $h$-th root here.
Each of the $g_\nu$ has a Laurent development
$$g_\nu(\zeta) = \sum_{-\infty}^\infty A_n^{(\nu)} \zeta^n$$
and writing $\zeta = z^{1/h}$ in that yields a development of the form $(2)$. Since $g_\nu(\zeta) = g_0(\omega^\nu\cdot\zeta)$, we have $A_n^{(\nu)} = A_n^{(0)}\cdot \omega^{\nu\cdot n}$, which gives exactly $(2)$.

What does he mean by using the word "developments"?

Representations of $f$ as a series, here a "fractional power" series. "Expansions" could have been used too.

Obviously, the Laurent development of $F(\zeta)$ holds in the entire punctured disk, but where do these "Puiseux developments" $\{f_\nu\}$ hold?

On any subset of the annulus $0 < \lvert z\rvert < \rho$ on which a branch of the $h$-th root is defined. Usually, one would remove one radius from the annulus to get as large as possible a domain on which the expansion holds.

How can I rigorously show that continuing $(f_\nu,z_0)$ along $C$ leads to $(f_{\nu+1},z_0)$?

By continuing $g_\nu$ along the (positively oriented) arc from $p_\nu(z_0)$ to $p_{\nu+1}(z_0)$. That arc is mapped by $\zeta\mapsto \zeta^h$ to $C$, and since it is locally invertible, analytic continuation along the one corresponds to analytic continuation along the other via composition with an appropriate branch of the $h$-th root.


text:
Q: Yii has_many relationship with two primary_keys I have a mail_conversation and a mail_conversation_member table.
mail_conversation has only id as the PRIMARY KEY.
mail_conversation_member has conversation_id and user_id as PRIMARY KEYs.
Now, I want to list a conversation and all its members, but it only returns one member. It seems I need to add a second PRIMARY KEY in the HAS_MANY relationship.
 'message_member' => array(self::HAS_MANY, 'MailConversationMember', 'conversation_id')

I get the conversations with:
 $criteria = new CDbCriteria();
        $criteria->condition = "message_member.user_id = " . Yii::app()->user->id;
        $criteria->order = 'messages.date_created DESC';

        $mail_conversations = MailConversation::model()->with(array('message_member',   'messages'))->findAll($criteria);

A: This is because of the criteria you have. If you take the 'message_member' out of the with array, you can lazy load the members once you have the conversations. You should check the SQL code that Yii is generating to confirm that the criteria is being interpreted as expected.
In addition, why not define a relationship in the member class:
'conversations' => array(self::HAS_MANY, 'MailConversationMember', 'user_id',array(
     'order' => 'messages.date_created DESC',
),

Then you can pull the conversations through without that criteria you have specified, and pull the members through on each conversation.


text:
Q: Intuition for a certain tensor product. Tensor products occur in lots of places and until recently I thought I understood them at least reasonably well. During the past few weeks, however, I've attended several talks where the tensor product $\mathbb{R}\otimes_{\mathbb{Q}}\mathbb{R}$ played some role and I noticed that I don't actually quite know how to think of this. I therefore wonder if there's some particular way of thinking about this object (this specific tensor product) that makes it easier to understand. How can I get some intuition for it? Might there be some nice geometric interpretation, perhaps?

A: Linear algebra over ℚ actually represents an ancient idea of commensurability. Although tensor products are not linear algebra, this way of thinking helps enough for understanding "⊗ℚ", with some application of order theory.
First of all, how should we visualize elementary tensors? Consider for clarity only positive ones, i.e. representable as ℓ ⊗ ℎ where ℓ, ℎ ∈ (0, +∞). It is natural to put it onto "Cartesian plane" as a rectangle of width ℓ and height ℎ:

ℎ↕■■
  ←→
  ℓ

Which geometry should our "Cartesian plane" have for a good ℝ ⊗ℚ  ℝ? It is convenient to assume translations, but it definitely may not permit to rotate shapes, since ℓ ⊗ ℎ ≠ ℎ ⊗ ℓ, in general (from now on, "⊗" refers only to "⊗ℚ").
We see, our shapes are equivalent up to dissecting to equal pieces and assembling in different order. For example, the rectangle from the drawing above is equivalent to

 ■↑2ℎ
 ■↓
 ↔
ℓ ∕ 2

When is the sum ℓ1 ⊗ ℎ1 + ℓ2 ⊗ ℎ2 equivalent to an elementary tensor? Purely algebraically, if and only if (ℓ1 and ℓ2 are commensurable or ℎ1 and ℎ2 are commensurable). In the former case we can reassemble both rectangles to narrow and tall ones, of the same width, and then connect vertically. In the latter case we can reassemble both rectangles to long and low ones, of the same height, and then connect horizontally, such as

[ ] + [ ] = [ ][ ]

Obviously, we can not only add shapes, but also subtract them in a similar way:

[ ][ ] − [ ] = [ ]

What about sums and differences that are not elementary tensors, i.e. rectangles? There is no problem with addition of two arbitrary rectangles: just place them without overlap and consider resulting shape bounded by no more than 4 horizontal strokes and no more than 4 vertical strokes. It can be made either connected or disjoint by translation of the parts, as one wishes. It is easy to realize that any shape bounded by a finite number of horizontal and vertical strokes is a sum of finite number of rectangles.
Subtraction of arbitrary rectangles is a bit trickier. From the Archimedean postulate follows that if ℓ ℎ > ℓ− ℎ−, ℓ, ℎ, ℓ−, ℎ− ∈ (0, +∞), then ∃ℓ′, ℎ′ ∈ (0, +∞) such that ℓ′ ⊗ ℎ′ = ℓ ⊗ ℎ and ℓ′ ≥ ℓ− and ℎ′ ≥ ℎ−, that implies we can subtract ℓ− ⊗ ℎ− of ℓ′ ⊗ ℎ′ in a geometrically evident way, by carving it out. It also gives us a hint that ℝ ⊗ℚ  ℝ has a natural partial order with an epimorphism m: ℝ ⊗ℚ  ℝ →  ℝ of ordered abelian groups having the
b ≠ a ∧ b ≥ a ⇔ m(b) > m(a), ∀b, a ∈ ℝ ⊗ℚ  ℝ
property, but this reasoning does not constitute a rigorous proof, of course. "m" is, obviously, the area of a shape.
Now we know enough to claim that positive elements of ℝ ⊗ℚ  ℝ are the same as shapes on the Cartesian plane bounded by a finite number of horizontal and vertical strokes, up to reassembly (that means finite dissection, translation of parts, and joining again). The full proof remains as an exercise, but it is worth noting that, as a corollary, we have the fact that any positive element of ℝ ⊗ℚ  ℝ can be represented as a finite sum of only positive elementary tensors (i.e. rectangles).
A sketch of the proof follows, as an algorithm to add and subtract any finite number of rectangles, providing that total area of added rectangles surpasses the total area of subtracted ones.

*

*Add all rectangles with "+" signs.

*If there are no rectangles to subtract, then all done.

*Choose some rectangle ℓ− ⊗ ℎ− (with "−" sign).

*Reassemble (if needed) our shape to cover some ℓ− × ℎ− rectangle completely.

*Carve ℓ− ⊗ ℎ− from the shape.

*Go to Step 2.
The only remaining question is: what to do with (non-zero) elements of ℝ ⊗ℚ  ℝ that are neither positive nor negative? Due to the m(·) = 0 thing (see the partial order stuff above) the positive-area-shape-based interpretation fails for this interesting case.
Update: to handle both signs, one may consider a real vector space of all piecewise constant functions of a real variable with finite number of pieces and bounded support, and then make a quotient space by all one-dimensional translations (by the span of images of all Tx − I, x ∈ ℝ operators). In this setting ℓ ⊗ ℎ, ℓ > 0 is represented by a function that gives ℎ between 0 and ℓ (endpoints are not important) and is zero elsewhere. Vector space structure captures the right-hand "ℝ " in the tensor product, and "m" became Riemann integral.


text:
Q: Isn't it always possible that one can perturb the metric such that it has positive sectional curvature at a point? This is the famous theorem of Gromoll and Meyer:

Theorem (Gromoll-Meyer, 1974) There is an exotic 7-sphere with nonnegative
  sectional curvature and positive sectional curvature at a point.

I don't understand the second part of theorem "positive sectional curvature at a point". Isn't it always possible that one cane perturb the metric such that it has positive sectional curvature at a point and we have $\sec_{\min}(M)\leq \sec_q\leq \sec_p$ for all $q$ in a small neighborhoods of $p$?

A: The short answer is that you cannot necessarily perturb a metric to get positive sectional curvature while still maintaining non-negative/positive sectional curvature everywhere else.
My favorite example of this is due to Wilking

 Manifolds with positive sectional curvature almost everywhere, Inventiones mathematicae 148(1):117-141, 2002

He constructs a smooth Riemannian metric $g$ on $M:=\mathbb{R}P^2\times \mathbb{R}P^3$ with the following properties.
1)  It is non-negatively curved everywhere.
2)  If $U\subseteq M$ is the subset of all points $p$ for which every $2$-plane $\sigma \subseteq T_p M$ is positively curved, then $U$ has full measure in $M$
In other words, in the measure-theoretic sense, $M$ is positively curved almost everywhere (and non-negatively curved everywhere).
Note, however, that $M$ is non-orientable.  The classical Synge theorem says that in odd dimensions, a positively curved closed Riemannian manifold must be orientable.  Thus, the metric $g$ cannot be deformed to being positively curved everywhere, despite the fact that it started off with positive curvature almost everywhere.
Edit  Following Travis's suggestion, I'll move part of my comment below into the answer here.
Proposition.  Suppose $(M,g)$ is a Riemannian manifold and $p\in M$.  Let $p\in U\subseteq M$ be an open set diffeomorphic to a ball in $\mathbb{R}^n$  Then $g$ can be deformed to a metric $g_1$ for which all sectional curvatures are positive near $p$, but $g= g_1$ outside of $U$.
Proof:  Because $U$ is diffeomorphic to a ball, there is a diffeomorphism $f:U\rightarrow D^n_+\subseteq S^n$, where $D^n_+$ denotes the open northern hemisphere.  Let $g_0$ denote the canonical (positively curved) metric on $S^n$.
Choose an open set $V\subseteq U$ with $\overline{V}\subseteq U$ and let $\lambda:M\rightarrow \mathbb{R}$ be a bump function with $\lambda \equiv 1$ near $p$, and $\operatorname{supp} \lambda \subseteq \overline{V}$.
The family of metrics $(1-t)g + \lambda t f^\ast g_0$ has the required properties.

A:
Isn't it always possible that one can perturb the metric such that it has positive sectional curvature at a point and we have "$\sec_{\min}(M)\leq \sec_q\leq \sec_p$" for all $q$ in a small neighborhoods of $p$?

This statement isn't quite precise, since $\sec_a$ is not a scalar but rather a map $$Gr(2, T_a M) \to \Bbb R .$$ In the special case that $(M, g)$ is a surface (i.e., $\dim M = 2$), however, $Gr(2, T_a M)$ is the singleton set $\{T_a M\}$, so we may identify $\operatorname{sec}_a$ with a scalar and hence view $\operatorname{sec}$ as a function $M \to \Bbb R$, namely, the Gaussian curvature, $K$, and hence interpret the inequalities in the quotation in the usual way.
A standard partition-of-unity argument shows that for any smooth surface $(M, g)$ and point $p \in M$ one can deform $g$ to $g'$ in some neighborhood of $p$ so that for all $q$ in some (a priori possibly smaller) neighborhood we have $\inf K(g) \leq K'_q \leq K'_p$, where $K'$ is the Gaussian curvature of $g'$. (See Jason DeVito's good answer for details of this argument.)
This result, however, is manifestly local, and it does not guarantee the global conclusion that $K'_a \geq \inf K(M)$ for all $a \in M$.

Example Consider the flat torus $(S^1 \times S^1, g)$, for which $K \equiv 0$; in particular $g$ has nonnegative sectional curvature. We can perturb $g$ to produce a metric $g'$ with positive Gaussian curvature $K'_p$ at a point $p$. But the Gauss-Bonnet Theorem gives that
  $$\int_{S^1 \times S^1} K' \,dA = 2 \pi \chi(S^1 \times S^1) = 0.$$ By continuity $K'$ is positive in some neighborhood of $p$, which thus gives a positive contribution to the integral. To satisfy the above equality, $K'$ must also be negative on some open subset of $M$.

In short, the existence of a metric on a given manifold with nonnegative sectional curvature does not imply the existence of a metric on the same manifold with nonnegative sectional curvature at a point and positive sectional curvature at some point.


text:
Q: Why std::string methods working with std::string_view are required to convert their template argument to string_view in their body In std::basic_string methods like append which work with std::basic_string_view the standard basically requires 3 things (https://en.cppreference.com/w/cpp/string/basic_string/append):

template < class T >
   basic_string& append( const T& t );

*

*Implicitly converts t to a string view sv as if by std::basic_string_view<CharT, Traits> sv = t;

*then appends all characters from sv as if by append(sv.data(), sv.size()).

*This overload only participates in overload resolution if std::is_convertible_v<const T&, std::basic_string_view<CharT, Traits>> is true and std::is_convertible_v<const T&, const CharT*> is false.

What is the point of requirement 1 in presence of requirement 3? What would happen if requirement 1 was removed (like what code wouldn't compile/work as expected, etc)?
P.S. The origin of the requirements: https://cplusplus.github.io/LWG/lwg-defects.html#2758.
EDIT. Clarification of what exactly I don't understand.
So as it is now with requirements 1-3 the append implementation in MSVC does exactly 1-3:
    template <class _StringViewIsh, class = _Is_string_view_ish<_StringViewIsh>>
    basic_string& append(const _StringViewIsh& _Right) {
        const basic_string_view<_Elem, _Traits> _As_view = _Right;
        return append(_As_view.data(), _Convert_size<size_type>(_As_view.size()));
    }

Notice how the requirement 1 is implemented - very literally:
        const basic_string_view<_Elem, _Traits> _As_view = _Right;

So why the requirements in the standard weren't instead formulated as something like:

*

*Appends all characters from t as if by append(t.data(), t.size()).

*This overload only participates in overload resolution if std::is_convertible_v<const T&, std::basic_string_view<CharT, Traits>> is true and std::is_convertible_v<const T&, const CharT*> is false.

and the implementation then would become:
    template <class _StringViewIsh, class = _Is_string_view_ish<_StringViewIsh>>
    basic_string& append(const _StringViewIsh& _Right) {
        return append(_Right.data(), _Convert_size<size_type>(_Right.size()));
    }

and no longer would create absolutely unneeded local variable with a copy of its argument.

A: You are misreading cppreference (and the standard). Neither document spells out the "requirements" as you do. They both make a distinction between requirements (when the function participates in overload resolution) and behavior (what the function does when it gets executed). Your list conflates the two.
For example, your item 1 is part of the function's behavior; it says that the function shall convert t to a string_view. If you took out item 1, then the function wouldn't do that and therefore it would become non-functional.
The question you are probably asking is why not just have an overload that takes a string_view as a parameter instead of a template with a bunch of extra stuff in it?
The reason for this is outlined in what you linked to. Because assign and similar functions already have an overload that takes a const char*, passing a string literal directly would create an ambiguity between the const char* overload and the string_view overload, because both are implicitly convertible from a string literal.
The "this overload only participates in overload resolution if" bit is what prevents this ambiguity from occurring. This is why it explicitly says that T cannot be convertible to a const CharT*. But enacting such a prohibition requires that the parameter type the function takes is not a string_view; instead, it must be deduced at the point of call from the parameter type. So it has to be some template parameter type T, so that it's possible to implement the overload resolution requirement.
And that means that the function's implementation has to do the conversion to a string_view.

Appends all characters from t as if by append(t.data(), t.size()).

t may not a string_view; the requirement is only that t is convertible to a string_view. As such, t.data() may not be a function which t implements.
If you need an example of such a type, it would be any string type (other than basic_string) which is convertible to string_view (and not convertible to a const CharT*). And because string_view is such a useful lingua-franca string type, lots of user-created string types have been made convertible to string_view.

A: Part 3 is just saying that:

*

*the function won't even be called if the conversion to string_view is doomed to failure (e.g. a static_assert there would be really annoying; you want the compiler to try one of the other append overloads instead), and

*there's an exemption whereby the conversion to const CharT* doesn't count. Otherwise there would be an ambiguity with basic_string& append( const CharT* s );
In effect, it's describing a classic use case for enable_if.
This does not contradict part 1, nor is it redundant with part 1, because part 1 just says what will happen when the function is called. If part 1 were removed, nothing would happen, because part 1 describes what the function does.


text:
Q: Creating a dependent dropdown in yii i am trying this sample  about  Creating a dependent dropdown i created form in provinceCity/_form and copy actionDynamiccities to ProvinceCityController.php but when i change dropDown list i have not any change ?
i think i must to enable ajax but i do not how i do it?
<?php echo CHtml::dropDownList('country_id','', array(1=>'USA',2=>'France',3=>'Japan'),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('ProvinceController/dynamiccities'), //url to call.
//Style: CController::createUrl('ProvinceCity/methodToCall')
'update'=>'#city_id', //selector to update
//'data'=>'js:javascript statement'
//leave out the data key to pass all form values through
)));

//empty since it will be filled by the other dropdown
echo CHtml::dropDownList('city_id','', array()); ?>

A: Here is what you will do in _form
     <?php echo CHtml::dropDownList('country_id','', array(1=>'USA',2=>'France',3=>'Japan'),
    array(
    'ajax' => array(
    'type'=>'POST', //request type
    'url'=>CController::createUrl('ProvinceController/dynamiccities'), //url to call.
    'update'=>'#city_name', //selector to update
    'data'=>array('country_id' => 'js:this.value'),

    )));
        ?>

<?php echo $form->dropDownList($model, 'city_id', array()); ?>

Hopefully, it would help you.

A: It should be,
        <?php
        $countryAry=array(1=>'USA',2=>'France',3=>'Japan');
        echo CHtml::dropDownList('country_id','', $countryAry,
                array
                (
                    'ajax' => array
                    (
                        'type'=>'POST',
                        'url'=>CController::createUrl('Controller/action'),
                        'dataType'=>'JSON',
                        'success'=>'js:function(data)'
                        . '{'
                        . '     var opt="<option value=>-----Select city-----</option>";'
                        . '     $.each(data,function(i,obj)'
                        . '     {'
                        . '         opt+="<option value=\'"+obj.id+"\'>"+obj.name+"</option>";'
                        . '     });'
                        . '     $("#city_id").html(opt);'
                        . '}'
                    )
              ));

        echo CHtml::dropDownList('city_id','', array());
        ?>

But, I suggest you to implement this task as showing bellow.
        <?php
        $countryAry=array(1=>'USA',2=>'France',3=>'Japan');
        echo CHtml::dropDownList('country_id','', $countryAry,array('onchange'=>'js:getCities()'));
        echo CHtml::dropDownList('city_id','', array());
        ?>

A: I found the solution here Dependent dropdown list in yii
<?php
$model=new ModelClass; // initilize it in controller
$form=$this->beginWidget('CActiveForm', array(
'id'=>'dependent-form',
'enableClientValidation'=>true,
'htmlOptions' => array('enctype' => 'multipart/form-data','autocomplete'=>'off'),
'clientOptions'=>array(
    'validateOnSubmit'=>true,

)
));
?>

<?php
  echo $form->dropDownList($model,'country_id',
  CHtml::listData(Countries::model()->findAll(), 'id', 'title'),
  array(
    'prompt'=>'Select Country',
    'ajax' => array(
    'type'=>'POST',
    'url'=>Yii::app()->createUrl('YourController/loadstates'), //  get states list
    'update'=>'#ModelClass_state_id', // add the state dropdown id
  'data'=>array('country_id'=>'js:this.value'),
  )));
?>

<?php
  echo $form->dropDownList($model,'state_id',
  array(),
  array(
    'prompt'=>'Select State',
    'ajax' => array(
    'type'=>'POST',
    'url'=>Yii::app()->createUrl('YourController/loadcities'), //  get states list
    'update'=>'#ModelClass_city_id', // add the state dropdown id
  'data'=>array('state_id'=>'js:this.value'),
  )));
?>

<?php
  echo $form->dropDownList($model,'city_id',array(),array('empty'=>'-choose city-'));
?>

  <?php echo CHtml::submitButton($model->isNewRecord ? 'Add' : 'Update',array('class'=>'btn btn-primary')); ?>
<?php $this->endWidget(); ?>


text:
Q: How to Set a Selector Variable with Quotes and Double Quotes in CasperJS How must I set this selector variable to work in CasperJS (works in Chrome console)?
document.querySelectorAll('[data-product-unique-key="4_0_1"] [pf-aria-text="widgets.efgenericproduct.paymentaccount.Movements"]')[0]

Here is the test result:
FAIL Find an element matching: ('[data-product-unique-key="4_0_1"] [pf-aria-text="widgets.efgenericproduct.paymentaccount.Movements"]')[0]
#    type: assertExists
#    file: /home//dev/casperjs/ccm/scenarios/global.js
#    subject: false
#    selector: "('[data-product-unique-key=\"4_0_1\"] [pf-aria-text=\"widgets.efgenericproduct.paymentaccount.Movements\"]')[0]"

Here is my current code:
// I escape the doublequotes using backslash
var btnMovements = "('[data-product-unique-key=\"4_0_1\"] [pf-aria-text=\"widgets.efgenericproduct.paymentaccount.Movements\"]')[0]"
casper.csvexport = function() {
    casper.thenOpen('https://www.foobank.com/ap/ba/fp/html/e-finance/assets', function() {
        });
    casper.waitForSelector(
        btnMovements,
        function success() {
            this.test.assertExists(btnMovements);
            this.click(btnMovements);
        },
        function fail() {
            this.test.assertExists(btnMovements);
        }
    );
};

A: Your selector is incorrect:
var btnMovements = "('[data-product-unique-key=\"4_0_1\"] [pf-aria-text=\"widgets.efgenericproduct.paymentaccount.Movements\"]')[0]"

The correct selector should be:
var btnMovements = '[data-product-unique-key="4_0_1"] [pf-aria-text="widgets.efgenericproduct.paymentaccount.Movements"]';


text:
Q: Empty Dimension Shape "ValueError: Error when checking target: expected dense_2 to have 2 dimensions, but got array with shape ()" Im having an issue with creating my Keras CNN+LSTM model:

ValueError: Error when checking target: expected dense_2 to have 2
  dimensions, but got array with shape ()

I've removed some of the layers to test out the issue. But nothing changed.
Background:
Im trying to analyze 4D data: 3D image + 1D time series.
The way I'm working it is by adding 1 image at a time to be analyzed by my CNN+LSTM model. I've managed to get the dimensions correct and flow through the model. But then I'm hit with the error noted above.
# define CNN model
model = Sequential()

#Layer 1
model.add(TimeDistributed(Conv3D(32, kernel_size=(5, 5, 5), strides=(1, 1, 1),
                 activation='relu'),
                input_shape=input_shape))

model.add(TimeDistributed(MaxPooling3D(pool_size=(2, 2, 2), strides=(2, 2, 2))))

#Layer 2
model.add(TimeDistributed(Conv3D(64, (5, 5, 5), activation='relu')))
model.add(TimeDistributed(MaxPooling3D(pool_size=(2, 2, 2))))

#Layer 3
model.add(TimeDistributed(Conv3D(128, (5, 5, 5), activation='relu')))
model.add(TimeDistributed(MaxPooling3D(pool_size=(2, 2, 2))))

#Flatten
model.add(TimeDistributed(Flatten()))

# LSTM
model.add(LSTM(512, return_sequences=True))
model.add(LSTM(512))
model.add(Dense(1201))

#Dense
model.add(Dense(num_classes, activation='sigmoid'))

#Compile
model.compile(loss='categorical_crossentropy',
              optimizer='adam',
              metrics=['accuracy'])

model.summary()

train_gen = generate_images(train_dataset)
model.fit_generator(train_gen, samples_per_epoch=5, nb_epoch=10)

###################################################################

#Data Generator
def generate_images(dataframe):

    while True:
        sub_dataframe = dataframe.sample(n=1)
        batch_input = []
#         batch_output = []

#         for index, row in sub_dataframe.iterrows(): # iterate through each row

        input_path = os.path.join(base_directory, sub_dataframe['Image'].values[0])
        img = get_fmri_sequence(input_path)
        img = np.expand_dims(img, axis=-1)
        batch_input.append(img)

        batch_input = np.array(batch_input)
        yield (batch_input, sub_dataframe["DX"].values[0])

###################################################################

Here is the model summary:
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
time_distributed_1 (TimeDist (None, None, 43, 54, 45,  4032
_________________________________________________________________
time_distributed_2 (TimeDist (None, None, 21, 27, 22,  0
_________________________________________________________________
time_distributed_3 (TimeDist (None, None, 17, 23, 18,  256064
_________________________________________________________________
time_distributed_4 (TimeDist (None, None, 8, 11, 9, 64 0
_________________________________________________________________
time_distributed_5 (TimeDist (None, None, 4, 7, 5, 128 1024128
_________________________________________________________________
time_distributed_6 (TimeDist (None, None, 2, 3, 2, 128 0
_________________________________________________________________
time_distributed_7 (TimeDist (None, None, 1536)        0
_________________________________________________________________
lstm_1 (LSTM)                (None, None, 512)         4196352
_________________________________________________________________
lstm_2 (LSTM)                (None, 512)               2099200
_________________________________________________________________
dense_1 (Dense)              (None, 1201)              616113
_________________________________________________________________
dense_2 (Dense)              (None, 2)                 2404
=================================================================
Total params: 8,198,293
Trainable params: 8,198,293
Non-trainable params: 0
_________________________________________________________________


text:
Q: Detect display or loading of pnotify with a jquery selector I am writing an extension to an application which uses pnotify version 1.2.0. The core application creates a pnotfy alert and I want my code to react to the creation of that alert. This is a proprietary extension framework, it allows me to add my own JS and that JS is loaded after the main applications own JS is loaded. That extension model is relevant only in that it means I can't just do something sane like modify the original calling code; I have to react to secondary events.
I have tried doing this with jquery and the load event like this:
$('div.ui-pnotify-text').on('load', function() {
    console.log('detected pnotify creation, doing stuff...');
});

I have tried the following selectors:

*

*div.ui-pnotify-container

*div.ui-pnotify-text
These selectors work after the pnotify bubble pops up but the load event doesn't seem to fire. I suspect that either I am using the wrong selector or I have misunderstood the jQuery event model.
I also looked at the pnotify_remove_all method which shows that I can use $(window).data("pnotify") to get a list of all active pnotify objects. Like the selectors, this works in the browser console after everything has loaded but not from JS code.
How can I reliably detect the creation of a pnotify bubble using jquery?
If not jquery, is there some built-in pnotify mechanism I can use?

A: var notice = new PNotify({
     title: 'Mesaj',
     text: '<p>' + item.Message + '</p>',
     hide: false,
     width: '220px',
     addclass: "notice_" + item.Id,
     type: 'success'
});

When pnotify is active, you can access it with the code below. You can find the pop-up message by giving addclass a name to call yourself.
if ($(".notice_" + item.Id).length == 0) {
 ...
}

My English is not very good. I'm sorry. I hope I didn't get the problem wrong.

A: I did some additional experimenting. I simply don't think this is possible. Various combinations of the selectors for the pnotify elements and classes can find the elements but there is no event fired for load, show, or hide when they are rendered or made visible.


text:
Q: Get information of currently playing tracks other than music app in native app objective c I want to detect the currently playing song in my native app as ether is one audio session in app.
I implemented below and when song playing through phone music app, its working fine.
-(void)checksession
{
    BOOL isPlayingWithOthers = [[AVAudioSession sharedInstance] isOtherAudioPlaying];
    if(isPlayingWithOthers)
    {
        _controller = [MPMusicPlayerController systemMusicPlayer];
        [_play setEnabled:YES];
        [_pause setEnabled:YES];
        [_next setEnabled:YES];
        [_prev setEnabled:YES];
    }
}

But if the song is playing from another app like pandora app, then MPMusicPlayerController is not working.
Please suggest how can I control the next, prev, play , pause even if the song is being played via another apps rather than phone music app.
Any help would be highly appreciated!
Thanks in advance!

A: • You cannot control the playback of other apps from your own app unless something has drastically changed in iOS11.
• In that same vein, you cannot get info on anything playing unless it is using one of the built-in musicPlayers (systemMusicPlayer, and maybe applicationMusicPlayer)
I have not looked over the changes in iOS11 to see if this has changed.


text:
Q: NetLogo - Counting the number of turtles each turtle infects I have a disease model that follows SEI dynamics (Susceptible-Exposed-Infected). I would like to count the number of turtles each turtle infects in my model (16 turtles in total with a counter for each). I would also like it to reset for each turtle once the turtle becomes susceptible again (there is no death or immunity in this model so once turtles recover they become susceptible again). I have a turtle-owned variable called infection-counter in my code, but this seems to produce the number of successful transmission events rather than the number of turtles each turtle infects. How would I go about this?
Here is my disease procedure:
to spread
   let prob random-float 1.0
  ask turtles [
  ifelse infected? [] [
  if any? other turtles in-radius 1 with [ infected? ] and prob <= transmission-probability
  [ become-latent
    set latent-period-length random-exponential average-latent-period * ticks-per-day
    set latent-period-time 0
    set infection-counter infection-counter + 1

      ]
    ]
  ]

  ask turtles [
    if latent-period-time > latent-period-length ;if latent period counter is greater than exponentially derived latent period with avg of 30 days, become infected
    [
     become-infected
     set infectious-period-length random-exponential average-infectious-period * ticks-per-day
     set infectious-period-time 0
     set latent-period-time 0

          ]
  ]

  ask turtles [
       if infectious-period-time > infectious-period-length ;infectious-period is a slider variable set to 100
    [
      become-susceptible
      set infectious-period-time 0
      set infection-counter 0

    ]
  ]

 ask turtles [
   if latent?
    [
      set latent-period-time latent-period-time + 1 ]
if infected?
     [
            set infectious-period-time infectious-period-time + 1]
  ]

end

Thanks!


text:
Q: Invalid option in build() call: "watch" I am following the example as it is described here:
https://bilalbudhani.com/chokidar-esbuild/
When I do:
node esbuild.config.js --watch

I get the message:
[ERROR] Invalid option in build() call: "watch"

I have no idea why this is happening.
Is "watch" not longer a parameter?
I also did this example:
const path = require('path')

require("esbuild").build({
  entryPoints: ["application.js", "client.js"],
  bundle: true,
  sourcemap: true,
  outdir: path.join(process.cwd(), "app/assets/builds"),
  absWorkingDir: path.join(process.cwd(), "app/javascript"),
  minify: true,
  watch: true,
})
.then(() => console.log("⚡Done"))
.catch(() => process.exit(1));

If i remove the line "watch:true", it compiles ok. But if I leave it, I get the same error:
Invalid option in build() call: "watch"
when I do: node esbuild.config.js
Thank you in advance

A: Summing up from the comments:
esbuild <v0.16 has removed the watch option. Most tutorials and HowTos are pointing to that version. Downgrade your esbuild to that if you want to use it like described there.
Better option is to use esbuild >0.16 which has a built in live reload which combines watch and serve using the newly introduced context


text:
Q: MATLAB startup.m ignores cd? in my startup.m-file I call a script init.m. In this init file I determine the folder containing this file, want to set the current directory to this folder and continue with some other initialization stuff.
But when I start Matlab, the file will be executed, but the cd command seems to be ignored and the directory won't get changed. Does somebody know why? I.e. the matlabpath variable is extended by the subfolders....
startup.m:
run 'D:\FloatingZone\mscrystalgrowth\trunk\MATLAB\FzKameradaten\FzCameraEvaluation\init.m';

init.m
% get path to folder containing this function
folder=mfilename('fullpath');
file=mfilename();
folder=folder(1:end-length(file));
% change folder
cd(folder);
% add subfolder to the top of the MATLAB path
addpath(genpath('Tools'));

A: MATLAB did exactly what you told it; there's nothing special about the startup scripts.
From the documentation for the run command:

run changes to the folder that contains the script, executes it, and resets back to the original folder. If the script itself changes folders, then run does not revert to the original folder, unless scriptname changes to the folder in which this script resides.

So your cd command didn't actually do anything, run had already changed the directory.  And then changed it back, exactly as expected.

A: I'm not 100% clear on what you want your startup to do.  As already pointed out run is working correctly.
Alternative startup.m
if isdeployed == false
  cd 'D:\FloatingZone\mscrystalgrowth\trunk\MATLAB\FzKameradaten\FzCameraEvaluation\'
  init();
end

function init.m stored in your FzCameraEvaluation\ folder.
function init
  addpath ( genpath ( '../Tools' ) );
end

Does that work?


text:
Q: How to add a relative path to the database in Qt In my project I have a database, eg Data.db. Using it in my code, I give a constant path / home / adam / cpp / etc .. I would like to use a relative path, how can I do this? in the .pro file? resources?
code:
bool LoginWindow::loginConnect()
{
    loginDatabase = QSqlDatabase::addDatabase("QSQLITE");
    loginDatabase.setDatabaseName("/home/jarek/ProjectInQt/BankManagment-Qt/BankManagment/sql/Login.db");
    return loginDatabase.open() ? true : false;
}

I want relative path to Login.db


text:
Q: Something is already running on port I am a fairly new developer and have come across a problem with ports. I am using mern stack and in my json file I have set the port to many different port numbers and it says something is running in all of them. I recently switched from google chrome to firefox and feel this could possibly be related. If I try to push yes on requesting a different port the page never loads. every time I run npm start the port is taken. Thank you

A: An easy workaround whenever you get a "port in use" message while developing node type of projects such as MERN type of stacks, the solution is to run a different port. So if you were on localhost:3000, change it to localhost:3001.

A: Try stopping the running node process. Maybe a process using that port hasn't stopped.
Use Task manager (Windows) / Activity monitor (MacOs)


text:
Q: vim, open file with vertical split in different lines In vim, you can open a file with the cursor in particular line
Example: open file.txt with the cursor over the line 10
vim file.txt +10

With -O you can open the same file with vertical split
vim -O file.txt file.txt

How can I open the same file with a vertical split and with the cursor over specific lines?
something like
vim -O file.txt +10 file.txt +20

A: Please use following command vim +20 file.txt +"vsplit +10 file.txt"
Switch window with CTRL+w l (CTRL+w h)


text:
Q: SQL 2008 Linked Server Connection Does a linked server connection on SQL Server 2008 get shared between connections to the SQL Server?  I am wondering this because I have a SQL Server 2008 with a linked Sybase server. If I open up Management Studio and connect to the SQL Server and execute the following
exec('select id into #tempTable from test') AT LINKEDSERVER

And then open up another window in Management Studio and execute the statement again I get a table already exists. The same things also seems to be happening if I execute it through code and then try it through Management Studio.
Is the linked server connection being shared between different connections to the SQL Server or is something else going on?

A: I confess my experience with Sybase is pretty limited, but does it use the OLE DB provider for the linked server? If so, yes you should be getting connection pooling as OLE DB provides connection pooling.

A: It appears that this was a connection pooling issue.  It wasn't that the connection between the linked server and SQL Server was getting reused, it was that the connections to the SQL Server were getting reused because of connection pooling.


text:
Q: Como reformular UI do radio e checkbox? Estou utilizando radio e checkbox customizados do bootstrap, percebi que alguns clientes tiveram dificuldades em assimilar que eram checkbox ou radios e que deveriam realizar a ação de selecionados.
Exemplo:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">

Não sei se todos estão ativados ou desativados

      <input type="checkbox" autocomplete="off" checked>Android

      <input type="checkbox" autocomplete="off">Windows

      <input type="checkbox" autocomplete="off">iOS

Não sei se esta selecionado dois e um não esta  selecionado

      <input type="radio" name="options" id="option1" autocomplete="off" checked>Android

      <input type="radio" name="options" id="option2" autocomplete="off">Windows

      <input type="radio" name="options" id="option3" autocomplete="off">iOS

Conforme o exemplo acima, as vezes o usuário se enrola e acaba realizando uma ação equivocada, como eu poderia deixar mais intuitivo reaproveitando as classes do bootstrap?

A: Se analisarmos a semântica dos nomes "check-box" e "radio-button" veremos o seguinte:

*

*Check-box. Do inglês caixa (box) de seleção/marcação (check). A ideia tradicional desse tipo de componente é que ele é literalmente uma caixa (um quadrado) que pode ser riscado/marcado para indicar a seleção de um item.

*Radio-button. Do inglês botão (button) radial (radio). A palavra "radial" talvez seja pouco conhecida, mas tem a mesma raíz de "dial" (em inglês, do botão do rádio) e no dicionário consta como "relativa a raio". Significa algo que circula, ou que leva de um ponto a outro atravessando algo (você já ouviu a falar da Avenida Radial Leste aqui em São Paulo?). O componente tem esse nome porque, apesar de também permitir a seleção de itens, os itens são mutuamente exclusivos, de forma que ao se selecionar um novo item automaticamente se desfaz uma seleção prévia. De fato, o nome vem de rádio, pois antigamente os rádios automotivos tinham botões físicos para sintonização, e ao pressionar um deles o anterior pressionado era liberado.

Convencionalmente, esses componentes têm sido projetados para terem em seu design um quadrado no caso do check-box e um círculo no caso do radio-button, que são ambos preenchidos ou não para indicar o estado de selecionado/não-selecionado. A interface que você utiliza na pergunta é uma adaptação mais moderna que permite indicar o estado de seleção por meio de distinção de cores e a "radialidade" (será que eu inventei uma palavra nova?) por meio da unicidade da cor de seleção entre todos os itens.
Mas ela tem alguns problemas (ao menos nessa implementação). Primeiramente, há um baixíssimo contraste de cores entre os estados selecionado/não-selecionado, que seria particularmente grave em ambientes com mais baixa luminosidade (algo relativamente comum para usuários de dispositivos móveis). Eles também não usam a convenção já amplamente estabelecida na interação humano-computador (quadrado é para marcação individual, círculo para seleção em grupo), fazendo com que os usários tenham que reaprender a convenção utilizada.
Entretanto, o problema mais relevante é que esses componentes não contêm indicações sensoriais (affordances) sobre o que fazem e/ou como podem ser utilizados. Em um sistema computacional tradicional, em que se utiliza o mouse, o clique é a affordance mais comum. A primeira coisa que um usuários em dúvida vai fazer é tentar clicar num objeto. De forma similar, em um sistema computacional móvel, a affordance mais direta é o toque com os dedos, e a primeira coisa a ser feita vai ser tentar tocar sobre o objeto. Eventualmente o usuário vai aprender como ele funciona interagindo, mas um quadrado ou círculo vazio tem uma affordance visual que já indica que ele possa talvez ser preenchido. Falta esse tipo de affordance nos objetos, e por isso os usuários têm a dificuldade inicial de diferenciá-los de meros botões.
Uma solução para esse problema em particular seria adicionar uma área vazia, que dê a percepção de que ela possa ser preenchida, ou mesmo apenas usar uma simbologia de marcação (o tradicional rabisco de check-list) para inicar que o item está de fato selecionado.
Você pode, por exemplo, usar o pseudo elemento :after para incluir algum desses símbolos que lembrem uma "marca", como por exemplo: ✅. Aumentar o contraste da cor entre as opções marcadas e desmarcadas também é importante, pois as destacaria em muitos dos casos (e, principalmente, em relação a usuários daltônicos). Exemplo de implementação:

.btn        { background: #ccc !important; border: none !important }
.btn.active { background: #40d47e !important }
.btn.active:after { content: '✅'; color: #333 }

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">

Não sei se todos estão ativados ou desativados

      <input type="checkbox" autocomplete="off" checked>Android

      <input type="checkbox" autocomplete="off">Windows

      <input type="checkbox" autocomplete="off">iOS

Não sei se esta selecionado dois e um não esta  selecionado

      <input type="radio" name="options" id="option1" autocomplete="off" checked>Android

      <input type="radio" name="options" id="option2" autocomplete="off">Windows

      <input type="radio" name="options" id="option3" autocomplete="off">iOS

Ainda assim, seria importante diferenciar visualmente o componente que permite uma marca individual (o check-box) daquele que permite múltimas marcas. Poder-se-ia deixar a cargo do usuário descobrir isso interagindo (o que não costuma ser um problema grave, uma vez que a escolha comumente não é tomada imediatamente), mas uma indicação qualquer é útil.
Uma alternativa é fazer com que os botões selecionados também se afundem, e no radio-button ter sempre um deles inicialmente selecionado (isto é, afundado). Essa mesma alternativa pode ser implementada só com a marca, fazendo sempre uma já começar selecionada. Intuitivamente o usuário vai perceber a diferença porque o check-box com vários itens pode começar com todos deselecionados e o radio-button não. Ou você pode, se tiver habilidades para desenho, alterar a forma dos botões para fazê-los ficarem diferenciados (mais circulares, por exemplo) e assim estabelecer uma convenção própria.


text:
Q: how to parse a string in iphone, objective c? I have a string in this format :- { panel : {start : [{"element_id" : 0, "element_name" :0, "element_image" : 0, "element_desc" : 0, "element_dob" : 0, "awards" :0},]} how can I parse this string. please help me to overcome this problem. I tried SBJSon - code: -
NSLog(@"response string before = %@", responseStr);
NSData *fileData = [NSData dataWithContentsOfFile:responseStr];
NSString *responseString = [[NSString alloc] initWithData:fileData encoding:NSUTF8StringEncoding];
NSLog(@"response string after = %@", responseString);
NSError *jsonError = nil;
NSDictionary *feed = nil;
    SBJsonParser *json = [[SBJsonParser new] autorelease];
feed = [json objectWithString:responseString error:&jsonError];
NSLog(@"feed = %@", feed);
if ([jsonError code]==0) {
    // get the array of "results" from the feed and cast to NSArray
    NSMutableArray *localObjects = [[[NSMutableArray alloc] init] autorelease];
    NSArray *results= (NSArray *)[feed valueForKey:@"start"];

    // loop over all the results objects and print their names
    int ndx;

    for (ndx = 0; ndx < results.count; ndx++)
    {
        [localObjects addObject:(NSDictionary *)[results objectAtIndex:ndx]];
    }
    NSLog(@"local objects = %@", localObjects);
}

the NSDictionary feed is getting nil value in NSLog..

A: Try the following one...
    SBJSON *json = [[SBJSON new] autorelease];
    NSDictionary *dictResponse = (NSDictionary*) [json objectWithString:sitesResponse error:nil];

A: You can use Regular Expressions (wiki). Take sources from: RegexKit, add to linker flags "-fopenmp" and use in NSString message "stringByMatching".

For example, if you want take "element_name":
NSString* str = [your_string stringByMatching:@"element_name\".*:(.*?)," capture: 1L];


text:
Q: Find the points of continuity Take a function defined by
\begin{cases}
0 & x\in \mathbb{R} \smallsetminus \mathbb{Q}\\
\sin|x| & x\in\mathbb{Q}
\end{cases}
Find the points of continuity.
By solving $\sin|x|=0$, I get $x=n\pi$, where $n\in \Bbb N $,
  but $\pi$ is irrational.
So how do I find the points of continuity?

A: Note that points of continuity exists when the limit at the $x$-value exists and  a point is defined on that $x$-value.
So inorder for
\begin{cases}
0 & x\in \mathbb{R}\setminus\mathbb{Q}\\
\sin|x| & x\in\mathbb{Q}
\end{cases}
to have continuous points at $x=n\pi$, $\underset{x\in\mathbb{R/Q}}{\lim\limits_{x\to n\pi}}0=\underset{x\in\mathbb{Q}}{\lim\limits_{x\to n\pi}}\sin|x|$
and $\sin|n\pi|=0$
In real analysis textbooks a limit that is restricted to a subset of $\mathbb{R}$ may exist as long as the subset is dense in $\mathbb{R}$. This is because such a subset can "closely approximate any real value"
or in formal terms every real number is a limit point of that subset. Hence you must prove that $\mathbb{Q}$ and $\mathbb{R}\setminus\mathbb{Q}$ are dense in $\mathbb{R}$.
Then we can say
$$\underset{x\in\mathbb{R\setminus Q}}{\lim\limits_{x\to n\pi}}0=\underset{x\in\mathbb{R}}{\lim\limits_{x\to n\pi}}0=0$$
and
$$\underset{x\in\mathbb{ Q}}{\lim\limits_{x\to n\pi}}\sin|x|=\underset{x\in\mathbb{R}}{\lim\limits_{x\to n\pi}}\sin|x|=0$$
Hence
$$\underset{x\in\mathbb{R \setminus Q}}{\lim\limits_{x\to n\pi}} 0 = \underset{x\in\mathbb{Q}}{\lim_{x\to n\pi}} \sin|x|$$
Finally since $\sin(n\pi)=0$ we know that all continous points are at $x=n\pi$.


text:
Q: Cartopy aliasing I have the following issue:
When I transform from one map projection to another using Cartopy, the output picture displays a quite ugly aliasing with "steps" larger than one pixel. I attach the input and output pictures as example.
Input - PlateCarree:

Output - Transformed:

Could anyone explain me why that happens? Is it possible to correct it?


text:
Q: Horizontal Tree Diagram with nodes on left and right I am trying to draw a tree horizontal tree diagram with one node's level, this tree has 13 nodes so I want to make use of the space by spanning nodes on both sides (left and right) instead of the current view.
\usepackage{tikz}
\usetikzlibrary{trees,positioning,shapes,shadows,arrows}
\begin{figure}
    \centering
    \begin{tikzpicture}[
every node/.style = {draw, rounded corners, fill=red!30,
    text width=18mm, minimum height=9mm, align=center,
    drop shadow},
             grow = right,
growth parent anchor=east,
level distance = 27mm,
sibling distance=10mm,
edge from parent path=(\tikzparentnode.east) -- (\tikzchildnode.west)
                        ]

% root of the the initial tree, level 1
\node[root] {\textbf{\textarabic{البرمجة كائنية التوجه}}}
% The first level, as children of the initial tree
  child {node[level-2] (c1) {\textbf{OOP}}}
  child {node[level-2] (c2) {\textbf{\textarabic{برمجة كائنية}}}}
  child {node[level-2] (c3) {\textbf{\textarabic{البرمجة كائنية التوجيه}}}}
  child {node[level-2] (c4) {\textbf{\textarabic{برمجة كانئية المنحى}}}}
  child {node[level-2] (c5) {\textbf{\textarabic{البرمجة كائنية التوجه}}}}
  child {node[level-2] (c6) {\textbf{\textarabic{برمجة كائنات موجهة}}}}
  child {node[level-2] (c7) {\textbf{\textarabic{شيئية المنحى}}}}
  child {node[level-2] (c8) {\textbf{\textarabic{برمجة كانئية المنحنى}}}}
  child {node[level-2] (c9) {\textbf{\textarabic{البرمجة الشيئية}}}}
  child {node[level-2] (c10) {\textbf{\textarabic{برمجه كائنيه التوجه}}}}
  child {node[level-2] (c11) {\textbf{\textarabic{برمجة غرضية التوجه}}}}
  child {node[level-2] (c12) {\textbf{\textarabic{برمجة موجهة}}}}
  child {node[level-2] (c13) {\textbf{\textarabic{برمجة شيئية}}}};
\end{tikzpicture}
    \caption{Aliases for Object-Oriented Programming \href{https://www.wikidata.org/wiki/Q79872}{Q79872} in Wikidata in the Arabic language.}
    \label{ne_aliasies}
\end{figure}

The output view of the above code is:

What I want is something like this:

A: Here's what is the closest to what you expect, imho, using your original design, but with a bit of cleaning. Feel free to adapt it to your very needs.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{trees,positioning,shapes,shadows,arrows.meta}

\begin{document}

    \begin{tikzpicture}[
        every node/.style = {
            draw,
            rounded corners,
            fill=red!30,
            text width=18mm,
            minimum height=9mm,
            align=center,
            drop shadow},
        >=Stealth,
        level distance = 30mm,
        sibling distance=13mm]

        \begin{scope}[grow'=right,edge from parent fork right,->]
            \node (root) at (0,0) {}
                child  {node (b1) {B1}}
                child  {node (b2) {B2}}
                child  {node (b3) {B3}};
         \end{scope}
         \begin{scope}[grow=left,edge from parent fork left,->]
            \node (root) at (0,0) {ROOT}
                child  {node (a1) {A1}}
                child  {node (a2) {A2}}
                child  {node (a3) {A3}};
             \end{scope}
    \end{tikzpicture}
\end{document}


text:
Q: Move the onscreen circle when camera moves I have a script that accesses my webcam and displays the captured video on the screen. I can also very easily draw a circle (a rectangle, it doesn't matter) over the video.
When I move the camera physically, the video also "moves". My webcam is attached to the top left corner of my monitor. So when I slide the camera across the monitor to the right, the video itself, and so all obejcts in it move left.
But, it's obvious, that the drawn circle stays unmoved.
Now I want the circle be moved when the camera moves.
G1.  When the circle contains an object (as in pic1), the goal can be reached using the object tracking algorithms. (I am working with python and using openCV lib, and there are several builtin algorithms (Boosting, MedianFlow, MIL), also the meanshift algorithm, etc.)
G2. There can be cases, when the circle doesn't contain an object (doesn't have any underlying object, as in pic2). In these cases the object tracking algorithms don't work.
I hope I managed to explain the problem. Now I have 2 questions:
Q1. Is there a better way to achieve the Goal1?
Q2. How can I achieve the Goal2? (Maybe there is a way to determine that the video and objects (the wall watch in pic2) moved left, and move the circle proportionally.)
Any help would be appreciated.
P. S.
I'm new to Stack Exchange platform, so if the current topic isn't the right place for my question (problem), please tell me where should I post it.

A: Thanks everyone for replying!
After researching, I found a better solution for G1, and so an answer to Q1.
Now I use Lucas-Kanade method (optical flow estimation method) for object tracking. I just need to mention a point inside the object (for example one can draw a very small circle), and it sticks to that object, that is the circle moves with the object. One of the advantages of this method is the performance. This method is much more faster than the object tracking algorithms, that were mentioned in the question. And if needed, the circle size can be changed, so it can be like the circle in pic1, because only the center point is important.
This method also helps in the 2-nd case, so if I mention a point on the white wall, it works better than the object tracking algorithms, and not only when comparing performance, but also when comparing the result. When using Lucas-Kanade method the result is more accurate, the circle stays closer to the selected point, than in case of object tracking algorithms. But this method doesn't completely solve the problem (G2), because very often the circle doesn't stick to the selected point on the wall, and jumps to other points. However, this is the best result I've achieved for now.

A: You can combine G1 and G2 into one algorithm:

*

*Create a map of objects in the view / image (coordinates, sizes...): clock, orchid, books, wallpapers...

*Draw the circle (rectangle, whatever) relative to some of the objects in the image:

*

*exactly around the clock;

*XY pixels above the orchid;

*(use your imagination :) )

What is not clear to me (and not really relevant for the answer) is how you decide the initial position of the circle. Do you use an algorithm with some criteria, or just place it by hand?

A: Without any references (known objects/markers) this is virtually impossible. It would be expensive for sure. You would have to scan the whole image and pick some distinct areas as references. Then follow these around. You will lose some over time because of changing light conditions, orientation, zoom or simply because they moved out of the frame. Then you will need new ones. So with each iteration you will have to do a fresh scan for orientation items and use them for as long as they work, perhaps matching "new" items with lost ones that probably just look a bit different this time around, updating properties on each iteration. The combination of tracking data for the different reference items will have to provide confidence. It is going to be "fuzzy".


text:
Q: Extract rows between two specific cells pandas I need to extract n rows between the cells epic and story from the column col2.
This is my input:
import pandas as pd
df = pd.DataFrame({'col1': ['aze ', 'az a', 'az a', 'azs abv','aze ', 'az a', 'azs abv', 'abc 45','wqas', 'foo bar abc', 'foo abv', 'abc 45', 'abc 45'], 'col2': ['epic', 'ac4', 'ac5', 'story','story', 'ac10', 'ac6', 'epic','ac11', 'ac1', 'ac2', 'ac3', 'story'], 'col3': ['hey', 'hello', 'hola', 'yoopy','hawdi', 'yiiha', 'yow', 'yalla', 'yiiha', 'yow', 'yalla', 'yalla', 'yalla']})
print(df)

           col1   col2   col3
0          aze    epic    hey
1          az a    ac4  hello
2          az a    ac5   hola
3       azs abv  story  yoopy
4          aze   story  hawdi
5          az a   ac10  yiiha
6       azs abv    ac6    yow
7        abc 45   epic  yalla
8          wqas   ac11  yiiha
9   foo bar abc    ac1    yow
10      foo abv    ac2  yalla
11       abc 45    ac3  yalla
12       abc 45  story  yalla

and this is the desired output :
          col1    col2    col3
0         az a     ac4    hello
1         az a     ac5    hola
2         wqas     ac11   yiiha
3   foo bar abc    ac1    yow
4       foo abv    ac2    yalla
5        abc 45    ac3    yalla

the solution proposed by @ansev gave me this output instead:
       col1   col2   col3
0     az a    ac4  hello
1     az a    ac5   hola
2     aze   story  hawdi
3     az a   ac10  yiiha
4  azs abv    ac6    yow
5   abc 45  story  yalla

A: IIUC,boolean indexing with Series.mod
to detect the change from epic to story after setting all values to False before the first epic.
epic = df['col2'].eq('epic')
story = df['col2'].eq('story')
df.loc[(epic | story).where(epic.cumsum().ge(1), False)
                     .cumsum()
                     .mod(2)
                     .eq(1)
                     .where(~epic, False)].reset_index(drop=True)

Output
      col1 col2   col3
0     az a   ac  hello
1  azs abv   ac   hola


text:
Q: hostedZone ID doesn't match when using custom domain for api gateway I'm using CDK to deploy aws api gateway.
The created api gateway looks like blow, and it's mapped to hosted zone Z1UJRXOUMOOFQ8:

My Route 53 hosted zone is this, and it only has one hosted zone Z07841403UX33F69270EK:

My questions are:

*

*Why are these two hosted zone ID not match? I'm expecting the API gateway hosted
zone ID to be the same as the hosted zone ID shown in Route 53, and I
have no idea where does API gateway hosted zone ID come from as I only have one
hosted zone in this AWS account's Route 53.

*The API gateway domain name shown in the first picture
d-mtr****.execute-api.us-east-1.amazonaws.com doesn't match the
created API gateway
https://mmz****.execute-api.us-east-1.amazonaws.com/prod/ which is
outputed during CDK deployment.

Code
Dependencies in package.json:
  "dependencies": {
    "@aws-cdk/aws-apigatewayv2": "^1.180.0",
    "@aws-cdk/aws-apigatewayv2-alpha": "^2.50.0-alpha.0",
    "@aws-cdk/aws-apigatewayv2-integrations": "^1.180.0",
    "@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.50.0-alpha.0",
    "aws-cdk-lib": "^2.46.0",
    "constructs": "^10.1.156",
    "source-map-support": "^0.5.21"
  }

API Gateway Stack:

import * as CDK from "aws-cdk-lib";

import * as CertificateManager from "aws-cdk-lib/aws-certificatemanager";
import * as Route53 from "aws-cdk-lib/aws-route53";
import * as Route53Targets from "aws-cdk-lib/aws-route53-targets";
import * as ApiGateway from "aws-cdk-lib/aws-apigateway";

import * as ELBv2 from "aws-cdk-lib/aws-elasticloadbalancingv2";
import { Construct } from "constructs";
import { ALPHA, StageInfo } from "../config/stage-config";
import * as Cognito from "aws-cdk-lib/aws-cognito";

export class ApigatewayStack extends CDK.Stack {
  // Prefix for CDK constrcut ID
  private readonly constructIdPrefix: string;
  private readonly domainCertificate: CertificateManager.Certificate;
  private readonly businessAccountAuthorizer: ApiGateway.CfnAuthorizer;
  public readonly restApi: ApiGateway.RestApi;
  constructor(scope: Construct, id: string, props: ApigatewayStackProps) {
    super(scope, id, props);

    this.constructIdPrefix = `${props.packageName}-${props.stageInfo.stageName}`;

    const hostedZone: Route53.IHostedZone = Route53.HostedZone.fromLookup(
      this,
      `${this.constructIdPrefix}-HostedZoneLookup`,
      {
        domainName: props.stageInfo.domainName,
      }
    );

    this.domainCertificate = new CertificateManager.Certificate(
      this,
      `${this.constructIdPrefix}-restApiCertificate`,
      {
        certificateName: "certificateForRestApi",
        domainName: props.stageInfo.domainName,
        validation: CertificateManager.CertificateValidation.fromDns(hostedZone),
      }
    );

    this.restApi = new ApiGateway.RestApi(
      this,
      `${this.constructIdPrefix}-restApi`,
      {
        restApiName: "restApi",
        description: "The centralized API for example.com",
        domainName: {
          domainName: props.stageInfo.domainName,
          certificate: this.domainCertificate,
          //mappingKey: props.pipelineStageInfo.stageName
        },

        defaultCorsPreflightOptions: {
          allowOrigins: ApiGateway.Cors.ALL_ORIGINS,
          allowMethods: ApiGateway.Cors.ALL_METHODS
        },
      }
    );

    new Route53.ARecord(this, "AliasRecordForRestApi", {
      recordName: "AliasRecordForRestApi",
      deleteExisting: true, // delete existing one instead of doing it manually later
      zone: hostedZone,
      target: Route53.RecordTarget.fromAlias(
        new Route53Targets.ApiGateway(this.restApi)
      ),
      // or - route53.RecordTarget.fromAlias(new alias.ApiGatewayDomain(domainName)),
    });

   // Irrelevant code is hiden
}

Update
I made a stupid mistake, the record name above should be the domain name. I thought it was just a name for the Route53 record, as sometimes you can give a name to an AWS resource just to distinguish it from others.
Changing it to domain name then the whole thing works.
Now the only thing I still don't know is why the hosted zone id in the first screenshot can not be found in my Route 53.

A: That's the hosted zone that the d-mtr****.execute-api.us-east-1.amazonaws.com is located in.
You would use that to make an ALIAS record in route 53, which takes a hostname and a target zone, and this will save 1 DNS lookup compared to a CNAME
If your domain is example.com, you'd add a record myapihostname.example.com ALIAS d-mtr****.execute-api.us-east-1.amazonaws.com and refer to the zone that you're targeting.


text:
Q: How to use SSR data fetching in nextjs with apollo client? I am try to use apollo-client with nextjs. Here I want to fetch data in getServerSideProps. Suppose I have 2 components and one page-
section.tsx this is component-1
const Section = () => {
    return (

            Section

    );
};
export default Section;

mobile.tsx this is component 2
const Mobile = () => {
    return (

            Mobile

    );
};
export default Mobile;

Now I call this two component into home page.
index.tsx-
const Home: NextPage = () => {
  return (
    <Container disableGutters maxWidth="xxl">

      <Mobile />
    </Container>
  );
};
export default Home;

export const getServerSideProps: GetServerSideProps = async () => {
  const { data } = await client.query({ query: GET_USER_LIST })
  return { props: {} }
}

Here you can see that in getServerSideProps I already fetch my data.
My question is How can I directly access this data form Section component and Mobile component without passing props. I don't want to pass props, because if my component tree will be more longer, then it will be difficult to manage props.
From appollo docs, I alreay know that apollo client do the same with redux state manager. So please tell me how can I access this data from any component that already fetched in getServerSideProps. Is it possible?. If not then how can what is the solutions.

A: How about using context api if you want to avoid prop drilling? By putting data into context, you can access it from any child component. Get the data from the SSR and put it into the context.
Below is the example
import React, {createContext, useContext} from "react";

export default function Home({data}) {
    return <DataContext.Provider value={{data}}>

            <Mobile/>

    </DataContext.Provider>
}

export async function getServerSideProps() {
    const data = 'hello world' //Get from api
    return {
        props: {data},
    }
}

function Section() {
    return

        Section

}

function Mobile() {
    const context = useContext(DataContext);
    return

        Mobile {context.data}

}

const DataContext = createContext({});

Now, as long as your tree structure grows within the DataContext provider, each child node will have access to data in the context.
Hope this helps.


text:
Q: Cooling efficiency of different fliuds? In Oxygen Not Included, what parameters are important when using a gas or liquid, pumped in a loop between the area you're trying to cool and the area you're trying to dump the heat (e.g. the cold biome)?  Are some fluids unambiguously better for this task than others?
I've seen several youtubers say that hydrogen is good for cooling - is that accurate, and if so what is the math behind it?  Hydrogen's low specific heat capacity means that when you pipe it through the cold area, it gets much cooler than, say, oxygen.  But I would expect that the effect is symmetric, and even though the hydrogen is colder when it gets to your base, it will also warm up faster and thus will not remove any more heat than if you used oxygen.
I've also seen oil used as the cooling medium.  The wiki mentions that oil did not used to be freezable so it was used as a cooling medium, but now that it has a freezing point, does it provide any advantage over, say, water?

A: Hydrogen has one of the highest Specific Heat Capacities for a gas.

I think this table is up-to-date, listing hydrogen with the highest SHC at 2.4, and a higher thermal conductivity, meaning it can exchange heat faster.
If you want to use liquids, check out this one:

However, I believe polluted water will have the same SHC as water in the next patch (rocketry). Polluted water may still be your best bet with high SHC and lower freezing point.
The high SHC of hydrogen is also useful for cooling with wheezeworts, as they cool a gas a certain number of degrees, so hydrogen will get more effective J of cooling per puff.


text:
Q: What is the role of crossover in genetic algorithms? I'm not entirely familiar with all the terminology, so please excuse any errors on that part. I decided to write a program that uses an evolutionary (?) algorithm to go from a random string of characters to a target string.
It works fine, but I noticed something that I don't understand. If I use 'asexual' reproduction, i.e. each string clones itself and then mutates with some probability, the convergence to the solution is much slower, and sometimes doesn't converge at all, but gets trapped, at say an average fitness of ~0.8. This doesn't make sense to me, since the mutation should make it trend towards the optimum, right?
However, if I instead use crossover, e.g. I pick two parents and do a uniform mix of characters and then like normal mutate the child with some probability the convergence is not only practically guaranteed, it is also orders of magnitude faster. I don't think this can explained solely by the fact that the child gets to "mutate more" since both its parents are also mutated in the previous generation.
Could someone please explain the role of crossover, and why it allows for much faster convergence in algorithms such as these?

A: The role of crossover in genetic algorithms is to spread the beneficial mutations of population members that let them achieve a high fitness value to more members of the population.
The key is that only the fit members of the population crossover with each other and thereby spread beneficial mutations to more members of the population with the intent that the offespring (/new members) might also benefit from the mutation of the parent. Thereby crossover leads to a spreading of mutations that lead to a higher fitness value spread throughout the population - leading to your observed faster convergence.
Take for example a neural network that plays a jump and run video game and is optimized with a genetic algorithm. One member might have received a high fitness score through a mutation that makes him jump over obstacles. Another member might have received a high fitness score through a mutation that makes him collect lifes on the map. Crossing over fit parent members spreads the beneficial mutations faster than if the rest of the population would need to learn these fitness increasing mutations itself by chance.


text:
Q: I Need to Simplify an array from an inner join an array php I have an array from an inner join statement from 2 Mysql tables... I need them in a better working format for front end display:
mysql query:
SELECT weddings.id, weddings.wImage, images.iLink FROM images INNER JOIN weddings ON weddings.id = images.weddingId

OUTCOME:
Array
(
    [0] => Array
        (
            [id] => 3
            [wImage] => image1.jpg
            [iLink] => image2.jpg
        )

    [1] => Array
        (
            [id] => 3
            [wImage] => image1.jpg
            [iLink] => image3.jpg
        )

    [2] => Array
        (
            [id] => 3
            [wImage] => image1.jpg
            [iLink] => image4.jpg
        )

    [3] => Array
        (
            [id] => 10
            [wImage] => image11.jpg
            [iLink] => image5.jpg
        )

    [4] => Array
        (
            [id] => 10
            [wImage] => image11.jpg
            [iLink] => image6.jpg
        )

    [5] => Array
        (
            [id] => 10
            [wImage] => image11.jpg
            [iLink] => image7.jpg
        )

    [6] => Array
        (
            [id] => 11
            [wImage] => image12.jpg
            [iLink] => image8.jpg
        )

    [7] => Array
        (
            [id] => 11
            [wImage] => image12.jpg
            [iLink] => image9.jpg
        )

    [8] => Array
        (
            [id] => 11
            [wImage] => image12.jpg
            [iLink] => image10.jpg
        )

)

So I need to work this array further to get this expected OUTCOME:
Array
(
    [0] => Array
        (
            [id] => 3
            [wImage] => image1.jpg
            [iLink] => Array
               (
                [image] => image2.jpg
                [image] => image3.jpg
                [image] => image4.jpg
               )
        )

    [1] => Array
        (
            [id] => 10
            [wImage] => image11.jpg
            [iLink] => Array
               (
                [image] => image5.jpg
                [image] => image6.jpg
                [image] => image7.jpg
               )
        )

    [2] => Array
        (
            [id] => 10
            [wImage] => image12.jpg
            [iLink] => Array
               (
                [image] => image8.jpg
                [image] => image9.jpg
                [image] => image10.jpg
               )
        )
)

A: There are many ways, but assuming your id is unique (as I guess), you can use this id as an associative key in the output, so you can easily determine whether it exists already. In the last step you reindex the result array. See code comments for further explanation.
// $input_array is the outcome from sql
// $output_array will store the desired outcome
$output_array=[];
// loop through every item in input array
foreach ($input_array as $input_item) {
    // if key with "id" already exists in output array
    if (array_key_exists($input_item["id"], $output_array)) {
        // append image to already existing "iLink" array
        array_push($output_array[$input_item["id"]]["iLink"],
            ["image" => $input_item["iLink"]]
        );
    }
    // if key with id not exists yet in output array
    else {
        // add current input item to output array,
        // with "id" value as key
        $output_array[$input_item["id"]] = [
            "id" => $input_item["id"],
            "wImage" => $input_item["wImage"],
            // array with first image, can be appended later
            "iLink" =>["image" => $input_item["iLink"]]
        ];
    }
}
// now we have the result, but output array keys are not 0,1,2
// but the id values (3, 10 etc.), so we have to reindex
$output_array = array_values($output_array);
// now it is ready
var_dump($output_array);


text:
Q: I'm testing a WCF Service and an EF Data layer, receiving String columns as (null), but receive integers as real data. Why are the strings null? I'm building a multi-layered Windows VS C# solution that has a WCF Service Library project with EF6.2 loaded, and an ADO.NET Data layer with EF6.2 also.

The EDMX model is built as a 'database first' set of tables from my MSSQL Server Express 2016 server on my laptop. My WCF Service Interface and code
only have properties and methods for one of the tables at this point.  And that table has also been built out in logic and data layer methods.
  So, I'm testing that service now with the WCF Test Client, and I'm receiving some integer data correctly in my service's response from to the data layer, but no string data.
While testing my "GetMemberByID" method, it returns all String column results as a value of "(null)", and a type of "NullObject",

but returns Integers with their actual value.  The WCF Soap response shows the returned String values as "".  But,
 the integers are returned like this:   "7".  There are over 50 data rows in my test database which is used as the source
 for the EF6.2 EDMX build.  My App.config's in data and service layers are referencing the same (localdb)\ V13.0 server and database.
Has anyone had this issue, and can you  tell me what I'm missing?   The MSSQL database was originally an (OleDb) MS Access database and I imported it into
MSSQL Server.  Thanks in advance.

A: It seems that there is something wrong with the serialization process. On my side, the string field can be returned properly. By default, the DataContractSerializer is used to deserialize/deserialize the complex object data.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/using-data-contracts
The most possible reason might be that the nullable field is not decorated by the [DataMember] attribute.  Please check if the column of the DataContract autogenerated on the client-side contains the [DataMember] attribute.
http://sivakrishnakuchi.blogspot.com/2010/05/troubleshoot-wcf-service-returning.html
Feel free to let me know if the problem still exists.

A: Okay, I found my mistake.  When translating the business domain objects back to the Service objects in the Service.cs code file, I was only translating the MemberID and the RowVersion - and no other columns.   So, the only thing that was showing up in the WCF Test Client result was the MemberID and the RowVersion - which happen to be the only two non-strings in my entity. All the string types were null because I was not translating them back into the Service.  Thanks for taking a look at this, Abraham, but you made me start looking closer, and thanks for the advice. The MS Documentation was helpful, too. Once I did a full "step into" debug trace from the UI through to the Data Layer and back, I was able to see the data translation failure.   One more thing, before I could debug step by step all the way to the Data layer and back to the Service layer, I had to fix my "Underlying database did not open" issue that so many have had.  I'm hosting my service through my local IIS, and had to make a few changes to the IIS application concerning the user credentials.  My App.config is set to use "Integrated Security=True" - which is a "passthrough" credential in the IIS App pools.  I had my IIS App set to "Specific User", but was not using a UserID/Password in my Connection String.  Once I changed my IIS App to "Passthrough" - I was able to connect, and to debug to the DAL and back.


text:
Q: php .htaccess url rewrite incorrect parameters I have a strange problem using .htaccess RewriteEngine.
I have this simple rule:
RewriteEngine On
RewriteRule ^(.\*)/(.\*).php$ pages/test.php?lang1=$1&page1=$2 [L]

In pages/test.php I put this php code:
echo('lang: '.$_GET['lang1'].'< br />');
echo('page: '.$_GET['page1'].'< br />');
echo('querystring: '.$_SERVER['QUERY_STRING']);

So, when calling http://test.local/en-US/something.php, I would expect something like:
lang: en-US
page: something
querystring: lang1=en-US&page1=something

Instead, this is the weird output I get from the page:
lang: pages
page: test
querystring: lang1=pages&page1=test

Can someone help me out?

A: You get that result because you created a loop, try using these lines :
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/pages/test\.php$
RewriteRule ^(.*)/(.*)\.php$ /pages/test.php?lang1=$1&page1=$2 [L]

A: You can also use the QSA flag:
RewriteRule ^(.*)/(.*).php$ pages/test.php?lang1=$1&page1=$2 [QSA,L]

When the replacement URI contains a query string, the default behavior of RewriteRule is to discard the existing query string, and replace it with the newly generated one. Using the [QSA] flag causes the query strings to be combined.
http://httpd.apache.org/docs/current/rewrite/flags.html


text:
Q: TApplication.MainFormOnTaskbar version requirements When this property has been introduced?
(if it says answer is too short - include VERnnn conditional symbol :)

A: The "non-breaking" release of RAD Studio 2007 introduced TApplication.MainFormOnTaskbar (and broke Delphi 2006).

A: This property was introduced in Delphi 2007. One of several sources is About.com:

With Delphi 2007, a new property of
  the Application object, the
  MainFormOnTaskbar property controls
  how Windows taskbar buttons are
  handled by VCL.

A: Delphi 2007. And yeah, that answer exeeds 30 characters. ;)


text:
Q: Joint CDF and PDF of the maximum and minimum of three i.i.d. Unif(0,1) random variables I have a question about the following problem from Introduction to Probability.
Problem

Let $U_1, U_2, U_3$ be i.i.d. $\text{Unif}(0, 1)$, and let $L = \min(U_1, U_2, U_3)$, $M =\max(U_1, U_2, U_3)$. (a) Find the marginal CDF and marginal PDF of $M$, and the joint CDF and joint PDF of $L, M$.
Hint: for the latter, start by considering $P(L<l,M>m)$.

Attempt at a Solution
Following the hint,
$$P(L<l,M>m) = (1-m)(l)(1)$$
because at least one of the random variables must exceed $m$, which occurs with probability $1-m$, at least one must be less than $l$, which occurs with probability $l$, and the remaining random variable can have any value.
$$P(L>l,M>m) = (1-m)(1-l)(1)$$
because at least one of the random variables must exceed $m$ and of the remaining two at least one must exceed $l$.
Similarly, $$P(L>l,M<m) = (m-l)^3$$ since all the random variables must be between $l$ and $m$.
If these approaches are analogous, why is the expression for $P(L>l,M<m)$ correct but those for $P(L<l,M>m)$ and $P(L>l,M>m)$ incorrect?
I also tried other unsuccessful approaches, for example,
$$P(L>l,M>m) = (1-m)(1-l^2)(1)$$
because at least one of the random variables must exceed $m$ and of the remaining two at least one must exceed $l$ and
$$P(\text{ both of the remaining two RVs }<l) = l^2. $$
so
$$P(\text{ at least one of the remaining two RVs }>l) =1-l^2. $$

A: NB: assuming that $0<\ell<m<1$.

Following the hint, $$P(L<l,M>m) = (1-m)(l)(1)$$
because at least one of the random variables must exceed m, which occurs with probability 1-m, at least one must be less than l, which occurs with probability l, and the remaining random variable can have any value.

You have to count distinct arrangements of the samples.
So among the three samples you need to measure probabilities that:

*

*Two are below $\ell$ and one above $m$,

*One is below $\ell$, one above $m$, and one between those values.

*Two are above $m$ and one is below $\ell$.

$\begin{align}{\mathsf P(L<\ell, M>m)}&={\tbinom 32 \ell^2(1-m)+3! \ell(m-\ell)(1-m)+\tbinom 32 \ell(1-m)^2}\\[1ex]&=3\,\ell\,(1-m)\,(\ell+2(m-\ell)+(1-m))\\[1ex]&=3\,\ell\,(1-m)\,(1+m-\ell)\end{align}$

For the joint pdf, I would suggest adjusting your argument to say "$\{L=\ell,M=m\}$ is any outcome where: the samples are arranged ($3!$ ways) with the least at $\ell$, the greatest at $m$, and the middle anywhere between those two.".
$$\begin{align}f_{\small L,M}(\ell,m)&= 3! f(\ell)\,(F(m)-F(\ell))\,f(m)\\[1ex]&=6 (m-\ell) \end{align}$$

So by integration we also get...
$$\begin{align}\mathsf P(L<\ell,M>m)&=\int_0^\ell\int_m^1 6\,(y-x)\,\mathrm d y\,\mathrm d x\\[1ex]&= \int_0^\ell 3\,(1^2-m^2)-6\,x\,(1-m)\,\mathrm d x\\&=3\,\ell\,(1-m^2)-3\,\ell^2\,(1-m)\\&=3\,\ell\,(1-m)\,(1+m-\ell) \end{align}$$

A: (a) General formula for max/min of n i.i.d random variables:
$F_{min(X_{1}, \dots, X_{n})}(x) = 1 - (1 - F_{X_{i}}(x))^n$
$F_{max(X_{1}, \dots, X_{n})}(x) = F_{X_{i}}(x)^n$
$p_{min(X_{1}, \dots, X_{n})}(x) = F_{min(X_{1}, \dots, X_{n})}(x)^{\prime} = n(1 - F_{X_{i}}(x))^{n-1} \cdot p_{X_{i}}(x)$
$p_{max(X_{1}, \dots, X_{n})}(x) = F_{max(X_{1}, \dots, X_{n})}(x)^{\prime} = nF_{X_{i}}(x)^{n-1} \cdot p_{X_{i}}(x)$


text:
Q: exe file doesn't work properly (nothing happens) When I compile my file (snake.py) to exe, the output file (exe file) doesn't work.
I thought this may be as a result of the error that occurs during compiling:
missing modules:
? _frozen_importlib imported from importlib

Any ideas??
import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == "win32":
      base = "Win32GUI"

setup(
    name = "simple_PyQt4",
    version = "0.1",
    description = "Sample cx_Freeze PyQt4 script",
    options = {"build_exe" : {"includes" : "atexit" }},
    executables = [Executable("hello_qt.py", base = base)])

A: I use PySide, but it should be almost equivalent to your PyQt.
I have this code hello_pyside.py:
import sys
from PySide.QtCore import *
from PySide.QtGui import *

class Window(QWidget):
    def __init__(self, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)

        self.button = QPushButton("Test", self)
        self.button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.layout = QHBoxLayout()
        self.layout.setContentsMargins(5, 5, 5, 5)
        self.layout.addWidget(self.button)

        self.setLayout(self.layout)
        self.show()

app = QApplication(sys.argv)
win = Window()
sys.exit(app.exec_())

I call this script installed with cx_freeze:
c:\Python33\Scripts\cxfreeze.bat hello_pyside.py --target-dir=Bin/pyside --base-name=Win32GUI --target-name=hello_pyside.exe --include-modules=re --exclude-modules=Tkinter

And I get the directory containing:
_bz2.pyd
hello_pyside.exe
PySide.QtCore.pyd
PySide.QtGui.pyd
pyside-python3.3.dll
python33.dll
QtCore4.dll
QtGui4.dll
shiboken-python3.3.dll
unicodedata.pyd

This should work fine.


text:
Q: Power Apps: Fetching data from SQL server with "Power Automate" does not store null values in collection I am currently developing an application in Microsoft Power Apps. I fetch some data from my SQL Server using PowerAutomate. My Flow executes a stored procedure and it returns my data successfully. As you can see here:
{
"statusCode": "200",
"body": [
    {
        "Id": 6,
        "Beschreibung": "test",
        "Erstelldatum": "2022-03-09T11:00:21.708",
        "Zieldatum": null,
        "Erledigungskommentar": null,
        "Titel": "test",
        "ErstellerId": "xyz",
        "Prioritaet": 3,
        "Ort": "test",
        "Ticketstatus": 1,
        "Fehlercode": null,
        "Abteilung": 1,
        "Rueckfrage_Von": null
    },
    {
        "Id": 7,
        "Beschreibung": "testtttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt",
        "Erstelldatum": "2022-03-09T11:30:31.654",
        "Zieldatum": "2022-03-15T00:00:00",
        "Erledigungskommentar": null,
        "Titel": "test",
        "ErstellerId": "xyz",
        "Prioritaet": 3,
        "Ort": "tetet",
        "Ticketstatus": 1,
        "Fehlercode": 1,
        "Abteilung": 1,
        "Rueckfrage_Von": null
    }
]

}
BUT: When I call this flow in my OnVisible attribute on my power apps screen, it fetches the data but ignores the whole attributes that are nullable (can contain null values).
You can see here on the picture, that the columns "Zieldatum", "Rueckfrage_Von", and "Fehlercode" are not in the collection and I cannot access them:attributes of my collection
Has somebody an idea how I can enable that also nullable attributes get stored in my collection? THANK YOU!