Q: Existence of a *really* nice topology on the powerset of a topological space TL;DR. Given a topological space $X$, is there a natural way to "induce" a topology on $\mathcal{P}(X)$ from the topology of $X$ in such a way that 1) all the basic operations of set theory (intersections, unions, direct images, etc.) become continuous and 2) the topologies on $X$ and $\mathcal{P}(X)$ are compatible in a certain sense?

Given a topological space $X$, there are a couple of ways to assign a topology to its powerset $\mathcal{P}(X)$ that do not depend specifically on $X$. For example:

*

*We can view $\mathcal{P}(X)$ as the hom $\operatorname{Hom}(X,2)$, put either the discrete, indiscrete, or Sierpiński topology on $2$, and consider the compact-open topology;

*We can take the Alexandroff topology with respect to $\subset$ or $\supset$;

*There are the so-called hit-and-miss topologies, of which the Vietoris and Fell topologies are examples.

*(A non-example would be to define a topology on $\mathcal{P}(\mathbb{R})$ using the order of $\mathbb{R}$.)

Given an assignment of topologies on $\mathcal{P}(X)$ from topologies on $X$ as above, we could consider the following sets of niceness conditions:

*

*The map $\iota\colon X\to\mathcal{P}(X)$ given by $x\mapsto\{x\}$ is continuous.

*Binary union ${\cup}\colon\mathcal{P}(X)\times\mathcal{P}(X)\to\mathcal{P}(X)$ is continuous.

*Binary intersection ${\cap}\colon\mathcal{P}(X)\times\mathcal{P}(X)\to\mathcal{P}(X)$ is continuous.

*Difference ${\setminus}\colon\mathcal{P}(X)\times\mathcal{P}(X)\to\mathcal{P}(X)$ is continuous.

*Arbitrary union ${\bigcup}\colon\mathcal{P}(\mathcal{P}(X))\to\mathcal{P}(X)$ is continuous.

*Arbitrary intersection ${\bigcap}\colon\mathcal{P}(\mathcal{P}(X))\to\mathcal{P}(X)$ is continuous.

*If $f\colon X\to Y$ is a continuous map of topological spaces, then so are its direct and inverse images
\begin{align*}
f_{*}  &{}\colon\mathcal{P}(X)\to\mathcal{P}(Y),\\
f^{-1} &{}\colon\mathcal{P}(Y)\to\mathcal{P}(X).
\end{align*}
I'm also interested in the following two sets of additional conditions that are a bit more specific:
More compatibility conditions between $X$ and $\mathcal{P}(X)$:

*For each $x\in X$, if $\{x\}$ is closed in $X$, then $\{\{x\}\}$ is closed in $\mathcal{P}(X)$.

*If $S\subset X$ is closed in $X$, then $\{S\}$ is closed in $\mathcal{P}(X)$.

*If $U\subset X$ is open in $X$, then $\{U\}$ is open in $\mathcal{P}(X)$.

Another niceness requirement for the topology on $\mathcal{P}(X)$:

*Given any monoid structure $(\star,1_X)$ on $X$ making it into a topological monoid, the map
$$\circledast\colon\mathcal{P}(X)\times\mathcal{P}(X)\to\mathcal{P}(X)$$
given by
$$U\circledast V:=\{uv\in X\ |\ u\in U,v\in V\}$$
is continuous.¹

*(Implies 11 by Tobias's second comment.) Given topological spaces $X$ and $Y$, the map
$$\mathcal{P}(X)\times\mathcal{P}(Y)\to\mathcal{P}(X\times Y)$$
given by $(U,V)\mapsto U\times V$ is continuous.

*Given topological spaces $X$ and $Y$, the bijection
$$\mathcal{P}(X)\times\mathcal{P}(Y)\to\mathcal{P}(X\sqcup Y)$$
given by $(U,V)\mapsto U\cup V$ is a homeomorphism.

*Given topological spaces $X$ and $Y$, the isomorphism of suplattices
$$\mathcal{P}(X)\otimes\mathcal{P}(Y)\to\mathcal{P}(X\times Y)$$
is a homeomorphism, where $\otimes$ denotes the tensor product of suplattices (see Eric Wofsey's answer to Concrete description of the tensor product of suplattices?).

Question I. Does there exist a powerset topology satisfying (at least but not necessarily only) conditions 1–7? What about (1–7+11), 1–8, 1–9, or 1–10?
Question II. Given a topological space $X$, what is the finest topology on $\mathcal{P}(X)$ satisfying conditions 1–6? What about (1–6 + 11–14), or these plus any of 8–10? Lastly, in case this topology turns out to be definable in a way that is independent of $X$ (like the Vietoris topology), do we also have 7?

Footnotes.
¹The motivation for this is that $\circledast$ is the zero-categorical analogue of ordinary Day convolution, and we may compute it via a completely analogous coend formula when viewing subsets $U$ of $X$ as functions $\chi_U\colon X\to\{\mathrm{true},\mathrm{false}\}$, namely $\chi_U\circledast\chi_V=\int^{x,y\in X}\mathrm{Hom}_{X}(-,xy)\times\chi_U(x)\times\chi_V(y)$.

A: 1-7 together are pretty strong. You aren't going to have a procedure for doing this without most of the powerset topologies being indiscrete.
First note that if $X$ is a set and $\tau$ is at topology on $\mathcal{P}(X)$ satisfying 2-4, then the function $A \mathbin{\Delta} B = (A \cup B) \setminus (A \cap B)$ is continuous, which implies that for fixed $B\subseteq X$, the map $A \mapsto A \mathbin{\Delta} B$ is a homeomorphism. Therefore for any $A$ and $B$ in $\mathcal{P}(X)$, there is a homeomorphism of $(\mathcal{P}(X),\tau)$ taking $A$ to $B$ (namely the map $C \mapsto C \mathbin{\Delta} (A \mathbin{\Delta} B)$).
When I say a topology is non-trivial, I mean specifically that it is not indiscrete.

Lemma. If $X$ is a set and $(\mathcal{P}(X),\tau)$ satisfies 2-4, then the closure $F$ of $\{\varnothing\}$ is a filter (i.e., $A \subseteq B \in F \Rightarrow A \in F$ and $A\in F \wedge B \in F \Rightarrow A \cup B \in F$). In particular, $\tau$ is non-trivial if and only if the $X \notin F$.

Proof. Suppose that $A \notin F$ and $B \supseteq A$. Since $\cap$ is continuous, we have that $G = \{C : C \cap A \in F\}$ is closed. Clearly $\varnothing \in G$, so $F \subseteq G$. Furthermore, $B \notin G$, so $B \notin F$.
For showing that $F$ is closed under unions, first note that it is sufficient to show it for disjoint $A,B \in F$. So assume that $A,B \in F$ and $A$ and $B$ are disjoint. Since $C \mapsto C \mathbin{\Delta} B$ is a homeomorphism, we have that $A \in F$ if and only if $A \mathbin{\Delta} B \in \overline{\{B\}}$ (since $\varnothing \mathbin{\Delta} B = B$). Therefore $A \mathbin{\Delta} B \in \overline{\{B\}} \subseteq F$, as required.
For the final statement. Since $\mathcal{P}(X)$ has a transitive homeomorphism group, $\tau$ is non-trivial if and only if $F$ is not all of $\mathcal{P}(X)$. Since $F$ is a filter, this happens if and only if $X \notin F$. $\square_{\text{Lemma}}$

Proposition. For any topological space $X$, if $(\mathcal{P}(X),\tau_1)$ and $(\mathcal{P}(\mathcal{P}(X)),\tau_2)$ satisfy 1-5 and 7 and $\tau_1$ is non-trivial, then $X$ is discrete.

Proof. To hopefully make this proof a little bit easier to read, I'm going to denote the empty set as $\varnothing_1$ when we're thinking about it as an element of $\mathcal{P}(X)$ and as $\varnothing_2$ when we're thinking about it as an element of $\mathcal{P}(\mathcal{P}(X))$.
Let $F_1$ be the $\tau_1$-closure of $\{\varnothing_1\}$, and let $F_2$ be the $\tau_2$-closure of $\{\varnothing_2\}$. Since $\tau_1$ is non-trivial, $X \notin F_1$ by the lemma. Since $\bigcup: \mathcal{P}(\mathcal{P}(X)) \to \mathcal{P}(X)$ is continuous, we have that $\bigcup^{-1}(F_1)$ is a closed set in $\mathcal{P}(\mathcal{P}(X))$. Since $\varnothing_2 \in \bigcup^{-1}(F_1)$, we have that $F_2 \subseteq \bigcup^{-1}(F_1)$, i.e., if $A \in F_2$, then $\bigcup A \in F_1$. Therefore, in particular, $\{X\} \notin F_2$.
By 7, every homeomorphism $f$ of $\mathcal{P}(X)$ induces a homeomorphism $f_\ast$ of $\mathcal{P}(\mathcal{P}(X))$. Each such homeomorphism $f_\ast$ fixes $\varnothing_2$ and takes singletons to singletons (specifically, for any $A \in \mathcal{P}(X)$, $f_\ast(\{A\}) = \{f(A)\}$). By the discussion before the lemma, the homeomorphism group of $\mathcal{P}(X)$ is transitive. Therefore $\{A\} \notin F_2$ for every $A \in \mathcal{P}(X)$ and so $F_2 = \{\varnothing_2\}$ (because $F_2$ does not contain one particular singleton, $\{X\}$, so it does not contain any singletons, since it needs to be invariant under any homeomorphisms of $\mathcal{P}(\mathcal{P}(X))$ fixing $\varnothing_2$).
Consider the function $(x,y) \mapsto \{x\} \cap \{y\}$ from $\mathcal{P}(X) \times \mathcal{P}(X) \to \mathcal{P}(\mathcal{P}(X))$. By 1 and 3, this is continuous. Since $\{\varnothing_2\}$ is closed, this implies that the off diagonal $\{(x,y) \in \mathcal{P}(X) \times \mathcal{P}(X): x \neq y\}$ is closed and therefore the diagonal is open. It's relatively straightforward to show that if the diagonal of $Y^2$ is open, then $Y$ has the discrete topology. Therefore $\tau_1$ is discrete. Repeating the argument again (since now we know that $\{\varnothing_1\}$ is closed) gives that the topology on $X$ is discrete. $\square$

A: $\newcommand{\Cld}{\mathrm{Cld}}$I have found partial answers for the case of the Vietoris topology, although they are only for the subspaces $\mathrm{Cld}(X)$ of closed subsets of $X$ and $\mathcal{P}_{0}(X)$ of nonempty subsets of $X$ (and I haven't checked whether they extend to all of $\mathcal{P}(X)$ myself).
Here are the results I found (feel free to add more or edit!):

*

*Condition 1 (Partial Positive): Corollary 3a of page 166 of Kuratowski–Jaworowski's Topology, Volume I states the map $\iota\colon X\to\Cld(X)$ is an embedding when $X$ is $\mathrm{T}_1$. Exercise 2.6.2 of Klein–Thompson's Theory of Correspondences states this is true (without the $\mathrm{T}_1$ assumption) for $\mathcal{P}_0(X)$ with respect to either the lower Vietoris, upper Vietoris, or Vietoris topologies.

*Condition 2 (Partial Positive): Corollary 4a of page 166 of Kuratowski–Jaworowski's Topology, Volume I states that $$\cup\colon\Cld(X)\times\Cld(X)\to\Cld(X)$$ is continuous.

*Condition 3 (Partial Positive): Corollary 1a of page 180 of Kuratowski–Jaworowski's Topology, Volume I states that if $X$ is $\mathrm{T}_4$, then $$\cap\colon\Cld(X)\times\Cld(X)\to\Cld(X)$$ is upper semicontinuous.

*Condition 4 (Partial Positive): The corollary in page 182 of Kuratowski–Jaworowski's Topology, Volume I states that if $X$ is $\mathrm{T}_3$, then $$\setminus\colon\Cld(X)\times\Cld(X)\to\Cld(X)$$ followed by taking closure is lower semicontinuous.

*Condition 5 (Partial Positive): Theorem 7.2.3 and Corollary 7.2.4 of Klein–Thompson's Theory of Correspondences state that the map $$\bigcup\colon\mathcal{P}_0(\mathcal{P}_0(X))\to\mathcal{P}_0(X)$$  is continuous with respect to either the lower Vietoris, upper Vietoris, or Vietoris topologies applied twice on $\mathcal{P}_0(\mathcal{P}_0(X))$ and once on $\mathcal{P}_0(X)$.

*Condition 6: Still no idea.

*Condition 7 (Partial Negative+Positive): Theorem 2 of page 165 of Kuratowski–Jaworowski's Topology, Volume I states that:

*

*$f^{-1}\colon\Cld(Y)\to\Cld(X)$ is continuous (as a relation) iff $f$ is closed and open.

*If $f$ is closed, then $f_*\colon\Cld(X)\to\Cld(Y)$ is continuous (as a relation).

Propositions 7.2.9 and 7.2.11 of Klein–Thompson's Theory of Correspondences extend the above results to $\mathcal{P}_0(X)$ (and without a closedness assumption on $f$ for the second result).

*Conditions 8 and 9 (Partial Positive): Theorem 3 of page 162 of Kuratowski–Jaworowski's Topology, Volume I states that if $X$ is $\mathrm{T}_1$, then so is $\Cld(X)$. In particular, $\{\{x\}\}$ is closed in $\Cld(X)$ for any $x\in X$ and so is $\{S\}$ for $S$ closed.

*Condition 10: Still no idea.

*Condition 11 (Partial Positive): Theorem 3.1 of Carruth–Hildebrant–Koch's The Theory of Topological Semigroups, Volume II states that the map $$\circledast\colon\Cld(X)\times\Cld(X)\to\Cld(X)$$ is continuous when $X$ is compact (not sure how important compactness is)

*Condition 12: Still no idea.

*Condition 13: Still no idea.

*Condition 14: Still no idea.


Q: How to correctly send a matplotlib.figure.Figure to a private telegram channel on Python3 via Telegram API? Say I have the following df called df_trading_pair_date_time_index which contains the following data:
                         Open      High       Low     Close                End Date
Start Date
2022-08-12 00:25:00  23834.13  23909.27  23830.00  23877.62 2022-08-12 00:29:59.999
2022-08-12 00:30:00  23877.62  23968.52  23877.62  23936.89 2022-08-12 00:34:59.999
2022-08-12 00:35:00  23936.89  23989.95  23915.92  23962.50 2022-08-12 00:39:59.999
2022-08-12 00:40:00  23960.64  23985.03  23935.60  23966.71 2022-08-12 00:44:59.999
2022-08-12 00:45:00  23966.71  23996.94  23958.00  23983.68 2022-08-12 00:49:59.999
2022-08-12 00:50:00  23982.53  24009.67  23958.89  23996.59 2022-08-12 00:54:59.999
2022-08-12 00:55:00  23995.49  24005.30  23963.92  23964.37 2022-08-12 00:59:59.999
2022-08-12 01:00:00  23965.31  24000.00  23940.61  23975.64 2022-08-12 01:04:59.999
2022-08-12 01:05:00  23977.04  23996.85  23928.95  23943.09 2022-08-12 01:09:59.999
2022-08-12 01:10:00  23944.05  23972.86  23885.00  23905.23 2022-08-12 01:14:59.999
2022-08-12 01:15:00  23905.23  23944.66  23901.74  23925.72 2022-08-12 01:19:59.999
2022-08-12 01:20:00  23925.72  23951.21  23917.84  23945.03 2022-08-12 01:24:59.999
2022-08-12 01:25:00  23945.03  23961.78  23935.12  23945.60 2022-08-12 01:29:59.999
2022-08-12 01:30:00  23945.60  23949.86  23919.90  23934.50 2022-08-12 01:34:59.999
2022-08-12 01:35:00  23934.49  23934.50  23853.65  23895.44 2022-08-12 01:39:59.999
2022-08-12 01:40:00  23895.44  23932.11  23894.67  23906.00 2022-08-12 01:44:59.999
2022-08-12 01:45:00  23905.42  23927.26  23878.57  23902.75 2022-08-12 01:49:59.999
2022-08-12 01:50:00  23902.76  23915.00  23888.08  23889.19 2022-08-12 01:54:59.999

When running df_trading_pair_date_time_index.dtypes the following output is presented:
Open               float64
High               float64
Low                float64
Close              float64
End Date    datetime64[ns]
dtype: object

And when running df_trading_pair_date_time_index.index the following output is returned:
DatetimeIndex(['2022-08-12 00:25:00', '2022-08-12 00:30:00', '2022-08-12 00:35:00', '2022-08-12 00:40:00', '2022-08-12 00:45:00', '2022-08-12 00:50:00', '2022-08-12 00:55:00', '2022-08-12 01:00:00',
               '2022-08-12 01:05:00', '2022-08-12 01:10:00', '2022-08-12 01:15:00', '2022-08-12 01:20:00', '2022-08-12 01:25:00', '2022-08-12 01:30:00', '2022-08-12 01:35:00', '2022-08-12 01:40:00',
               '2022-08-12 01:45:00', '2022-08-12 01:50:00'],
              dtype='datetime64[ns]', name='Start Date', freq=None)

In order to plot the data above, I used the following code:
import requests
import mplfinance as mpf
import matplotlib.pyplot as plt
import pandas as pd

# Plotting
# Create my own `marketcolors` style:
mc = mpf.make_marketcolors(up='#2fc71e',down='#ed2f1a',inherit=True)
# Create my own `MatPlotFinance` style:
s  = mpf.make_mpf_style(base_mpl_style=['bmh', 'dark_background'],marketcolors=mc, y_on_right=True)

# Plot it
btc_plot, axlist = mpf.plot(df_trading_pair_date_time_index,
                            figratio=(10, 6),
                            type="candle",
                            style=s,
                            tight_layout=True,
                            datetime_format = '%H:%M',
                            ylabel = "Precio ($)",
                            returnfig=True)
# Add Title
axlist[0].set_title("BTC/USDT - 5m", fontsize=25, style='italic', fontfamily='fantasy' )

After running btc_plot in the console, the following chart is returned:

And finally when running type(btc_plot) the following output is returned:
matplotlib.figure.Figure

The problem:
I am having a hard time dealing with a "simple" thing, I want to send such plotted trading chart to a private telegram channel through the Telegram API with Python3, so according to this section of the Telegram API Documentation, the following line should work:
requests.post(f'https://api.telegram.org/bot{bot_str}/sendPhoto',
                          data = {'chat_id':f'-100{channel_id_str}', 'photo': btc_plot, 'caption':'Fue detectada una señal bajista en el par BTC/USDT!'})

However, after running that statement, all I got was a <Response [400]> without any explanation nor exception from the console.
So, I do think that it may be happening because I'm trying to send a matplotlib.figure.Figure object, but I mistakenly thought that btc_plot had stored a png object just because an image was returned after running btc_plot in the console, so I am lost.
Ironically, the following sentence works as expected with a <Response [200]> as output:
requests.post(f'https://api.telegram.org/bot{bot_str}/sendMessage',
                              data = {'chat_id':f'-100{channel_id_str}', 'text': 'Fue detectada una señal bajista en el par BTC/USDT!'})

May I get here some alternative solution or an improvement to my current one?

A: Found an alternative, which I think it actually always was the right way to do it.
import telegram

btc_plot.savefig('signal.png',dpi=300, bbox_inches = "tight")
telegram.Bot(token= token_str).send_photo(chat_id= chat_id_str,
                                          photo=open("signal.png", 'rb'),
                                          caption="Fue detectada una señal bajista en el par BTC/USDT!")

Output:


Q: question about SQLAlchemy's choice of join targets I'm going through the SQLAlchemy ORM tutorial (https://docs.sqlalchemy.org/en/latest/orm/tutorial.html#querying-with-joins) and there's a part that confused me more than it helped me:

What does Query select from if there’s multiple entities?
The Query.join() method will typically join from the leftmost item in
  the list of entities, when the ON clause is omitted, or if the ON
  clause is a plain SQL expression. To control the first entity in the
  list of JOINs, use the Query.select_from() method:
query = session.query(User, Address).select_from(Address).join(User)

Is the "list of entities" the list within query()?
More to the point, when would the ON clause not be omitted?
By ON clause does it mean a relationship like User.addresses (previously defined for example as User.addresses = relationship(Address)) used like join(User.addresses)? Is that the type of "ON clause" that would prevent us from needing select_from() since the join() parameter itself would contain the necessary information for determining which table we intend to join with?
Surely there must be some way to specify join targets without having them always defaulting to the first table in query() since otherwise it wouldn't be possible to build certain complex queries.

A: Let's start from the beginning. When you pass items to query(), it will build a SELECT statement from these items. If they are models, then it will enumerate all the fields of such models. The query will automatically add the tables to select FROM.
Unless you tell it to, the query will not perform joins automatically, so you must add assume what tables to look up your values from. Additional clauses like join() tell the query how the JOIN operation should be performed.
Additional arguments to join() will be used as the ON clause, otherwise the query will infer the clause based on mapper-defined relationships.
So to summarize, the ON clause is omitted whenever you do not specify additional arguments to join(). In the following expression, the ON clause is omitted: query(User, Address).join(Address) This does not mean that the SQL emitted will not have an ON clause; it will do the right thing by inferring the proper ON clause using the relationships defined on the model.
When there are multiple possibilities, you need to specify the clause yourself: query(Person).join(Person.parent1).join(Person.parent2) should result in a query that returns a person and both of their parents. In this case, the ON clause was not omitted.


Q: How to simplify the given equation? I have trouble to understand a simplification I found online.

Equation that has to be simplified:
$\frac{dTC(Q)}{dQ}=\frac{-SD}{Q^{2}}+\frac{HD}{2P^{2}} [(P(1-\beta) - D)(1+2\beta)+\beta ^{2}(P-D)]+(a-\frac{D}{P}-\frac{\beta D}{P})^{2}\frac{H}{2} = 0$
Equation that is simplified:
$Q = \sqrt{\frac{2SDP}{H[P-(1+\beta +\beta ^{2})D]}}$
I don't understand how you get the second equation out of the first one...
Can someone help me?
Help would be greatly appreciated! :)

A: Please notice that the last factor in book is $\displaystyle \frac{H}{2}\left(1-\frac{D}{P}-\frac{\beta D}{P}\right)^2$, not as you have written.
Multiplying equation by $2P^2Q^2$ we have $$-2SDP^2+HDQ^2\left[(P-\beta P-D)(1+2\beta)+\beta^2(P-D)\right]+HP^2Q^2\left(\frac{P-D-\beta D}{P}\right)^2=0$$Thus $$-2SDP^2+HDQ^2\left[P+\beta P-\beta^2P-D-2\beta D-\beta ^2 D\right]+HQ^2(P-D-\beta D)^2=0$$Factoring we have $$Q^2\left[D(P+\beta P-\beta^2P-D-2\beta D-\beta ^2 D)+(P-D-\beta D)^2\right]=\frac{2SDP^2}{H}$$Simplifying the brackets we get $$P^2-DP-\beta DP-\beta^2 DP=P\left[P-D(1+\beta+\beta^2)\right]$$Eventually $$Q^2=\frac{2SDP^2}{HP\left[P-D(1+\beta+\beta^2)\right]}\implies\boxed{Q=\sqrt{\frac{2SDP}{H\left[P-D(1+\beta+\beta^2)\right]}}}$$


Q: Using SVG, hover on X, Y or Z to make X and Z rotate I have an element (logo) on my webpage which contains three other elements, I want to make it so when the logo as a whole is hovered, two of the elements within the logo (two of the letters) will rotate around their centre indefinitely.
I have achieved rotating elements with CSS animations, but only to get an element to rotate when itself is hovered. I cannot figure out how to get multiple elements to rotate when any of the three elements are hovered using CSS.
I have the three elements in their own svg tags as data URI, all within a single g, which itself is in an a href that links to the home page.
<header><a id="logoLink" href="">

<g class="logoSvg">

<svg id="c" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34.68 37.2"><defs><style>.cls-1{fill:#e94a4a;}</style></defs><title>logo</title><path class="cls-1" d="...
</svg>
<svg id="hri" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76.88 79.53"><defs><style>.cls-1{fill:#e94a4a;}</style></defs><title>logo copy</title><path class="cls-1" d="M
</svg>
<svg id="s" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.19 37.2"><defs><style>.cls-1{fill:#e94a4a;}</style></defs><title>logo copy 2</title><path class="cls-1" d="M
</svg>

</g>

</a>

In the html doc I also have a script source with SnapSVG content, as well as linking to the SnapSVG source code:
<script src="js/logoAni.js"></script>

The SnapSVG js is as follows:
var logo = $("#logoSvg");
var c = $("#c");
var hri = $("#hri");
var s = $("#s");

function rollover(){
    c.transform('r0,100,100');
    c.animate({transform: "r360,100,100"},1000,mina.linear,anim);
    s.transform('r0,100,100');
    s.animate({transform: "r360,100,100"},1000,mina.linear,anim);
}

logo.hover(rollover);

I'm assuming that the snap code is wrong. Perhaps I don't need to use snap at all?
Update:
Here's a recent jfiddle https://jsfiddle.net/Lc12bvyn/

A: You could use @keyframes animation and nested styles in SCSS to achieve something like this without javascript. Not sure if you're wanting to go this route, but it seems the most straightforward to me.
Particularly you're looking to set the animation-iteration-count to infinite on the elements that you want to rotate.
The below code is just some rough concept stuff, not sure the animation you're looking to set, or the full context of your elements, etc.
.logoSvg {

  &:hover {

    &:first-child {
      animation-name: someAnimation;
      animation-iteration-count: infinite;
    }

    &:last-child {
      animation-name: someAnimation;
      animation-iteration-count: infinite;
    }
  }
}

@keyframes someAnimation {
  0%: {transform: some transformation};
  100%: {transform: some transformation};
}

I hope this is helpful Chris, or at least gets you going in the right direction.

A: The rollover code itself looks ok (assuming missing code is, if you still get stuck I would put up a jsfiddle or jsbin), it's just applying to the wrong type of elements.
I'm guessing you are using jquery for the selections? If so, I'm not sure that will work..rather than doing..
var logo = $("#logoSvg");

try
var logo = Snap("#logoSvg");

That way you will get the Snap element (which links to the DOM element) to operate on, not a DOM or jquery object.
You can't transform the 'svg' element itself typically (as it doesn't technically support the transform attribute as far as I'm aware).
So, I would put the two svgs you want to transform inside a g/group element and transform that g element. You could look into css, but css transforms on svg don't always play nice regarding browser support, so whilst Davids answer may be good for normal elements, I'm not sure it would play nice for svg elements (especially rotations), do test different browsers very early if you do try that method.


Q: json post request size limit (now a verified php-mysqli bug) I'm sending a request to my PHP application through a JSON-encoded ajax request (form process).  A post-request with character length of 4174 is successfully processed and the result is received correctly.  Adding one additional character to the request causes my application to loop infinitely until Apache2 seg-faults.  There are only 2 fields, one for a 3-digit id, and the rest is text from a text area.
I'm using the Zend Framework to drive my application, Apache2.2.3, PHP 5.2.8, JSON plugin version 1.2.1, MySQL 5.0.77
Anyone have any ideas...
here is another update::
    tracked this issue to NOT a json request problem, but an issue with the query i am running.  I'm performing an INSERT ON DUPLICATE KEY UPDATE query that inflates the text size of the query.  I can run this query find from the command line, however from PHP it's failing.  Currently investigating the issue.  Anyone interested could see the query here..
** this is a bug with the mysqli plugins for php, for some reason the db handler doesn't like this code.  If/when I have time to properly test, you'll see my results.**
INSERT INTO element_attribute_values (ElementAttributeId,ElementId,value) VALUES  (1,'553','444st text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this itext this itext this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test tex this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is sotext this ime test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test tex tesxthis is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is fsome test texttext this i this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is sometext this i test text this is some test text this is some test text this is sothis is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text thisf iffffffff4444') ON DUPLICATE KEY UPDATE value='444st text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this itext this itext this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test tex this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is sotext this ime test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test tex tesxthis is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is fsome test texttext this i this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is sometext this i test text this is some test text this is some test text this is sothis is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text this is some test text thisf iffffffff4444'

A: I don't know if this is related or not but I was using jQuery recently using the $.ajax() method to submit POST data from a text field to a php script. The php script would then parse the data (XML) for the bits of information that I needed. I noticed an error on my firephp output that it was unable to parse the XML from the POSTed form. I then had it output the strlen() and the data and noticed it was cutting it from around 7k bytes down to 268 (or 256 or something I forget the exact amount). This made it an incomplete and not valid XML pile of data. I fixed this by using the $.post() method instead. Worked perfectly.

A: You could simply check the length of your string, and if it's over the limit, split it up. Run the first portion in the insert, then do a += update on the field with the second portion. It's a bit crude, but it gets around the bug.


Q: nodejs proxy local api calls to external rest api service (no express.js) I'm running the demo app of angularjs (angular-seed) using nodejs with the default project file /scripts/web-server.js (see below)
I would like node js to proxy/redirect all the local calls to /api to the external Rest api endpoint http://www.mywebsite.com/api in order to avoid the cross domain origin policy.
How should I edit the web-server.js below to achieve the proxy redirect?
All the example I found do use express.js. I'm using node.js only as development environment so I've no interest in using express.js.
Default web-server.js nodejs script:
#!/usr/bin/env node

var util = require('util'),
    http = require('http'),
    fs = require('fs'),
    url = require('url'),
    events = require('events'),
    request = require('request');
    ;

var DEFAULT_PORT = 8000;

function main(argv) {
  new HttpServer({
    'GET': createServlet(StaticServlet),
    'HEAD': createServlet(StaticServlet)
  }).start(Number(argv[2]) || DEFAULT_PORT);
}

function escapeHtml(value) {
  return value.toString().
    replace('', '>').
    replace('"', '"');
}

function createServlet(Class) {
  var servlet = new Class();
  return servlet.handleRequest.bind(servlet);
}

/**
 * An Http server implementation that uses a map of methods to decide
 * action routing.
 *
 * @param {Object} Map of method => Handler function
 */
function HttpServer(handlers) {
  this.handlers = handlers;
  this.server = http.createServer(this.handleRequest_.bind(this));
}

HttpServer.prototype.start = function(port) {
  this.port = port;
  this.server.listen(port);
  util.puts('Http Server running at http://localhost:' + port + '/');
};

HttpServer.prototype.parseUrl_ = function(urlString) {
  var parsed = url.parse(urlString);
  parsed.pathname = url.resolve('/', parsed.pathname);
  return url.parse(url.format(parsed), true);
};

HttpServer.prototype.handleRequest_ = function(req, res) {
  var logEntry = req.method + ' ' + req.url;
  if (req.headers['user-agent']) {
    logEntry += ' ' + req.headers['user-agent'];
  }
  util.puts(logEntry);
  req.url = this.parseUrl_(req.url);
  var handler = this.handlers[req.method];
  if (!handler) {
    res.writeHead(501);
    res.end();
  } else {
    handler.call(this, req, res);
  }
};

/**
 * Handles static content.
 */
function StaticServlet() {}

StaticServlet.MimeMap = {
  'txt': 'text/plain',
  'html': 'text/html',
  'css': 'text/css',
  'xml': 'application/xml',
  'json': 'application/json',
  'js': 'application/javascript',
  'jpg': 'image/jpeg',
  'jpeg': 'image/jpeg',
  'gif': 'image/gif',
  'png': 'image/png',
  'svg': 'image/svg+xml'
};

StaticServlet.prototype.handleRequest = function(req, res) {
  var self = this;
  var path = ('./' + req.url.pathname).replace('//','/').replace(/%(..)/g, function(match, hex){
    return String.fromCharCode(parseInt(hex, 16));
  });
  var parts = path.split('/');
  if (parts[parts.length-1].charAt(0) === '.')
    return self.sendForbidden_(req, res, path);
  fs.stat(path, function(err, stat) {
    if (err)
      return self.sendMissing_(req, res, path);
    if (stat.isDirectory())
      return self.sendDirectory_(req, res, path);
    return self.sendFile_(req, res, path);
  });
}

StaticServlet.prototype.sendError_ = function(req, res, error) {
  res.writeHead(500, {
      'Content-Type': 'text/html'
  });
  res.write('\n');
  res.write('Internal Server Error\n');
  res.write('Internal Server Error');
  res.write('' + escapeHtml(util.inspect(error)) + '');
  util.puts('500 Internal Server Error');
  util.puts(util.inspect(error));
};

StaticServlet.prototype.sendMissing_ = function(req, res, path) {
  path = path.substring(1);
  res.writeHead(404, {
      'Content-Type': 'text/html'
  });
  res.write('\n');
  res.write('404 Not Found\n');
  res.write('Not Found');
  res.write(
    'The requested URL ' +
    escapeHtml(path) +
    ' was not found on this server.'
  );
  res.end();
  util.puts('404 Not Found: ' + path);
};

StaticServlet.prototype.sendForbidden_ = function(req, res, path) {
  path = path.substring(1);
  res.writeHead(403, {
      'Content-Type': 'text/html'
  });
  res.write('\n');
  res.write('403 Forbidden\n');
  res.write('Forbidden');
  res.write(
    'You do not have permission to access ' +
    escapeHtml(path) + ' on this server.'
  );
  res.end();
  util.puts('403 Forbidden: ' + path);
};

StaticServlet.prototype.sendRedirect_ = function(req, res, redirectUrl) {
  res.writeHead(301, {
      'Content-Type': 'text/html',
      'Location': redirectUrl
  });
  res.write('\n');
  res.write('301 Moved Permanently\n');
  res.write('Moved Permanently');
  res.write(
    'The document has moved here.'
  );
  res.end();
  util.puts('301 Moved Permanently: ' + redirectUrl);
};

StaticServlet.prototype.sendFile_ = function(req, res, path) {
  var self = this;
  var file = fs.createReadStream(path);
  res.writeHead(200, {
    'Content-Type': StaticServlet.
      MimeMap[path.split('.').pop()] || 'text/plain'
  });
  if (req.method === 'HEAD') {
    res.end();
  } else {
    file.on('data', res.write.bind(res));
    file.on('close', function() {
      res.end();
    });
    file.on('error', function(error) {
      self.sendError_(req, res, error);
    });
  }
};

StaticServlet.prototype.sendDirectory_ = function(req, res, path) {
  var self = this;
  if (path.match(/[^\/]$/)) {
    req.url.pathname += '/';
    var redirectUrl = url.format(url.parse(url.format(req.url)));
    return self.sendRedirect_(req, res, redirectUrl);
  }
  fs.readdir(path, function(err, files) {
    if (err)
      return self.sendError_(req, res, error);

    if (!files.length)
      return self.writeDirectoryIndex_(req, res, path, []);

    var remaining = files.length;
    files.forEach(function(fileName, index) {
      fs.stat(path + '/' + fileName, function(err, stat) {
        if (err)
          return self.sendError_(req, res, err);
        if (stat.isDirectory()) {
          files[index] = fileName + '/';
        }
        if (!(--remaining))
          return self.writeDirectoryIndex_(req, res, path, files);
      });
    });
  });
};

StaticServlet.prototype.writeDirectoryIndex_ = function(req, res, path, files) {
  path = path.substring(1);
  res.writeHead(200, {
    'Content-Type': 'text/html'
  });
  if (req.method === 'HEAD') {
    res.end();
    return;
  }
  res.write('\n');
  res.write('' + escapeHtml(path) + '\n');
  res.write('\n');
  res.write('  ol { list-style-type: none; font-size: 1.2em; }\n');
  res.write('\n');
  res.write('Directory: ' + escapeHtml(path) + '');
  res.write('
*');
  files.forEach(function(fileName) {
    if (fileName.charAt(0) !== '.') {
      res.write('
*' +
        escapeHtml(fileName) + '');
    }
  });
  res.write('');
  res.end();
};

// Must be last,
main(process.argv);


Q: Did I make a good choice in the tenses
I  heard some strange noises for  two days after waking up and it  scared me. I am glad that today I have not heard  them

Is that correct?
I have a doubt because heard indicates that the noises are over  in fact I  don't know (present perfect at the end of the second sentence) so would it be better to write  "I have been hearing or have heard , it has been scaring or has scared

A: Yes, completely correct.  Just be sure to end the sentence with a period.
"Scared" is a good choice, as it scared you in the past to a degree.  The reader will infer that you are still scared, though perhaps not quite as much.
"I have not heard them" is a good choice, as it conveys that they might still be there or you might still yet hear them soon, but today you have not heard them.  Maybe the cause of those noises is gone; maybe not.
"I am glad that I have not heard them today" is slightly more colloquial and I would prefer that wording if I were writing a narrative story in the present tense, or certainly in a conversation.


Q: java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling I am trying to remove an item from listview which is not starting a specific text "Dev". But the application is crashing when I remove an item and refresh the recycler list via notifydatasetChanged(). This question has been already asked and I have seen all the solutions but I can't find a proper solution to this.
EvelistAdapter.java
     public class EvelistAdater extends RecyclerView.Adapter<EvelistAdater.ViewHolder> {
    Context cxt;
    ArrayList<Dbbean> adapterlist;
    int row_index;
    public EvelistAdater(Context cxt, ArrayList<Dbbean> list) {
        adapterlist=list;
        this.cxt=cxt;
        Log.d("LIst count",""+adapterlist.size());
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.scanlistadp, viewGroup, false);
        return  new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {

        if(adapterlist.get(position).blename.startsWith("Dev")) {
            holder.tv_country.setText(adapterlist.get(position).blename);

        }else{
            removeAt(position);
        }
    }

    @Override
    public int getItemCount() {
        return adapterlist.size();
    }
    public class ViewHolder extends RecyclerView.ViewHolder{
        TextView tv_country;
        RelativeLayout layout;
        ImageView setting;
        public ViewHolder(View view) {
            super(view);
            tv_country = (TextView)view.findViewById(R.id.tshirtname);
            setting = (ImageView) view.findViewById(R.id.setting);
            layout = (RelativeLayout)view.findViewById(R.id.layout);
        }
    }
    public void removeAt(int position) {
        adapterlist.remove(position);
        notifyDataSetChanged();
    }
}

LOGCAT
E/UncaughtException: java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
                                                                        at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:2586)
                                                                        at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(RecyclerView.java:4951)
                                                                        at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:11371)
                                                                        at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:11362)
                                                                        at android.support.v7.widget.RecyclerView$Adapter.notifyItemChanged(RecyclerView.java:6650)
                                                                        at com.scanner.com.eve.EvelistAdater.removeAt(EvelistAdater.java:94)
                                                                        at com.scanner.com.eve.EvelistAdater.onBindViewHolder(EvelistAdater.java:44)
                                                                        at com.scanner.com.eve.EvelistAdater.onBindViewHolder(EvelistAdater.java:19)
                                                                        at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6354)
                                                                        at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6387)
                                                                        at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5343)
                                                                        at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5606)
                                                                        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5448)
                                                                        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5444)
                                                                        at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
                                                                        at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
                                                                        at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
                                                                        at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
                                                                        at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3600)
                                                                        at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3329)
                                                                        at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3867)
                                                                        at android.view.View.layout(View.java:16655)
                                                                        at android.view.ViewGroup.layout(ViewGroup.java:5438)
                                                                        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
                                                                        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
                                                                        at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
                                                                        at android.view.View.layout(View.java:16655)
                                                                        at android.view.ViewGroup.layout(ViewGroup.java:5438)
                                                                        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
                                                                        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
                                                                        at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
                                                                        at android.view.View.layout(View.java:16655)
                                                                        at android.view.ViewGroup.layout(ViewGroup.java:5438)
                                                                        at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:636)
                                                                        at android.view.View.layout(View.java:16655)
                                                                        at android.view.ViewGroup.layout(ViewGroup.java:5438)
                                                                        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
                                                                        at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
                                                                        at android.view.View.layout(View.java:16655)
                                                                        at android.view.ViewGroup.layout(ViewGroup.java:5438)
                                                                        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
                                                                        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
                                                                        at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
                                                                        at android.view.View.layout(View.java:16655)
                                                                        at android.view.ViewGroup.layout(ViewGroup.java:5438)
                                                                        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
                                                                        at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
                                                                        at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2895)
                                                                        at android.view.View.layout(View.java:16655)
                                                                        at android.view.ViewGroup.layout(ViewGroup.java:5438)
                                                                        at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
                                                                        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
                                                                        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
                                                                        at android.view.ViewR

A: Filter the data in list before passing to Adapter
 ArrayList<Dbbean> list = yourlist;

Create a filtered list
  ArrayList<Dbbean> filteredList = new ArrayList<>();
  for(Dbbean dbean : list){
    if(dbean.blename.startsWith("Dev")
     filteredList.add(dbean);
  }

Pass filtered list to Adapter
EvelistAdapter adapter = new EvelistAdaptr(this,filteredList);
yourRecyclerView.setAdapter(adapter);

A: Do not call removeItem inside onBindViewHolder directly. If you want to remove item then just do it before setting adapter.
Provide the filtered ArrayList<Dbbean> list to adpater in first place .Later you can remove item from adapter on any specified action.
 Do not use notifyDataSetChanged() until you are not sure which dataset is changed. Use :
notifyItemRemoved() for a particular item removed for position .

A: this is causing the problem you are just forcefully making changes to the onBindViewHolder which is drawing something right now again to redraw.
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {

    if(adapterlist.get(position).blename.startsWith("Dev")) {
        holder.tv_country.setText(adapterlist.get(position).blename);

    }else{
        removeAt(position);
    }
}

public void removeAt(int position) {
    adapterlist.remove(position);
    notifyDataSetChanged();
}

suggestion better check this condition and remove the items when you are about to notify the adapter from fragment or activity.


Q: persistent vs immutable data structure Is there any difference in a persistent and immutable data structure? Wikipedia refers to immutable data structure when discussing persistence but I have a feeling there might be a subtle difference between the two.

A: Immutability is an implementation technique. Among other things, it provides persistence, which is an interface. The persistence API is something like:

*

*version update(operation o, version v) performs operation o on version v, returning a new version. If the data structure is immutable, the new version is a new structure (that may share immutable parts of the old structure). If the data structure isn't immutable, the returned version might just be a version number. The version v remains a valid version, and it shouldn't change in any observe-able way because of this update - the update is only visible in the returned version, not in v.

*data observe(query q, version v) observes a data structure at version v without changing it or creating a new version.

For more about these differences, see:

*

*The chapter "Persistent data structures" by Haim Kaplan in Handbook on Data Structures and Applications

*"Making Data Structures Persistent" by Driscoll et al.

*The first lecture of the Spring 2012 incarnation of MIT's 6.851: Advanced Data Structures

A: Yes, there is a difference.  An immutable data structure cannot be modified in any way after its creation. The only way to effective modify it would be to make a mutable copy or something similar (e.g. slightly modifying the parameters you pass to the constructor of the new one). A persistent data structure, on the other hand, is mutable in the sense that the exposed API appears to allow changes to the data structure. In truth, though, any changes will retain a pointer to the existing data structure (and therefore every preceding structure); they only seem to mutate the data structure because the exposed API returns a new pointer that may include pointers to a subset of the previous data structure (in trees, e.g., we will point at the node whose subtree hasn't changed as a result of the operation).


Q: Action Script: Drawing on video I was wondering how to draw over a video like this.
http://www.bannerblog.com.au/2009/06/burger_king_sharpie.php

A: I'm not sure that in the example is drawing process over video. As for me It's a 3d model with video background. And you could sync prerecorded states with 3d object transformations (position, rotation, mesh transformations), or create well textured object.
Here for your tutorial how to draw over the 3D objects

A: Easy! Use Adobe After Effects (or any number of other compositing programs).


Q: SQL 'belong to' logic So, I have been trying to write a query in SQL but facing an issue. I am trying to write a 'belongs to' kind of condition. What I want to do is if the values being fetched belongs to a column in another table then populate one thing otherwise populate null.
for ex.
NAME table
ID    NAMES
1      A
2      B
3      C
4      D
5      E

XYZ table
ID
2
4
5

I wrote the query something like this
(CASE WHEN NAME.ID IN (SELECT ID FROM XYZ) THEN NAME.NAMES ELSE NULL END ) AS 'ABC'

This query does run but it has been running for 14 hours (OBVIOUSLY FOR A VERY HUGE AMOUNT OF DATA) and still there is no result.  Is there some flaw in this logic or is there some better way it could be done?
I expect a result like this:
ABC
NULL
B
NULL
D
E

A: You just need a plain left join here:
SELECT
    CASE WHEN t2.ID IS NOT NULL THEN t1.NAMES END AS ABC
FROM NAME t1
LEFT JOIN XYZ t2
    ON t1.ID = t2.ID;

Demo
Note that a CASE expressions else condition, if not explicitly specified, defaults to NULL.  This behavior works here because you want to render NULL if a given record in the NAME table does not match to any record in the XYZ table.

A: The problem isn't your logic.  It is simply how the code is optimized.  The subquery is probably being run for each row in the outer query.
I would recommend switching to exists:
(case when exists (select 1 from xyz where xyz.id = name.id) then name.names
 end) as abc

This maintains the semantics of your original query.  In particular, there is no danger that duplicates in xyz would return multiple rows (as would happen with a left join).
For performance for this -- or for the left join -- you want an index on xyz(id).


Q: Angular2: Too many calls on Observable So currently I created a service in order to path data from one component to another. Let's say I have a select component and a component factory. In order to pass a selected value from a select component to factory I designed this service.
Here is how the service looks like:
import { Injectable } from '@angular/core';
import {Subject} from "rxjs/Subject";

@Injectable()
export class ObservableService {
    private dataSource = new Subject();
    data = [];
    data$ = this.dataSource.asObservable();

    updateFilter(value) {
        this.data.push(value);
        console.log('Changes transfer');
        this.dataSource.next(this.data)
    }
}

So, as I said I have to path data from my html select input that belongs to select component to factory, and here is the select component html
<select (change)="onChange($event)">
    <option value="">Options</option>
    <option *ngFor="let option of options" [value]="option.value">{{ option.name }}</option>
</select>

And here is the way I sending selected value from select component to observable service:
private onChange(option) {
    console.log('Changes sent');
    this._observable.updateFilter(option);

}
Here is how I'm catching data in factory component
ngOnInit() {
    this._observable.data$.subscribe(
        data => console.log('Changes detected');
    )
}

You may notice console commands that I put on each stage of data transfer. And in fact I got this:
Changes sent
Changes transfer
(13) Changes detected

So in fact the observable subscriber detected 13 changes! Please, help me to understand where this strange behavior goes from?


Q: Issues with https:// non-www re-directing to https://www I have a website which has recently moved from http:// to https://
The site is built with MVC hosted on IIS7, and I know I should have 4 bindings in place for this.
the main one:
https://www.example.com (port:443 - ip address: *)
and 3 others all to 301 re-direct to the above.
    http://www.example.com - (port:80 - ip address: * -re-direct works)
    http://example.com - (port:80 - ip address: * -re-direct works)
    https://example.com - (port:443 - ip address: * -re-direct does not work)

Trying to troubleshoot why the bottom one is failing with Site could not be reached. server DNS address could not be found.
Below is the code I am using to re-direct http to https
            // The base only redirects GET, but we added HEAD as well. This avoids exceptions for bots crawling using HEAD.
            // The other requests will throw an exception to ensure the correct verbs are used.
            // We fall back to the base method as the mvc exceptions are marked as internal.

            if (!String.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase)
                && !String.Equals(filterContext.HttpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase))
            {
                base.HandleNonHttpsRequest(filterContext);
            }

            // Redirect to HTTPS version of page
            // We updated this to redirect using 301 (permanent) instead of 302 (temporary).
            string url = "https://" + filterContext.HttpContext.Request.Url.Host + filterContext.HttpContext.Request.RawUrl;

            filterContext.Result = new RedirectResult(url, true);

Any ideas what is going wrong here with the bottom binding? Trying to set up 4th property on Google Webmaster Search Console and obviously can't due to failing DNS.
Any help at all is greatly appreciated. Cheers

A: It's better do this kind of thing on web-server level rather than in app code.
For IIS, you need to change file Web.config by adding a rewrite rules.
I was not able to test it, but you should add something like that:
<rewrite>
  <rules>
    <rule name="Redirect to www" patternSyntax="Wildcard" stopProcessing="true">
      <match url="*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="example.com" />
      </conditions>
      <action type="Redirect" url="http://www.example.com/{R:0}" />
    </rule>

    <rule name="HTTP Redirect to HTTPS" enabled="true" stopProcessing="true">
      <match url="(.*)" ignoreCase="false" />
      <conditions>
        <add input="{HTTPS}" pattern="off" />
      </conditions>
      <action type="Redirect" url="https://www.example.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
    </rule>
  </rules>

A: The issue was with the DNS on our domain provider.


Q: Message size exceeds capabilities of MX One sender (@gmx.net) to my mailserver received an error message:

Message size exceeds capabilities of MX responsible for the recipient

I increased the message_size_limit from 10240000 to 20480000, but I'm not sure that this will help as I thought the error message relevant to the message_size_limit should be Message size exceeds fixed limit instead. I never heard about that capabilities of the MX.
Q: What does the error mean ? How to "fix" ?

A Google search was of no help:

*

*only 17 (not helpful) results for Message size exceeds capabilities of MX responsible for the recipient

*but 14.700 results for Message size exceeds fixed limit

I use tomav/docker-mailserver.
(Maybe) relevant configuration:
mailbox_size_limit = 0
virtual_mailbox_limit = 51200000

A: I could imagine that the free space of the partition of the postfix queue is not enough. I can still remember times when Docker only provided 10GB for the container partition. Depending on which configuration you are using, this could be a problem. Alternatively, mailbox_size_limit or virtual_mailbox_limit should be increased.
What exactly does postconf message_size_limit say?
For an exact answer, more information would be necessary, since I don't know the container, I can't go into it further.


Q: Generalized Eulerian polynomials Define polynomials $S_{k,n}(x)$ by
$$\sum_{j\ge 0}\binom{k+j}{k}^n x^j=\frac{ S_{k,n}(x)}{(1-x)^{k n+1}},$$ which for $k=1$ reduce to the Eulerian polynomials.
Computatios suggest that $$S_{k,n}(1)=\frac{(kn)!}{k!^n}.$$
Any idea how to prove this? Have these polynomials been studied in the literature?

A: A simple idea is to use the following "Abelian-type theorem" (with an easy proof):

Suppose that $a(x)=\sum\limits_{j\geqslant 0}a_j x^j$ and $b(x)=\sum\limits_{j\geqslant 0}b_j x^j$ converge when $|x|<1$, with $b_j>0$, and $\lim\limits_{x\to 1^-}b(x)=\infty$. If $\lim\limits_{j\to\infty}\dfrac{a_j}{b_j}=\lambda$ exists then $\lim\limits_{x\to 1^-}\dfrac{a(x)}{b(x)}=\lambda$.

Take $a_j=\binom{k+j}{k}^n$, $b_j=\binom{kn+j}{kn}$, and use $\lim\limits_{j\to\infty}\frac1{j^m}\binom{m+j}{m}=\frac1{m!}$, $\sum\limits_{j\geqslant 0}\binom{m+j}{m}x^j=(1-x)^{-m-1}$.


Q: Illegal mix of collations for operation ' IN ', While using LINQ Lambda with contains clause I am having Linq query that fetch city names as keyValue pair, Refer below code
 public List<KeyValuePair<string, int>> GetCityKeyValuesByNames(List<string> cityNames)
        {

                var cityList = _cityRepo
                    .GetConditionalQuery(x => cityNames.Contains(x.Name))
                    .Select(x => new { Key = x.Name, Value = x.Id })
                    .AsEnumerable()
                    .Select(x => new KeyValuePair<string, int>(x.Key, x.Value))
                    .ToList();

                return cityList;
        }

However we getting Eception MySql.Data.MySqlClient.MySqlException: Illegal mix of collations for operation ' IN ', How I can control the collation in EF Linq query?


Q: Balanced, center-free set. We say that a finite set $\mathcal{S}$ of points in the plane is balanced if, for any two different points $A$ and $B$ in $\mathcal{S}$, there is a point $C$ in $\mathcal{S}$ such that $AC=BC$. We say that $\mathcal{S}$ is center-free if for any three different points $A$, $B$ and $C$ in $\mathcal{S}$, there is no points $P$ in $\mathcal{S}$ such that $PA=PB=PC$.

*

*Show that for all integers $n\ge 3$, there exists a balanced set consisting of $n$ points.

*Determine all integers $n\ge 3$ for which there exists a balanced center-free set consisting of points.


Q: iOS framework to get audio in from dock connector How would I go abouts playing an 'audio in' through the dock connector in an iOS app? I'm making an app just for myself and have no plans of putting it into the apple store. I have the 30pin breakout board, and on it there are pins for L/R audio in, but I can not find any info on how to use them?
Thanks

A: As far as I'm aware, your only officially supported option for any accessory using the dock connector would be to use the External Accessory Framework, which requires enrollment in the Made for iPod Program (overkill for your purposes). However, the iPhone and iPod both support line-in via the headphone jack, and there are plenty of apps that make use of audio input. At least it provides some possibilities.

A: Have you looked at the pinouts for the dock connector floating about? It appears that certain resistances connected to pin 21 indicate to the iDevice what is connected.
68kΩ seems to be the magic number for audio in/out.


Q: Deep doubt on a double surface integral I don't understand how to proceed with an exercise. I will write down what I have done so far.
The exercise is:

Evaluate the following integral $$\iint_{\Sigma}\dfrac{1}{x^2+y^2}\ \text{d}\sigma $$
Where $\Sigma = \{(x, y, z): x^2+ y^2 = z^2+1,\ 1\leq z \leq 2 \}$

My attempt
I wrote
$$z = \sqrt{x^2+y^2-1} ~~~~~~~ \text{with} ~~~~~~~ 2 \leq x^2+y^2 \leq 5$$
Hence I fond a parametrisation curve like
$$\phi: \begin{cases}
x = t \\
y = s \\
z = \sqrt{t^2+s^2-1}
\end{cases}
$$
Now I have to calculate the vector product of the partial derivatives gradients (I know I am expressing myself in a bad language, I apologise):
$$\frac{\partial \phi}{\partial t} = \left(1,\ 0,\ \dfrac{t}{\sqrt{t^2+s^2-1}}\right)$$
$$\frac{\partial \phi}{\partial s} = \left(0,\ 1,\ \dfrac{s}{\sqrt{t^2+s^2-1}}\right)$$
Hence
$$\frac{\partial \phi}{\partial t} \wedge \frac{\partial \phi}{\partial t} = \text{det}\begin{pmatrix}
i & j & k \\
1 & 0 & \dfrac{t}{\sqrt{t^2+s^2-1}} \\
0 & 1 & \dfrac{s}{\sqrt{t^2+s^2-1}}
\end{pmatrix}
$$
Which lead me to
$$\bigg|\bigg| \frac{\partial \phi}{\partial t} \wedge \frac{\partial \phi}{\partial t}\bigg|\bigg| =
\sqrt{\dfrac{2(t^2+s^2)-1}{t^2+s^2-1}}
$$
Now I should evaluate the integral but I don't know how to proceed since I would get
$$\iint_{\Sigma} \dfrac{1}{s^2+t^2} \sqrt{\dfrac{2(t^2+s^2)-1}{t^2+s^2-1}}\ \text{d}\sigma\ \text{d}s$$
And I cannot continue...
I should get $3\pi$ as a result. Can anyone help me?
Thank you!

A: It is easy if you use the fact that $\Sigma$ have rotational symmetry around $z$ axis :
$$\iint_\Sigma\frac{d\sigma}{x^2+y^2}=\iint_\Sigma\frac{d\sigma}{z^2+1}=\int_1^2\frac{2\pi\sqrt{z^2+1}}{z^2+1}\sqrt{1+\bigg(\frac{d(\sqrt{z^2+1})}{dz}\bigg)^2}dz$$$$=2\pi\int_1^2\frac{\sqrt{2z^2+1}}{z^2+1}dz.$$
However, I don't think 3$\pi$ is the value of the integral. When I did numerical calculation of this integral, it gave me approx. $4.5595$, which clearly is not $3\pi$. Also Mathematica yields : $$2\pi\int_1^2\frac{\sqrt{2z^2+1}}{z^2+1}dz=\pi\bigg(2\sqrt{2}\Big(\arcsin(2\sqrt{2})-\arcsin(\sqrt{2})\Big)+\log((2+\sqrt{3})/5)\bigg)$$


Q: Firebase Web Version 9 updateProfile not updating the authorized user I'm using Firebase Web version 9 in a react app. I have a sign-up form with first name, email, and password inputs. When the form is submitted, I need to create an authorized user with Firebase and immediately update that new user's first name and profile picture.
I'm using two Firebase auth functions - createUserWithEmailAndPassword() and updateProfile(). A new user is always created when the form is submitted, but the profile updates only happen once in a while. I haven't been able to pinpoint the cases when the profile update is successful.
Any ideas on what I'm missing? Would love some feedback and guidance. Thank you!
Here's the code for the sign-up page.
import { useState, useEffect } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import {
  StyledHeader,
  StyledFooter,
  StyledDropdown,
  StyledForm,
} from '../styles';
import {
  getAuth,
  createUserWithEmailAndPassword,
  updateProfile,
} from 'firebase/auth';
import { ShortFooter, LanguageSelect, Form } from '../components';
import { logo, p1, p2, p3, p4, p5 } from '../assets';

const SignUp = ({ children }) => {
  const [firstName, setfirstName] = useState('');
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');
  const [isFirstNameEmpty, setIsFirstNameEmpty] = useState(true);
  const [isEmailEmpty, setIsEmailEmpty] = useState(true);
  const [isPasswordEmpty, setIsPasswordEmpty] = useState(true);
  const [error, setError] = useState('');
  const [checked, setChecked] = useState(true);
  const [isShown, setIsShown] = useState(true);
  const isInvalid = firstName === '' || email === '' || password === '';
  const navigate = useNavigate();
  const userProfileImgs = [p1, p2, p3, p4, p5];

  useEffect(() => {
    setTimeout(() => {
      //  scroll to top on page load
      window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
    }, 100);
  }, []);

  const handlefirstNameChange = (firstName) => {
    if (firstName.length !== 0) {
      setIsFirstNameEmpty(false);
    } else {
      setIsFirstNameEmpty(true);
    }
  };

  const handleEmailChange = (email) => {
    if (email.length !== 0) {
      setIsEmailEmpty(false);
    } else {
      setIsEmailEmpty(true);
    }
  };

  const handlePasswordChange = (password) => {
    if (password.length !== 0) {
      setIsPasswordEmpty(false);
    } else {
      setIsPasswordEmpty(true);
    }
  };

  const handleCheckbox = () => {
    setChecked((checked) => !checked);
  };

  const handleLearnMore = (e) => {
    e.preventDefault();
    setIsShown((isShown) => !isShown);
  };

  const handleSignUp = async (e) => {
    e.preventDefault();

    try {
      // firebase work!
      const auth = getAuth();
      let { user } = await createUserWithEmailAndPassword(
        auth,
        email,
        password
      );
      console.debug(`User ${user.uid} created`);

      // updating the user's profile with their first name and a random profile image
      await updateProfile(user, {
        displayName: firstName,
        photoURL:
          userProfileImgs[Math.floor(Math.random() * userProfileImgs.length)],
      });
      console.debug(`User profile updated`);

      // navigate to the profile page
      navigate('/profile');
    } catch (e) {
      if (e.message === 'Firebase: Error (auth/email-already-in-use).') {
        setError('That email is already in use, please try again.');
      }
    }
  };

  return (
    <>

          </form>

                </ShortFooter>
              </StyledFooter>

        {children}
      </StyledHeader>
    </>
  );
};

export default SignUp;

This is the error I'm getting in the console.
Error

A: Based on how my app was set up I ultimately decided to remove the photoURL property altogether since it could be defined elsewhere in the app. After testing, only one of my images worked. This is why I experienced the full profile updates working out sometimes since random images were selected each time a new user signs up. I ended up sticking wth this image as the default image.
As @adsy mentioned, my profile updates weren't happening consistently because certain profile images I had exceeded the allowed input body length for this property. The example in the Docs shows a link with 43 characters but no other information. The path to the profile images in the question are much shorter than this so I still need some understanding.
After researching a bit, I didn't come across the maximum limit set. It's now something to contact Google Developer's support team about. If anyone has the information for the allowed input body length for this property, feel free to share it on this post.
Thanks!
 const handleSignUp = async (e) => {
    e.preventDefault();

    try {
      // firebase work!
      const auth = getAuth();
      let { user } = await createUserWithEmailAndPassword(
        auth,
        email,
        password
      );
      console.debug(`User ${user.uid} created`);

      // updating the user's profile with their first name
      await updateProfile(user, {
        displayName: firstName,
      });
      console.debug(`User profile updated`);

      // navigate to the profile page
      navigate('/profile');
    } catch (e) {
      if (e.message === 'Firebase: Error (auth/email-already-in-use).') {
        setError('That email is already in use, please try again.');
      }
    }
  };


Q: How to search in string for  inside of  and unwrap it with PHP What is the best way to reformat the HTML with PHP. Put span tag outside of a tag?
This:

    Text Link

To:

    Text Link

A: You can make a good use of preg_match function:
$str = '

            Text Link

';

if(preg_match('/^(\
).*(\).*(\)([0-9a-zA-Z ]*).*$/is', $str, $regs))
{
    // $regs = [
    //    0 => ... (original string)
    //    1 => '
',
    //    2 => '',
    //    3 => '',
    //    4 => 'Text Link']
    $newStr = $regs[1].$regs[3].$regs[2].$regs[4].'
';
}

You may have to change the [0-9a-zA-Z ]* in regular expression to match your links format.
If input HTML is multiple line text then you have to use s modifier after the regular exception, I also used i as case insensitive just to be sure noone mixed
 and
 tag together and so on...
Note that this if fairly specific solution and for more general solution you should use something like loading HTML into DOM and working with nodes, but this is pretty simple and quick solution for this particular case.


Q: np.insert() -1 as the position of an element I am playing with the NumPy library and there is a behaviour that I do not understand:
I defined a simple vector Y:
Y = np.array([6,7,8],dtype = np.int16)

Then, I tried to add an additional element at the end of the array using the np.insert()  method. I specified the position to be at -1:
Z = np.insert(Y,(-1),(19))

My element was inserted not on the last, but on the penultimate position:
Output
Could somebody explain my why this element was not inserted at the end of my array?

A: Negative indexes are calculated using len(l) + i (with l being the object and i being the negative index).
For example, with a list x = [1, 2, 3, 4] the index -2 is calculated as 4-2 = 2, so x[-2] returns 3
In this example, the index -1 is calculated as index 2
Therefore, 19 is inserted at index 2, the penultimate position. To fix this, use Z = np.insert(Y, len(Y), 19).
PS - this is the same with list.insert, not just with numpy arrays
Edit (suggested by Homer512): np.append may be easier than np.insert if you want to add to the end of an array: Z = np.append(Y, 19)


Q: why the computed method work on only one record? i did this method which compute the late hours of an employee and convert it at days in dedication filed on payslip, it working well but when there is more than one payslip and i need to get the sumition of dedication field of all payslips for an employee it give me just one record and return other records = 0.00 ,
here the methode
@api.multi
@api.depends('date_to','date_to','employee_id')
def compute_amount(self):
    for rec in self:
        rec.attend = self.env['hr.attendance'].search(
            [('check_in', '>=', rec.date_from), ('check_out', '<=', rec.date_to),
             ('employee_id', '=', rec.employee_id.id), ])
        late=[float(s.late) for s in rec.attend]
        tot_late= float(sum(late))
    rec.dedication = tot_late / 8
    pass

dedication = fields.Float(string="Dedication",  required=False,compute=compute_amount )

if i try to print all record i get a list like this [0.0, 0.0, 1.7551388888888888] if there is 3 payslips the list return only one record with the real value and other record = 0
any help will be apriciated

A: It's probably because the rec.dedication = tot_late / 8 is outside the for rec in self loop. Which means the value is only set on the last record it computes.
Also, the pass value seems unnecessary here.


Q: Visualforce apex:outputlink Chrome to Internet Explorer Any one know how to open a folder link from chrome in Windows Explorer/Intenet Explorer?
Our users use Chrome and need to open a network drive from their Salesforce. to get more flexibility, I used a Visualforce page and used outputlink. Works fine, but then want to have to see those files in Window Explore so they can upload all that.
<apex:outputlink value="{!'file://corp/shared/ARCHIVE/HSBOX/home/Builds/' +SUBSTITUTE(Opportunity.Name, ' ', '%20')}" id="theLink" target="_blank">

Any pointers?

A: You can have your users install the Chrome plugin 'IE Tab' it has over 3 million users and has been around since 2009. You can find it here:
https://chrome.google.com/webstore/detail/hehijbfgiekmjfkfjpbkbammjbdenadd
Although, this only works on Windows and requires a .exe file installation, however, they do have enterprise installation options available if you contact them.


Q: No traffic tc class at bridge interface I make bridge interface like this
[root@]# brctl show
bridge name bridge id       STP enabled interfaces
br67        8000.002655e38b20   no      eth6
                                        eth7

and I make tc class like this
tc qdisc add dev br67 root handle 1:0 htb default 2
tc class add dev br67 parent 1:0 classid 1:1 htb rate 1000mbps ceil 1000mbps
tc class add dev br67 parent 1:1 classid 1:2 htb rate 1000mbps ceil 1000mbps

But, when I monitoring using watch /sbin/tc -s -d class show dev br67
there is no traffic like this
class htb 1:1 root rate 8000Mbit ceil 8000Mbit burst 0b/8 mpu 0b overhead 0b cburst 0b/8 mpu 0b overhead 0b level 7
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 15 ctokens: 15

class htb 1:2 parent 1:1 prio 0 quantum 200000 rate 8000Mbit ceil 8000Mbit burst 0b/8 mpu 0b overhead 0b cburst 0b/8 mpu 0b overh
ead 0b level 0
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 15 ctokens: 15

when using tcpdump -i br67 there is a traffic like this
10:25:35.048982 IP 122.189.906.11.64850 > 11.13.153.110.mxi: UDP, length 1470
10:25:35.064462 IP 122.189.906.11.64850 > 14.13.153.110.mxi: UDP, length 1470

when I make tc class using physical interface like tc class add dev eth6  .. or tc class add dev eth7  ..
I could watch traffic at tc class
Is it impossible to control traffic using tc command at bridge interface?


Q: uisng multer with typescript: Property 'file' does not exist on type 'Request'.ts(2339) I am using https://www.npmjs.com/package/multer library and my node.js app is written in typescript.
I get the following typescript error in my code.

Property 'file' does not exist on type 'Request'.ts(2339)

    public document = async (req: Request, res: Response): Promise<any> => {
        const documentFile = req.file;
    }

How can i resolve this. The req is the express Request object but multers middleware appends a .file into this request object. However it is not aware of this because the types request interface does not originally contain a file properly

A: Like @daliusd mentioned in his answer, the accepted answer here should be:
npm i @types/multer --save-dev
req.files is now typed and recognized by the Typescript compiler.

A: Probably we can just extend Request
interface MulterRequest extends Request {
    file: any;
}

 public document = async (req: Request, res: Response): Promise<any> => {
   const documentFile  = (req as MulterRequest).file;
 }

or may be like this code
interface MulterRequest extends Request {
    file: any;
}

 public document = async (req: MulterRequest , res: Response): Promise<any> => {
   const documentFile  = req.file;
 }

A: Or install @types/multer with
npm i @types/multer --save-dev

and check out this https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18569

A: if using typescript with express-fileupload you can install @types/express-fileupload as dev dependencie and it will be solved


Q: Apache Beam count HBase row block and not return Start to try out the Apache Beam and try to use it to read and count HBase table. When try to read the table without the Count.globally, it can read the row, but when try to count number of rows, the process hung and never exit.
Here is the very simple code:
Pipeline p = Pipeline.create(options);

p.apply("read",    HBaseIO.read().withConfiguration(configuration).withTableId(HBASE_TABLE))
  .apply(ParDo.of(new DoFn<Result, String>() {
   @ProcessElement
   public void processElement(ProcessContext c) {
        Result result = c.element();
        String rowkey = Bytes.toString(result.getRow());
        System.out.println("row key: " + rowkey);
        c.output(rowkey);
   }
}))
.apply(Count.<String>globally())
.apply("FormatResults", MapElements.via(new SimpleFunction<Long, String>() {
      public String apply(Long element) {
          System.out.println("result: " + element.toString());
          return element.toString();
      }
 }));

when use Count.globally, the process never finish. When comment it out, the process print all the rows.
Anyy ideas?

A: Which version of beam are you using?
Thanks for bringing this issue. I tried to reproduce your case and indeed there seems to be an issue with colliding versions of guava that breaks transforms with HBaseIO. I sent a pull request to fix the shading of this, I will keep you updated once it is merged so you can test if it works.
Thanks again.


Q: Getting error Uninitialized ASN.1 value when trying to use pympler.tracker.SummaryTracker() I have a memory leak in my python2.7 code and I'm trying to debug it using pympler.
Traceback (most recent call last):
  File "eta/dynamic_eta_worker.py", line 29, in <module>
    tr = tracker.SummaryTracker()
  File "/usr/local/lib/python2.7/site-packages/pympler/tracker.py", line 45, in __init__
    self.s0 = summary.summarize(muppy.get_objects())
  File "/usr/local/lib/python2.7/site-packages/pympler/summary.py", line 131, in summarize
    total_size[otype] = _getsizeof(o)
  File "/usr/local/lib/python2.7/site-packages/pyasn1/type/base.py", line 145, in plug
    raise error.PyAsn1Error('Uninitialized ASN.1 value ("%s" attribute looked up)' % name)
pyasn1.error.PyAsn1Error: Uninitialized ASN.1 value ("__sizeof__" attribute looked up)

Tried to search here and in google and came out with nothing.
The thing is that when I call pympler.tracker.SummaryTracker() from the python console it works like a charm.
Thanks.

A: pip install -U pyasn1

please try to upgrade pyasn1 version


Q: Localizing XIB files - why there is a need I am beginner in iOS.
I learned how to localize XIB files.
This way two versions of my XIB file are created, say one for
English version and one for Spanish.
Here is sample of the spanish localized XIB:

I was curious why there is need for localizing XIB files?
I know how to localize any string using string tables
and NSLocalizedString() method. Is localizing XIB files
good because it is not possible/easy to use localized strings as titles
for the controls in the interface builder?

A: If you move to storyboards and autolayout you don't need to localize your UI, you just need to provide the localised strings files.

A:
Is localizing XIB files good because it is not possible/easy to use
  localized strings as titles for the controls in the interface builder?

The backside is, when you need to show a message to the user sometimes needed the label localized text without colon. The xib provides name with colon and without. Sometimes hard to keep in evidence what / where is in localized xib.
You can make an utility software to make easier the localisation of strings and editing those inline with many languages. That why I prefer strings localized over xib.


Q: How to start and stop jboss from apache ant build.xml file I have make
jar
war
EAR
using ant and Hudson and store all files at some temp folder
now I want to copy all war and ear files to jboss jboss/default/deploy folder using Apache ANT
How can I do this??
Following is my master build file
which call all other build.xml files and make jar war ear files
but after making this all files this don't copy all any of the files to jboss/default/deploy folder
<copy todir="${jbossdeploy.dir}" overwrite="yes">
        <fileset dir="${class.dir}/ear" includes="MessageBoardEAR.ear"/>

    </copy>

<project name="master" >

    <property name="class.dir" location="../Source/buildwork" />
    <property name="ecpsproperties.dir" location="D:\ecpsproperties\jars\platform" />
    <property name="jbossdeploy.dir" location="D:\jboss-6.1.0.Final\server\default\deploy" />

    <target name="clean">
        <delete dir="${class.dir}" />

    </target>

    <target name="makedir">
        <mkdir dir="${class.dir}" />
        <mkdir dir="${class.dir}/jar" />
        <mkdir dir="${class.dir}/ear" />
        <mkdir dir="${class.dir}/war" />
    </target>

<filelist id="projects" dir=".">
        <file name="../Source/ValueObjects/build.xml"/>
        <file name="../Source/ECPSValueObjects/build.xml"/>
        <file name="../Source/ECPSUtils/build.xml"/>
        <file name="../Source/CommonExceptions/build.xml"/>
         <file name="../Source/ECPSExceptions/build.xml"/>
         <file name="../Source/ECPSCommon/build.xml"/>
         <file name="../Source/BaseDAO/build.xml"/>
         <file name="../Source/PageManagerValueObjects/build.xml"/>
         <file name="../Source/PageManagerDAO/build.xml"/>
         <file name="../Source/ECPSDAO/build.xml"/>
         <file name="../Source/PageManagerEJBClient/build.xml"/>
         <file name="../Source/PartyEJBClient/build.xml"/>
          <file name="../Source/ReportsEJBClient/build.xml"/>
         <file name="../Source/StagingEJBClient/build.xml"/>
          <file name="../Source/MessageBoardEJBClient/build.xml"/>
         <file name="../Source/PageManagerFacade/build.xml"/>
          <file name="../Source/PartyFacade/build.xml"/>
         <file name="../Source/ReportsFacade/build.xml"/>
          <file name="../Source/StagingFacade/build.xml"/>
         <file name="../Source/MessageBoardFacade/build.xml"/>

          <file name="../Source/MessageBoardEJB/build.xml"/>
         <file name="../Source/MessageBoardEAR/build.xml"/>
         <file name="../Source/PageManagerEJB/build.xml"/>
          <file name="../Source/PageManagerEAR/build.xml"/>

           <file name="../Source/PartyEJB/build.xml"/>
         <file name="../Source/PartyEAR/build.xml"/>

         <file name="../Source/ReportsEJB/build.xml"/>
          <file name="../Source/ReportsEAR/build.xml"/>

          <file name="../Source/StagingEJB/build.xml"/>
         <file name="../Source/StagingEAR/build.xml"/>

          <file name="../Source/Admin/build.xml"/>
         <file name="../Source/eCPSClient/build.xml"/>
          <file name="../Source/MessageBoardServices/build.xml"/>
           <file name="../Source/OAuth/build.xml"/>
            <file name="../Source/PageManagerRest/build.xml"/>
             <file name="../Source/PartyServices/build.xml"/>
             <file name="../Source/ReportsServices/build.xml"/>
          <file name="../Source/StagingServices/build.xml"/>

 </filelist>

    <copy todir="${jbossdeploy.dir}" overwrite="yes">
        <fileset dir="${class.dir}/ear" includes="MessageBoardEAR.ear"/>

    </copy>

 <target name="main" depends="clean, makedir">
    <subant>

      <filelist refid="projects" />

    </subant>

 </target>
</project>

A: use copy task e.g.
<copy file="myfile.txt" todir="../some/other/dir"/>

A: this should work as I have added copy task under main :
<project name="master" >

<property name="class.dir" location="../Source/buildwork" />
<property name="ecpsproperties.dir" location="D:\ecpsproperties\jars\platform" />
<property name="jbossdeploy.dir" location="D:\jboss-6.1.0.Final\server\default\deploy" />

<target name="clean">
<delete dir="${class.dir}" />

</target>

<target name="makedir">
<mkdir dir="${class.dir}" />
<mkdir dir="${class.dir}/jar" />
<mkdir dir="${class.dir}/ear" />
<mkdir dir="${class.dir}/war" />
</target>

<filelist id="projects" dir=".">
<file name="../Source/ValueObjects/build.xml"/>
<file name="../Source/ECPSValueObjects/build.xml"/>
<file name="../Source/ECPSUtils/build.xml"/>
<file name="../Source/CommonExceptions/build.xml"/>
<file name="../Source/ECPSExceptions/build.xml"/>
<file name="../Source/ECPSCommon/build.xml"/>
<file name="../Source/BaseDAO/build.xml"/>
<file name="../Source/PageManagerValueObjects/build.xml"/>
<file name="../Source/PageManagerDAO/build.xml"/>
<file name="../Source/ECPSDAO/build.xml"/>
<file name="../Source/PageManagerEJBClient/build.xml"/>
<file name="../Source/PartyEJBClient/build.xml"/>
<file name="../Source/ReportsEJBClient/build.xml"/>
<file name="../Source/StagingEJBClient/build.xml"/>
<file name="../Source/MessageBoardEJBClient/build.xml"/>
<file name="../Source/PageManagerFacade/build.xml"/>
<file name="../Source/PartyFacade/build.xml"/>
<file name="../Source/ReportsFacade/build.xml"/>
<file name="../Source/StagingFacade/build.xml"/>
<file name="../Source/MessageBoardFacade/build.xml"/>

<file name="../Source/MessageBoardEJB/build.xml"/>
<file name="../Source/MessageBoardEAR/build.xml"/>
<file name="../Source/PageManagerEJB/build.xml"/>
<file name="../Source/PageManagerEAR/build.xml"/>

<file name="../Source/PartyEJB/build.xml"/>
<file name="../Source/PartyEAR/build.xml"/>

<file name="../Source/ReportsEJB/build.xml"/>
<file name="../Source/ReportsEAR/build.xml"/>

<file name="../Source/StagingEJB/build.xml"/>
<file name="../Source/StagingEAR/build.xml"/>

<file name="../Source/Admin/build.xml"/>
<file name="../Source/eCPSClient/build.xml"/>
<file name="../Source/MessageBoardServices/build.xml"/>
<file name="../Source/OAuth/build.xml"/>
<file name="../Source/PageManagerRest/build.xml"/>
<file name="../Source/PartyServices/build.xml"/>
<file name="../Source/ReportsServices/build.xml"/>
<file name="../Source/StagingServices/build.xml"/>

</filelist>

<target name="main" depends="clean, makedir">
<subant>

<filelist refid="projects" />

</subant>

<copy todir="${jbossdeploy.dir}" overwrite="yes">
<fileset dir="${class.dir}/ear" includes="MessageBoardEAR.ear"/>

</copy>
</target>
</project>


Q: Storyboard Scene Editor vanished I'm still new to Xcode and developing iOS apps...when I was editing my storyboard, I somehow removed the menu that displays  the list of scenes (which defaults to the right side of the file navigator).
How do you bring this menu/view back up?

A: If I understand what you want you must just click on the button at the bottom in yellow highlight:


Q: Style internal links based on the tags of the linked post When I internally link to one post in the body of another, I’d like the link to be styled based on the tags that the linked post belongs to.
For example, say I have tags “good” and “bad”. When I link to a post that’s tagged “good”, I want the link to be highlighted in green. When I link a post tagged “bad”, I want the link highlighted in red. I want to do this without having to check the tags of every post I link to and manually add a css class to the link each time in order to style it. If I change the tags of a post, I'd like any internal links to that post to update their style to match.
Is there any way to retrieve the tags of a linked post at some point when the linking page is loading, in order to add a css class or otherwise alter the style of the displayed link?


Q: Advantage of Class component over react hooks Every where I see are the advantages of hooks over class component , but still class components in react do exist so can anyone tell me the advantages of class components over hooks?


Q: What is substitute for Magento's transactional email {{skin}} in PHP? I need to achieve this

{{skin url="img/logo.png" _area="frontend" _package="my-package" _theme="default"}}

via PHP. The reason is, rewriting email templates and extracting common templates of headers and footers into PHP part, leaving only text and simple HTML of emails in Magento's admin panel.

A: In a theme template you could use for example
$this->getSkinUrl('img/logo.png', [
    '_area'    => 'frontend',
    '_package' => 'my-package',
    '_theme'   => 'default',
]);


Q: Image options to customize the visibility of tabs Expected behaviour: With respect to my use case, when the user clicks on image button, I must allow the user to only upload the image and hence I have to hide the URL tab.
Actual behaviour:   Currently there is no such option to hide the URL and to display only upload tab.


Q: AHCI and RAID for BIOS settings when using 2 or more SATA hard disk My third-hand desktop machine have the following BIOS settings:

At what scenario should I choose 'RAID' and what scenario should I choose 'AHCI' and what other scenario should I choose 'DISABLED'?

A: Choose Disabled or "IDE" mode only for compatability, which may include installing older operating systems, prior to the system having proper AHCI drivers installed (and set). To get boot when it will not boot any other way (because the drivers are not installed proper).
Optional: leave it on disabled if you just don't care :-) It will always boot if you install without AHCI.
Many bioses Default to "disabled" or "IDE" mode, so remember how it is set-up, if the bios settings are cleared the crasy thing will crash, and then you forgot why :-)
Choose the RAID option when you are going to create an array with more than one disk. When that array is created for the ICH controller via the raid bios. (not when using a software only raid).
Optional, you can still select RAID, and set up the drives as single or not at all, and drives will still work under the raid bios (and drivers) as singles. There is no reason to do this but it is well known that you can have an array created with more than one disk, and have loose singles still using that same settings and driver.
Choose AHCI in all other situations, when no array assembly will be made back in the hardware. Even via slightly older drive items. As long as the driver is set-up in the operating system even older drives will work using that method.  AHCI features are especially faster for SSD drives, and to have full support of SSD features. It makes little differance in speed or responsiveness for the usual Hard Drives.
Hot Swap is also one of the features, although I never would recommend hot swapping when you do not need to.
Changing this with an installed windows operating system can (heck it Will) cause the system to flat out crash, very bad. It should not crash when changing from RAID to AHCI but it still can (raid setting is said to support achi).  You must have the correct driver setup, either in a safe mode, or prior to changing the setting to get normal boot.
That just leaves "how to change from AHCI to IDE modes , and still being able to boot the system without crashing."  That is covered all over the web, and here at SU somewhere also.