Derive prime-identifying functions from inverse Vandermonde and Bernoulli numbers

Question: From the identity $\ln\zeta(s) = \frac{q(1)}{1^{s}}+\frac{q(2)}{2^{s}}+\frac{q(3)}{3^{s}}+\frac{q(4)}{4^{s}}+\ldots$, where $q(n)=
\begin{cases}
\frac{1}{k} & \text {$n={p}^{k}, k \in  \mathbb{N}  $} \\
\text{0}    & \text{otherwise} \\
\end{cases} $:
$$ \begin{pmatrix}
\frac{1}{1^2} & \frac{1}{2^2} & \frac{1}{3^2} & \frac{1}{4^2} & \cdots\\
\frac{1}{1^4} & \frac{1}{2^4} & \frac{1}{3^4} & \frac{1}{4^4}& \cdots\\
\frac{1}{1^6} & \frac{1}{2^6} & \frac{1}{3^6} & \frac{1}{4^6}& \cdots\\
\frac{1}{1^8} & \frac{1}{2^8} & \frac{1}{3^8} & \frac{1}{4^8}& \cdots\\
\vdots & \vdots & \vdots & \vdots & \ddots
\end{pmatrix} \cdot
\begin{pmatrix}
q(1) \\
q(2) \\
q(3) \\
q(4) \\
q(5) \\
\vdots
\end{pmatrix}
= \begin{pmatrix}
\ln\zeta(2) \\
\ln\zeta(4) \\
\ln\zeta(6) \\
\ln\zeta(8) \\
\vdots
\end{pmatrix}
$$
let $A= \begin{pmatrix}
\frac{1}{1^2} & \frac{1}{2^2} & \frac{1}{3^2} & \frac{1}{4^2} & \cdots\\
\frac{1}{1^4} & \frac{1}{2^4} & \frac{1}{3^4} & \frac{1}{4^4}& \cdots\\
\frac{1}{1^6} & \frac{1}{2^6} & \frac{1}{3^6} & \frac{1}{4^6}& \cdots\\
\frac{1}{1^8} & \frac{1}{2^8} & \frac{1}{3^8} & \frac{1}{4^8}& \cdots\\
\vdots & \vdots & \vdots & \vdots & \ddots
\end{pmatrix}, C=\begin{pmatrix}
\ln\zeta(2) \\
\ln\zeta(4) \\
\ln\zeta(6) \\
\ln\zeta(8) \\
\vdots
\end{pmatrix}$, then
$$\begin{pmatrix}
q(1) \\
q(2) \\
q(3) \\
q(4) \\
q(5) \\
\vdots
\end{pmatrix} = A^{-1} \cdot C$$
since $A^{-1}$ is just an inverse Vandermonde, and C is expressible by using Bernoulli numbers ($\ln\zeta(2n)=\ln\left|B_{2n}\right|+2n\ln 2\pi-\ln 2-\ln (2n)!$), we could theoretically get q(n) with only Bernoulli numbers as something more complex. Maybe we have even skipped the use of Riemann zeta zeros.
My question is, is there already something similar to this idea proposed?
P.S. the above is similar to what I posted about a year ago: Get prime number identifying function?
Comment: Have you already tried to get an impression how an inverted $A$ wood look like? Perhaps as an extrapolation from the occurence with finite small sizes to finite greater sizes? It might be that the inversion, perhaps with the help of $LR$-decomposition, leads to divergent series?
Comment: I know that lagrange interpolating can help give the formula of inverse Vandermonde matrices (see [proofWiki](https://proofwiki.org/wiki/Inverse_of_Vandermonde_Matrix)), which is the method I use to try to solve this particular $A^{-1}$, though I haven't made it yet. I don't feel that it will diverge; though A has infinite amounts of rows and columns, I believe taking a limit will make it fine.
Comment: Hmm, in the attempt to invert the Carleman-matrix(see wikipedia) for the function $\exp(x)$ using the LR-decomposition the dot-products of rows- and columns of the inverted LR-components(Pascal-matrix and matrix of Stirlingnumbers 1'st kind) occur the (infinite) harmonic series , or equivalently the formal series for $\log(0)$ so this vandermonde matrix cannot be inverted - just one example to back my warning (or "reservations" or "doubts") here.
Comment: What if let's not make A a matrix with infinite rows/cols - let's make it an n*n matrix, i.e. $A=[a_{ij}]_{n \times n }=[\frac{1}{j^{2i}}]_{n \times n }$. Then $A^{-1}$ should exist because I've checked that det(A) does not equal 0.
Answer: I'm extending on my comments.
To define an inverse of a vandermonde-matrix of infinite size it needs some special care; I don't think, that observation of the behave of inverses with increasing sizes is reliable - it might, however, give a hint for the perspective.
A better parh is in my view to find an analytical expression for the entries in the inverse (depending on r(ow) and c(olumn) index) if this is possible, and use that analytical description for the dot-product with the infinite vector of logarithm of zetas.
One possibility to do this is to look at the triangular and diagonal components of the LDU-decomposition of the Vandermondematrix; that components have exactly determinable inverses, except that in the inversion of the diagonal-matrix expressions like $1/0$ might occur.
Let us use your matrix $A$ and find the three matrices $L$,$D$,$U$ by ldu-decomposition for some finite size. We find the following top-left segments of the matrices $L$,$D$,$U$ one below the other:
<code>  L:
  1          0                  0                    0                        0                    0  |
  1          1                  0                    0                        0                    0  |
  1        5/4                  1                    0                        0                    0  |
  1      21/16              49/36                    1                        0                    0  |
  1      85/64          1897/1296              205/144                        1                    0  |
  1    341/256        69553/46656          32197/20736                5269/3600                    1  |
  1  1365/1024    2515513/1679616      4741165/2985984        20881861/12960000            5369/3600  |
  1  5461/4096  90663937/60466176  686641813/429981696  77087691109/46656000000      7139587/4320000  |
  -          -                  -                    -                        -                    -  +
  D:
  1          0                  0                    0                        0                    0  |
  0      -3/16                  0                    0                        0                    0  |
  0          0             10/729                    0                        0                    0  |
  0          0                  0            -35/65536                        0                    0  |
  0          0                  0                    0              126/9765625                    0  |
  0          0                  0                    0                        0        -77/362797056  |
  0          0                  0                    0                        0                    0  |
  0          0                  0                    0                        0                    0  |
  -          -                  -                    -                        -                    -  +
  U:
  1        1/4                1/9                 1/16                     1/25                 1/36  |
  0          1            128/243                 5/16                  128/625               35/243  |
  0          0                  1            6561/8192              45927/78125                 7/16  |
  0          0                  0                    1          2097152/1953125            2048/2187  |
  0          0                  0                    0                        1  244140625/181398528  |
  0          0                  0                    0                        0                    1  |
  0          0                  0                    0                        0                    0  |
  0          0                  0                    0                        0                    0  |
  -          -                  -                    -                        -                    -  +
</code>
There are some patterns visible here, but I did not really try to detect a set of formulae depending on r(ow) and c(olumn)-indexes so far.
Only we have by definition
$$ A = L \cdot D \cdot U$$
for any finite dimension. And because the entries do not change when we change the size, we can assume, that this holds also for the infinite size.
Now we can easily find inverses for that triangular matrices, let's write
$ K = L^{-1}, T=U^{-1}$. For the inverse of $D$ we need that no zero occurs on the diagonal - and the pattern of the entry suggests that no zero would occur, so we assume existence and compute also $C=D^{-1}$ with finite size.
The top-left segments of that matrices ($K$,$C$,$T$ below each other) look like this:
<code>   K:
            1           0             0              0                 0                     0  |
           -1           1             0              0                 0                     0  |
          1/4        -5/4             1              0                 0                     0  |
        -1/36        7/18        -49/36              1                 0                     0  |
        1/576       -5/96        91/192       -205/144                 1                     0  |
     -1/14400     11/2880     -341/4800      1529/2880        -5269/3600                     1  |
     1/518400  -91/518400   1001/172800  -44473/518400       37037/64800            -5369/3600  |
  -1/25401600    1/181440  -533/1814400   9581/1270080   -353639/3628800           54613/90720  |
            -           -             -              -                 -                     -  +
   C:
            1           0             0              0                 0                     0  |
            0       -16/3             0              0                 0                     0  |
            0           0        729/10              0                 0                     0  |
            0           0             0      -65536/35                 0                     0  |
            0           0             0              0       9765625/126                     0  |
            0           0             0              0                 0         -362797056/77  |
            0           0             0              0                 0                     0  |
            0           0             0              0                 0                     0  |
            -           -             -              -                 -                     -  +
   T:
            1        -1/4         5/243        -7/8192        42/1953125          -11/30233088  |
            0           1      -128/243           7/64    -24576/1953125              55/59049  |
            0           0             1     -6561/8192    531441/1953125              -55/1024  |
            0           0             0              1  -2097152/1953125          90112/177147  |
            0           0             0              0                 1  -244140625/181398528  |
            0           0             0              0                 0                     1  |
            0           0             0              0                 0                     0  |
            0           0             0              0                 0                     0  |
            -           -             -              -                 -                     -  +
</code>
Now, to proceed, it is crucial to find analytical expressions for the entries in the matrices, so that we can explicate series-formulae for the dot-products of rows in $T$ with columns in $K$ multiplied by the diagonal-elements in $C$.
I've not yet really tried to find some meaningful pattern here. But doing the dot-products with increasing sizes of the matrices by numerical evaluation by Pari/GP-software seems to give zeros for all entries in $T \cdot C \cdot K$ ! So we seem to get a result that $$\lim_{\text{size} \to \infty} A^{-1} = \mathbb 0$$
Of course, using such a matrix as left-multiplicator for the column-vector $\Lambda$ containing the logarithms of the zetas would again result in a zero-vector and would thus be useless.
What we could try, is, to separate the dotproducts by changing the order of computation. Instead as suggested so far
$$ (T \cdot C \cdot K) \cdot \Lambda = \mathbb 0 \cdot \Lambda = \mathbb 0\\
\tag {dismissed} $$
we do with different order of computation
$$ T \cdot (C \cdot K \cdot \Lambda) = T \cdot Y = X \tag {proposed} $$
This gives for determination of $Y$ convergence with increasing size of the matrices involved to
<code> 0.497700
  2.23248
  3.11517
  4.48353
  7.32370
  11.9564
  20.6917
  35.4022
  ...     (furtherly increasing by similar growth rate)
</code>
and $ T \cdot Y = X$ seems to have as well convergent, but not zero, dot-products giving in the limit the expected "indicator" for prime-powers in $X$:
<code>   i   X[i]   approx by size=128x128  //  i is the row-index
  ---+------+-------------------------------------------------
   1    0    -3.13140E-128
   2    1          1.00000
   3    1          1.00000
   4  1/2         0.500000
   5    1          1.00000
   6    0     2.38367E-104
   7    1          1.00000
   8  1/3         0.333333
   9  1/2         0.500000
  10    0      1.98922E-91
  11    1          1.00000
  12    0      1.74025E-86
  13    1          1.00000
  14    0      4.24518E-81
  15    0     -1.15516E-78
  16  1/4         0.250000
  17    1          1.00000
  18    0      9.14500E-72
  19    1          1.00000
  20    0      1.05168E-67
  21    0     -1.06579E-65
  22    0      8.29498E-64
  23    1          1.00000
  24    0      3.13720E-60
  25  1/2         0.500000
  26    0      1.13847E-56
  27  1/3         0.333333
  28    0      1.33656E-53
  29    1          1.00000
  30    0      2.17444E-50
  31    1          1.00000
  32  1/5         0.200000
  33    0     -1.85178E-45
  34    0      4.41824E-44
  35    0     -7.29484E-43
  36    0      8.34838E-42
  37    1          1.00000
  38    0      3.17639E-39
  39    0     -9.40728E-38
  40    0      1.92052E-36
  41    1          1.00000
  42    0      4.07160E-34
  43    1          1.00000
  44    0      1.11334E-31
  45    0     -1.92810E-30
  46    0      3.19415E-29
  47    1          1.00000
  48    0      4.50101E-27
  49  1/2         0.500000
  50    0      1.13855E-25
  51    0     -1.12392E-26
  52    0     -5.45288E-25
  53    1          1.00000
  54    0      1.16300E-21
  55    0     -9.83767E-21
  56    0      2.71287E-20
  57    0     -3.88663E-19
  58    0     -3.27127E-18
  59    1          1.00000
  60    0     -4.67250E-15
  61    1          1.00000
  62    0      8.51704E-13
  63    0      6.72168E-11
  64  1/6         0.166667
  ...       approximation quality too low from here with matrixsize 128
</code>
That values for the entries in $X$ are estimated by the results of multiplication of the matrices with increasing sizes.

I have written a short treatize with perhaps some better explanations on a very similar problem some years ago, where I also succeeded to get a proof for my version of the Vandermonde-matrix: that the "inverse" taken by this method indeed is zero because I could decode the systematic formulae for the entries in $K,C,T$ in that versions and state explicitely series-definitions for the involved dot-products. The proof for the zero-result in all entries of $A^{-1}$ was given in an MO-answer a couple of years ago.
See my own text here which does not yet include the MO-answer. A bit introduction is already on the index-page for my math-papers.

Couldn't resist; at least a partial decomposition of the entries in $T$, the numbers beside the systematic fractions are integer:
<code>  T:
  1*1^1/1^1  -2*1^1/2^3    5*1^1/3^5  -14*1^1/4^7     42*1^1/5^9    -132*1^1/6^11      429*1^1/7^13      -1430*1^1/8^15
          .   1*2^3/2^3  -16*2^3/3^5  224*2^3/4^7  -3072*2^3/5^9   42240*2^3/6^11  -585728*2^3/7^13    8200192*2^3/8^15
          .           .    1*3^5/3^5  -54*3^5/4^7   2187*3^5/5^9  -80190*3^5/6^11  2814669*3^5/7^13  -96722262*3^5/8^15
          .           .            .    1*4^7/4^7   -128*4^7/5^9   11264*4^7/6^11  -851968*4^7/7^13   59637760*4^7/8^15
          .           .            .            .      1*5^9/5^9    -250*5^9/6^11    40625*5^9/7^13   -5468750*5^9/8^15
          .           .            .            .              .      1*6^11/6^11    -432*6^11/7^13    116640*6^11/8^15
          .           .            .            .              .                .       1*7^13/7^13      -686*7^13/8^15
          .           .            .            .              .                .                 .         1*8^15/8^15
</code>


Plumbing fixture for draining spa shower lines when off?

Question: I am installing a spa shower, no tub.  Is there a device I can include at low points of the outputs to the raincan, etc, that will bleed the lines when the shower is off, exploiting that there is no pressure in those lines, kind of like a tub kit diverter?
Comment: I have heard of some installations of a diverter from the mixing valve to feed a spigot in the wall below a shower head. I think the purpose was to have a place to draw water into a bucket, but this would serve to drain the lines from a shower. Do these spa showers have a single mixing valve or multiple?
Comment: So, you want to automatically drain the lines when the shower is off. Why? And, is the shower valve **before** these lines, so that the pressure going to zero can trigger the automatic drain?
Comment: Yes, the shower valve is before these lines.  I think they ought to be drained because I've seen what filth grows in there especially when left sitting for a long time.  Since the outputs are not all on at once, they don't automatically get ejected when the shower is getting up to temp - wouldn't want to get hit with the nasty standing water mid-shower if I happened to change to an infrequently chosen setting.
Comment: The trouble with a manual spigot is that I would need one per output because my diverter is integrated into the controller and so there's no single place to integrate such a device.  I'm hoping for three automatic ones draining out a single ~downspout.
Comment: I think I am looking for a "current to close" "control valve" product - one suited for residential plumbing sizes and pressures.
Comment: A "normally open check valve" at 2 psi or higher to close?  but I haven't found that actual product available for purchase yet.
Answer: Unless your talking a country mile of "standing" water in those pipes you can install ball valves above the faucet.


Is there a way to improve gear in structured PvP?

Question: After playing a few games on structured PvP, I began to wonder if there is any way to improve your PvP gear you receive when you join the Heart of the mists.
When you get into sPvP you receive a full-set of abilities, trait points and gear, I see you can change the runes from your gear and one acessory, but I don't see any gear progression as your glory rank passes. So, how does this work?
Answer: No. Gear in Structured PvP will always be the same quality. As you increase in Glory you get different-looking armour and weapons, but your equipment will always be on the same level as everyone else's.
Answer: Glory rank progression shows how much time you played in PvP. How much experience you have, how well you might fare. And the reward is better looking skins. This seems kinda meh, but this way you can't rely on gear difference to win battles. And at the same time, you won't be beaten to a pulp by a less skilled player having an extra-powerful axe (read, Shadowkofmourne). All that matters is skill.


AttributeError: 'NoneType' object has no attribute 'mention'

Question: Getting a weird error. This code worked in 1 server I was in, but trying it in other servers gives me this error:
Traceback (most recent call last):
  File "c:/Desktop/test bot/cash.py", line 32, in background_loop
    await client.send_message(channel, "{} secures the bag. ${} found inside. ".format(x.user.mention, loot))
AttributeError: 'NoneType' object has no attribute 'mention'
client = discord.Client()

async def background_loop():
    await client.wait_until_ready()
    channel = client.get_channel("479919577279758340")
    while not client.is_closed:
        loot = random.randint(25,50)
        emojigrab = ''
        emojimsg = await client.send_message(channel, emojigrab)
        await client.add_reaction(emojimsg, "")
        x = await client.wait_for_reaction(emoji="", message=emojimsg,
                                             check=lambda reaction, user: user != client.user)
        if x:
            await client.delete_message(emojimsg)
            await client.send_message(channel, "{} secures the bag. {} found inside. ".format(x.user.mention, loot))
            add_dollars(x.user, loot)
            await asyncio.sleep(1800)

try:
    with open("cash.json") as fp:
        cash = json.load(fp)
except Exception:
    cash = {}

def save_cash():
    with open("cash.json", "w+") as fp:
        json.dump(cash, fp, sort_keys=True, indent=4)

def add_dollars(user: discord.User, dollars: int):
    id = user.id
    if id not in cash:
        cash[id] = {}
    cash[id]["dollars"] = cash[id].get("dollars", 0) + dollars
    print("{} now has {} dollars".format(user.name, cash[id]["dollars"]))
    save_cash()

def remove_dollars(user: discord.User, dollars: int):
    id = user.id
    if id not in cash:
        cash[id] = {}
    cash[id]["dollars"] = cash[id].get("dollars", 0) - dollars
    print("{} now has {} dollars".format(user.name, cash[id]["dollars"]))
    save_cash()

def add_dollars_stolen(user: discord.User, dollars_stolen: int):
    id = user.id
    if id not in cash:
        cash[id] = {}
    cash[id]["dollars_stolen"] = cash[id].get("dollars_stolen", 0) + dollars_stolen
    print("{} stole ${}".format(user.name, cash[id]["dollars_stolen"]))
    save_cash()

def get_dollars_stolen(user: discord.User):
    id = user.id
    if id in cash:
        return cash[id].get("dollars_stolen", 0)
    return 0

def get_dollars(user: discord.User):
    id = user.id
    if id in cash:
        return cash[id].get("dollars", 0)
    return 0

@client.event
async def on_ready():
    print('Bot Online.')

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.lower().startswith("?cash"):
            if message.content.lower() == "?cash":
                if get_dollars(message.author) < 0:
                    await client.send_message(message.channel, "You're ${} in the hole!".format(get_dollars(message.author)))
                else:
                    await client.send_message(message.channel, "You've acquired ${}! :dollar:".format(get_dollars(message.author)))

client.loop.create_task(background_loop())

Comment: you checked for `x` but you didn't check if `x` has a `user` or if it was None.
Comment: Is this happening when users react to the message, or when the bot reacts to the message?  You could make the check `check=lambda reaction, user: user and user != client.user`
Comment: It happens when users react to the message. i added user and user != client user and it gets rid of the error, but it doesn't delete the message and add the new message
Comment: Did you add Patrick's suggestion to the `wait_for_reaction` check lambda (it's different to my answer as it should stop it thinking it has a reaction until it's a valid user).
Comment: Hey, I tried both suggestions. Patrick has helped me before on this because it kept thinking the bot was reacting to the message so he suggested adding user != client.user, but when I add his new suggestion, it gets rid of the error, but it doesn't continue to delete the message and add the new message along with adding value to the json file.
Answer: You check if x is defined, but not it it has x.user and if that is a valid user object. The error you are getting you is telling you that x.user is currently None.
You can ensure that user is not None by using:
if x and x.user is not None:  # or just: if x and x.user
    await client.delete_message(emojimsg)
    ...

Comment: Thank you for the response. I tried before posting this, but when the message is reacted to, it just spits out another "emojimsg " message with reaction.


How to go by this, to solve for X with matrix equation (linear algebra)

Question: $$\begin{bmatrix}-3 & -5\\-8 & 6\end{bmatrix}X + \begin{bmatrix}-8 & 3\\-3 & 6\end{bmatrix} = \begin{bmatrix}4 & 9\\-6 & 8\end{bmatrix}X$$
I'm really unsure how to do this number? That's stumping me is the second location of X
much appreciative for any help,
cheers
Comment: Welcome to math SE. If $X$ is a $2\times2$ matrix, just do the multiplication and you'll end up with 4 equations with 4 unknowns.
Comment: It is just like a normal equation $Ax + B = Cx$ - rearrange to collect the $x$ terms like $(A-C)x = - B$ and then solve as normal, multiplying by the inverse of $A-C$ if you are lucky enough that it is invertible (and if I subtracted right, it is).
Answer: Hint:
Your matrix equation is essentially of the form $$AX + B = CX$$ You can subtract $CX$ and $B$ from both sides and factor to obtain $$(A-C)X = -B$$
Comment: Thank you! Once I get there, how do I solve for X?
Comment: Well, if $A-C$ is invertible, you could multiple both sides on the left by its inverse. Then $X = (A-C)^{-1}(-B)$.
Comment: Thank you! I followed your steps and got X =  $$\begin{bmatrix}-13/7 & 39/7\\5/14 & -18/7\end{bmatrix}$$


An exercise on union of open sets

Question: "Every open subset of $\mathbb{R}$ can be written as a countable union of open intervals."

Why is the above statement true? Is it because the topology of $\mathbb{R}$ is defined to be the topology generated by intervals of the form $(a,b)?$

I want, next, to prove that
$$
(r,\infty)=\bigcup_{n=1}^{\infty}\left(r + \dfrac{1}{2^n},\infty \right).
$$
My attempt at a proof: To show that $\bigcup_{n=1}^{\infty}\left(r + \dfrac{1}{2^n},\infty \right)\subseteq (r,\infty)$, is trivial:
$x>r+\frac{1}{2^n}>r$, for some $n\in \mathbb{Z}^+$.
To exhibit the other direction, can I use the fact that $n\leq 2^n$ (provable by induction) and then use the Archimedean property?
Answer: To show: $(r,\infty)\subset \bigcup_{n\in \mathbb{N}}(r + \frac{1}{2^n},\infty)$.
Proof: Let $x\in (r,\infty)$. This implies $x > r$, in other words $x-r > 0$. When we choose $$n_0 > \text{log}_2 (\frac{1}{x-r}),$$ we have $$x-r > \frac{1}{2^{n_0}}.$$ In other words, $x \in (r+\frac{1}{2^{n_0}}, \infty)$ and therefore  $$x \in (r + \frac{1}{2^{n_0}},\infty) \subset \bigcup_{n\in \mathbb{N}}(r + \frac{1}{2^n}, \infty).$$ The claim now follows since $x$ was arbitrary.
Answer: The first statement is true because a neighborhood in $\mathbb{R}$ is an open interval and $\mathbb{R}$ is a second-countable space. Your idea for the proof is fine, let $x\in ]r,\infty[$. Then $x > r$ and so $\exists n\in\mathbb{N}$ such that $x-r\geq\frac{1}{n}\geq \frac{1}{2^n}$. Thus $x\in]r+\frac{1}{2^n}, \infty[$ and so $]r,\infty[\subset \bigcup_{n=1}^{\infty}\left]r + \dfrac{1}{2^n},\infty \right[$.
Answer: Observe that if $x \in (r, \infty)$ then $x-r>0.$ So by the Archimedean property of real numbers $\exists$ $k \in \Bbb N$ such that $$k(x-r)>1 \implies 0<\frac {1} {k} < x-r.$$ Since $\frac {1} {2^n} < \frac {1} {n},$ for all $n \in \Bbb N$ we have $$0<\frac {1} {2^k} < x-r \implies r<r + \frac {1} {2^k} < x< \infty.$$ This shows that $$x \in \left ( r + \frac {1} {2^k} , \infty \right ) \subseteq \bigcup\limits_{n=1}^{\infty} \left ( r + \frac {1} {2^n} , \infty \right ).$$
Therefore $$(r,\infty) \subseteq  \bigcup\limits_{n=1}^{\infty} \left ( r + \frac {1} {2^n} , \infty \right )$$
as required.

An exercise on union of open sets


How to iterate over each element with a class name

Question: I've tried many things and I've read a lot of ways to do it but I can't make it work in my code.  The thing is I want to iterate over each
     to test if the text of        is running or existed then remove the class hide of a button.
So there is my HTML code:
<template name="controlPanel">

Start, stop and pause containers from this website

  <input type="button" id="infosRunning" value="Get running containers infos">

    {{#if wantInfos}}

        {{#each infos 'running'}}
          {{> container}}
        {{/each}}

    {{/if}}

<input type="button" id="infosStop" value="Get stopped containers infos">

  {{#if wantInfosStop}}

      {{#each infos 'exited'}}
        {{> container}}
      {{/each}}

  {{/if}}

</template>

<template name="container">

{{nameContainer}}

            ID: {{idContainer}}

            State: {{stateContainer}}

          <button type="button" class="stop hidden">stop this container </button>
          <button type="button" class="start hidden">Start it ! </button>

</template>

And then in container.js I do that :
stopOrStart = function(){
  $('.liContainer').each(function(i, obj) {
     state = $(this).find('.state');
     if(state.text().includes("running")){
       $(this).find('.stop').removeClass('hidden');
     }else{
       $(this).find('.start').removeClass('hidden');     }
   });
}
Template.container.onCreated(function containerOnCreated() {
stopOrStart();

});

But it only display the button for the first
:

Someone could help me to figure out why I can't iterate over each "container" ?
Comment: So this now works: https://jsfiddle.net/mplungjan/f6hcg9ar/
Comment: Ok it will work after I change some things in my code so you can put your answer and I'll mark it as the answer :) Thank you for the help
Comment: Please edit your snippet so it actually runs. You are NOT showing HTML
Comment: Yes includes() is like contains() it just test if the text includes a substring
Comment: Yes it is important. We cannot debug your code if it does not run
Comment: Include comes from this answer http://stackoverflow.com/questions/1789945/how-to-check-if-one-string-contains-another-substring-in-javascript
Comment: You need to right-click and copy and format the HTML in from the browser. If it is a jQuery issue and not a Meteor issue we do not need to see Meteor.
Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/132257/discussion-between-jerome-and-mplungjan).
Comment: [IMPORTANT] I still need help for that please someone could help me ?
Comment: If I look into your code I can see that you have only 1 ``and I have 2 maybe the problem comes from here..
Comment: Nope. Makes no difference https://jsfiddle.net/mplungjan/f6hcg9ar/
Answer: The JS works - here is a cleaner version. Any remaining issue cannot be solved without seeing the rendered HTML

stopOrStart = function() {
  $('.liContainer').each(function() {
    var state = $(this).find('.state'),
      running = state.text().includes("running"); // ES6! .indexOf would also work
    $(this).find('.stop').toggle(running);
    $(this).find('.start').toggle(!running);
  });
}
$(function() {
  stopOrStart();
});

Container 1

      ID: 1

      State: It is stopped

    <button type="button" class="stop hidden">stop this container</button>
    <button type="button" class="start hidden">Start it !</button>

Container 2

      ID: 2

      State: It is running

    <button type="button" class="stop hidden">stop this container</button>
    <button type="button" class="start hidden">Start it !</button>

Container 3

      ID: 3

      State: It is stopped

    <button type="button" class="stop hidden">stop this container</button>
    <button type="button" class="start hidden">Start it !</button>

Container 4

      ID: 4

      State: It is running

    <button type="button" class="stop hidden">stop this container</button>
    <button type="button" class="start hidden">Start it !</button>


How does synced shot work online?

Question: A friend and I have been trying to do a synced shot online by each marking a target in our field of view (clear shot) and holding down A to start it but nothing happens.  Can we do a synced shot online? If so, how?
[So far we have been marking enemies with synced shot, verbally starting the 'synced shot', and then manually shooting our assigned target]
Comment: The way you are currently doing it is the way it works as I understand it. That's what my friends and I do. As there are no AI players to take the 'other' shots.
Answer: Synced shot doesn't work that way online. Online it's just a fancy way of calling out targets and decide who will do which. You still have to take the shot. There are no AI players who take the shot for you.

How does synced shot work online?


Mozilla Firefox 12 is very slow on Ubuntu 12.04 LTS

Question: Mozilla Firefox 12 is very slow on Ubuntu 12.04 LTS. I'm saying this because I'm using it side by side with PC. I doubt that hardware acceleration was enabled with Firefox on Ubuntu, even with css animation, it lags just like my grand dad. So, how can I check it?
I have enabled the option in advance tab. I have installed my GPU driver, however my ATI Radeon HD5650 GPU on my laptop is VESA: MADISON in system detail, is this all right?
I still can't change to Chromium because it is very buggy unlike Chrome, and with its boring add-on/extension, I don't think I would want to change soon. Opera is a good deal but it can't render my language correctly. So, Firefox is my only choice, even on PC, and it's the fastest browser on PC, and the slowest browser on Ubuntu. Please help me fix this, thanks.
Comment: Type `about:support` in the address bar, hit Enter and scroll down to the graphics section. What do you see? Unfortunately, hardware acceleration is not available for all hardware, especially if you use a custom built, you personal and very own, graphics driver. I'd suggest trying the AMD driver provided by Ubuntu.
Comment: @mikewhatever I have installed the driver that is in setting > additional drivers. I think it's the AMD driver provided by Ubuntu. And in there it says activated. I even have AMD Catalyst Control Center with me and it's usable.

But in system detail, it says my graphic is VESA: MADISON. I don't know why.
Comment: You can try to deactivate the driver (then reboot) to see if that makes a difference. You can do that from Dash (tap Alt) then type "drivers". EDIT: No, don't tap alt. Click the ubu logo at top left.
Comment: Possible duplicate of [Why is Firefox too slow?](http://askubuntu.com/q/133737/37006)
Comment: @gecko Your name sound like you're Mozilla dev. >.<
I have deactivated my driver. But nothing changed.
Comment: @Basharat Sial This is not duplicate as my Firefox startup really fast even from cold-boot, everything were fast too. Just that the scrolling lag and even CSS animations were slow, even slower than jQuery with Opera. The overall usage is unbearable.
Answer: The problem is most likely with your graphics driver.
Attempt to install the ATI binary driver: https://help.ubuntu.com/community/BinaryDriverHowto/ATI
Comment: This is my $ fglrxinfo.
OpenGL vendor string: Advanced Micro Devices, Inc.  OpenGL renderer string: ATI Mobility Radeon HD 5000 Series
OpenGL version string: 4.2.11627 Compatibility Profile Context

According to how to link, my driver looks fine.
Comment: Yeah true. Did you try with the open source driver? That's before you installed ATI driver via "Additional Drivers".
Comment: Nope. When I first install Ubuntu, Unity lags pretty well. That is why I search for the driver. I think, i don't want to go back.
Answer: Did you copy/paste your old profile ?
I did and it was unbearably slow. I started with a fresh profile and it was fast again. Even after installing everything back again.
You can compare by creating another profile firefox -P -no-remote. Using a second profile help re-installing everything back too..
Comment: This is my fresh install Ubuntu and Firefox.
Answer: Slow on rendering the web pages or on connecting to the web sites ?
If the latter, try to disable the multicast dns in /etc/nsswitch.conf
Comment: It's very slow on rendering the web pages. Not on internet connection.


Passing Data to view in a Redirect request to prevent double submission

Question: I am trying to prevent double submission through the back button in a simple voting application
I was doing this before. After voting it returns this view
return View::make('votes.votesresults')->with('candidates',$candidates)->with('count',$count);

This passes two variables to votesresult view but unfortunately if someone clicks the back button they can resubmit their votes. I looked around and came across the PRG pattern. Am supposed to use a redirect to prevent this. So i tried this
    return Redirect::route('votes.votesresults')->with('candidates',$candidates)->with('count',$count);

Here are my controllers
public function votesuccess()
{

 $rules = array(
        'name' => 'required'
        );
    $validator = Validator::make(Input::all(),$rules);

    if ($validator->fails()) {
        return Redirect::to('votes/index')
            ->withErrors($validator)
            ->withInput(Input::except('password'));
    } else {
        // store

        $vote = new Vote;
        $candidates = Candidate::all();

        $candidate_id =Input::get('name');
        $candidate = Candidate::find($candidate_id);

        $vote = $candidate->votes()->save($vote);

        //$count = DB::table('votes')->where('candidate_id','=','$candidate_id')->count();
        $count =  DB::table('votes')->count();

        // redirect
        Session::flash('message', 'Successfully Cast your vote!');
       //return View::make('votes.voteresults')->with('candidates', $candidates)->with('count',$count);
       return Redirect::route('voteresults')->with('candidates', $candidates)->with('count',$count);

    }
}

public function voteresult()
{
    $candidates = Candidate::all();

    return View::make('votes.voteresults');

}

My routes are like this
Route::post('votesuccess', array('as' => 'votesuccess',   'uses'=>'VoteController@votesuccess'));
Route::get('voteresults', array('as' => 'voteresults', 'uses'=>'VoteController@voteresult'));

This does not work because it returns undefined variable: candidates. My results view requires these variables. So how do I implement the PRG pattern correctly such that I prevent double submission while being able to pass data to my view
Comment: Probably not the issue but you have spelling mistake: `->wit('count',$count);`. Can you show your related controller actions code?
Comment: Shouldn't you be preventing double voting in the back-end? If a user tries to vote twice, then an error may be displayed.
Comment: @JofryHS Added controllers and routes maybe you can throw some light
Comment: Can you leave out the `candidates` and see if the `count` variable is available after the redirect?
Answer: You are redirecting to the route named voteresults, which is handled by the voteresult function and not the votesuccess function.
In your votesuccess function, you should load the view and include the candidates variable in that view. You can access the candidates variable stored in the session by using Session::get('candidates').
Comment: doesn't seem to work. Someone can still go back and resubmit a vote.Any other ideas about how to mitigate this.
Answer: It would help to see you voter results view to see what's going on there, and where/how you've put in logic to avoid duplicate submission. Are you concerned about accidental re-submissions, or just multiple submissions from the same user? If the latter, then you would need to build in some logic that limits a user to only 1 vote. You could do this by check if the user has a related vote.
if ( ! $candidate->votes() ) {
    // no votes exist, proceed with storing vote
}

Below is you controller refactored a bit:
public function votesuccess()
{

    $rules = array(
        'name' => 'required'
        );
    $validator = Validator::make(Input::all(),$rules);

    if ($validator->fails()) {
        return Redirect::back('votes/index')
            ->withErrors($validator)
            ->withInput(Input::except('password'));
    } else {
        // store
        $candidate = Candidate::find(Input::get('name'));
        $vote = $candidate->votes()->save(new Vote);

        // redirect
        Session::flash('message', 'Successfully Cast your vote!');
        return Redirect::route('voteresults');
    }
}

public function voteresult()
{
    $candidates = Candidate::all();
    $count =  DB::table('votes')->count();

    return View::make('votes.voteresults', compact('candidates', 'count'));

}


Vuejs2: Vue Tables 2 - Multiple Custom filters

Question: I'm trying to use a Vue table 2 filter to filter data by date, unfortunately it is not wroking and I am not able to find the reason. Has anyone tried such multiple filters with Vue table 2?
I went through the documentation but cannot find a solution.
https://matanya.gitbook.io/vue-tables-2/custom-filters
Html code to filter the data by date

    Start Date:
      <input type="text" class="form-control" @keyup="applyFilterSearchText(searchText)" v-model="searchText" placeholder="End date" />

import { Event } from "vue-tables-2";
import axios from "axios";

export default {
  title: "HelloWorld",
  props: {
    msg: String
  },
  data() {
    return {
      letters: ["Filled", "Unfilled", "Expired"],
      selectedLetter: "",
      searchText: "",
      columns: ["refNumber", "vacancyTitle", "sector", "startDate", "endDate", "vacancyStatus"],
      //data: getdetails(),
      options: {
        headings: {
          refNumber: "Ref",
          vacancyTitle: "Title",
          sector: "Sector",
          startDate: "Start",
          endDate: "End",
          vacancyStatus: "Status"
        },
        customFilters: [
          {
            name: "alphabet",
            callback: function(row, query) {
              return row.vacancyStatus == query;
            }
          },
           {
            name: "datefilter",
            callback: function(row, query) {
              return row.startDate == query;
            }
          }
        ],
        // filterAlgorithm: {
        //   textsearch(row, query) {
        //     return (row.title).includes(query);
        //   }
        // },
        sortable: ["startDate", "vacancyTitle","endDate"],
        sortIcon: {
          base: "fa",
          is: "fa-sort",
          up: "fa-sort-asc",
          down: "fa-sort-desc"
        },
        texts: {
          filter: "Search by text:"
        }
      },
      tableData:[],

    };
  },
  methods: {
    applyFilter(event) {
      this.selectedLetter = event.target.value;
      Event.$emit("vue-tables.filter::alphabet", this.selectedLetter);
    },
    applyFilterSearchText() {
      console.log(this.searchText,"heiiiiiiiiiiii");
      Event.$emit("vue-tables.filter::datefilter", this.searchText);
    },
    getdetails(){
        axios.get("https://localhost:44399/api/Vacancy")
        .then((res) => {
          console.log(res.data,"ressssssss");
          this.tableData =  res.data;
        })
        .catch(function(error) {
          console.log("Error: ", error);
        });
    }
  },
  mounted() {
    this.getdetails();
  }
};

Answer: A potential solution to that is to sort the data before using it in your data-table. Start by creating a computed of your data but with all your potential filters in it and create data variables with "parameters" (sort direction, sort column...)
export default {
    title: "HelloWorld",
    props: {
        msg: String
    },
    data () {
        return {
            yourData: [],
            sortBy: 'name',
            sortDir: 'asc',
            filterSearch: ''
        }
    },
    computed: {
        filteredData () {
            if (filterSearch != '') {
                let _this = this;
                return this.sortedData.filter(item => {
                    return item.name.toLowerCase().includes(_this.filterSearch.toLowerCase());
                })
            } else {
                return this.sortedData;
            }
        },
        sortedData() {
            return this.yourData.sort((a, b) => {
                let modifier = 1;
                if (this.sortBy == "order") {
                    if (this.sortDir === 'asc') {
                        return a[this.sortBy] - b[this.sortBy]
                    } else if (this.sortDir === 'desc') {
                        return b[this.sortBy] - a[this.sortBy]
                    }
                } else {
                    if (this.sortDir === 'desc') modifier = -1;
                    if (a[this.sortBy]  b[this.sortBy]) return modifier;
                    return 0;
                }
            });
        }
    }
}

With that you just have to replace the props value you use to pass data to your VueTables
Comment: Thanks for sharing.. But here I'm using Vue table 2 custom filters and search. Unfortunately the search and filters won't work if we want to compare one by one values.


Is this convex bend in my furnace filter slot OK?

Question: I just bought a house that has a two-year old Carrier central air/ furnace unit. The filter holder slot has a convex bend on the side closer to the furnace which makes little gaps between the filter's cardboard frame and the metal filter holder. When the fan is running I can feel a little air flowing into these gaps rather than through filter.
Here is a picture:

I'd estimate the top gap is less than 1/8" and lower is maybe 1/4". This does not change when the fan kicks in, i.e. neither the filter nor the metal frame flexes to close the gap. When the fan is running I can feel a small amount of air flowing into the gaps, which would obviously not be getting filtered.
Is this a big deal? I assume like 95%+ of the air coming in the main return duct is flowing through the filter as intended, not flowing out around it and into those gaps.
Is it worth trying to bend the right side of the frame to be more flat, or having a service tech in to straighten it?
Note that there is no door that closes to cover the filter slot. It's permanently open by design AFAIK.
Thanks.
More Pictures
Filter insertion area, filter removed:

Filter slot viewed from inside:

So the filter's cardboard frame roughly sits where these red lines are:
Answer: There should be an air filter holding frame there.   It looks like someone tried to make one or they literally got the cheapest filter frame I have ever seen.   These things should be a much thicker gauge and should firmly house the filter.
The other issue is that this should be fully enclosed with a solid cover.  There are a multitude of problems here, easily resolvable.   You need a filter holder (pan and a door).   Any AC company can install this in an hour and probably have parts on hand.
You can install this yourself if you don't mind shopping around and finding the right sizes and doing so minor duct cutting and sealing.

So based on your picture the issue isn't the effectiveness of the filter - yea that's a very very minor issue - the main issue is the inefficiency of your unit based on lost flow and disrupted flow caused by all of the "cracks".   All of the things in yellow should be caulked/sealed/taped and the filter holder should be rigid so these things can be done right.
Addendum based on comments:   An example of a filter holding frame is here.   I don't know this brand, just did a search.  Should be very rigid, should have a "door", should have a section that the filter slides into.   This is not rocket science and there are many different brands/types available.
When doing this you have two options:

You get a good, rigid, thick gauge holder.
Custom holder is securely fastened on both sides and sealed.  (This is usually thinner gauge)

You have neither.   Not really a huge deal but needs to be fixed.
Comment: I've added some more pictures to my post. There is what I would call a filter frame/holder composed of sheet metal, which you can see clearly in the last two pictures. Are you saying there's an additional item that should sit inside that, in which the filter itself should sit? If so, can you provide a link to or picture of an example product? Thanks.
Comment: And yes, it appears there should be a cover. I see two screw holes for it, but no cover in sight. I'll follow up with the furnace installation company and see if they can provide one. The unit's only a couple years old.
Comment: I will add more info based on your comments.
Answer: That is going to cause a bit of leakage depending on how tightly the filter gets sucked against the frame when the air handler is running.
Usually there is a foam gasket there to help with sealing.  But it's possible yours didn't have one or it was left off at installation.
You may want to adjust this to help force all the air to go through the filter.  As it is most will but the larger the gaps the less effective the filter will be.
I've NEVER seem one of these that has no door, however.  That reduces the effectiveness of your air return duct.
Answer: You'll find out that these AC filter are not built to exact measurements. I've seen the thickness vary by as much as 1/4". If this bothers you, get some weather stripping from your home store and shove it in between the filter and the metal holder. It will bend the filter enough to close that gap. Any stripping would need to be rated for air handlers.
Comment: I would not put something behind unless it was done on all 4 sides. Also the weather stripping needs to be plenum rated some guys skimp on this but know many years there was a large lawsuit because "automotive" weatherstripping was used but that was in a commercial building. You don't want anything that could generate excess or toxic smoke.
Answer: When the furnace fan starts drawing air through the filter it will conform to the housing, the bend may flatten out under pressure also but normal paper filters do flex and seal.
The end should be sealed with a "flap" of metal that snaps in or is screwed into place and that will help Chanel the air flow and pull the duct flat.
If this is in a garage the open intake would be a code violation. In a utility closet then it would depend if it is a sealed combustion chamber or not.
Comment: Regarding the filter bending to conform: it does not flex visibly to close those gaps when the fan starts. I started the A/C to get the fan going to see if flex and it did not. Or are you suggesting the filter will slowly bend over time to conform to the curve in the metal?
Comment: Regarding possible code violation: this is in an unfinished basement. Concrete walls and floor, wood ceiling, door at top of stairs so basement is closed off from rest of house. Also I'm in Ontario Canada if that affects the code.
Comment: In a basement it would not have to be blocked off but a garage normally it would. If the opening is sealed it forced all the air through the filter it can't come in from the side and normally pulls the filter in. The problem I see is the ducting is hard mounted to the furnace. I was taught to add a decoupling / flex point that removes the stress from the duct work to furnace connection it also makes things less noisy as the fans are no longer hard coupled to the large sheets of metal that vibrate. The holders are usually folded on site so they vary in quality even from the same guy.


Disk space increased after moving Timeshift out

Question: Please let me understand one thing.
I'm going to start from the fact that basically I was runing Ubuntu on my computer which was equipped in 120 GB SSD drive. Then I've decided to make back up of my system with use of Timeshift (which is my favourite tool for that). Because of that from longer time my disk was suffering and constantly reported out of space. One time even crushed badly , but restoring from snapshot helped.
So it was finally time to buy a new 1TB SSD (Goodram brand).
I've created 4 patition as bellow picture shows:
Gparted view
As you can find out /dev/sda2 is my main system (Ubuntu /).
/dev/sda4 is a pratition with my snapshots
Output of df-H command:
 tmpfs           823M  2,3M  821M   1% /run
/dev/sda2       275G  171G   92G  66% /
tmpfs           4,2G  189M  4,0G   5% /dev/shm
tmpfs           5,3M  4,1k  5,3M   1% /run/lock
/dev/sda1       536M  5,5M  531M   2% /boot/efi
/dev/sda4       518G   71G  421G  15% /mnt/Timeshift
tmpfs           823M  267k  823M   1% /run/user/1000
/dev/sda3       218G  159M  218G   1% /media/zawier/Dokumenty Ubuntu

On old ssd snapshots size was around ~ 60GB, that's allow us thinking that system +all apps + docs was another 60GB.
Moved all backups to a new partition /dev/sda4. Currently I have 5 of them:
sudo timeshift --list

/dev/sda4 is mounted at: /run/timeshift/backup, options: rw,relatime

Device : /dev/sda4
UUID   : 4bf343eb-b0d3-42c6-9a81-db7faa521367
Path   : /run/timeshift/backup
Mode   : RSYNC
Status : OK
5 snapshots, 447.3 GB free

Num     Name                 Tags  Description
------------------------------------------------------------------------------
0    >  2022-06-18_11-00-01  W M   20.04 Focal
1    >  2023-02-18_00-00-01  M
2    >  2023-02-20_19-00-01  W     Przed wymianą dysku na 1TB
3    >  2023-02-25_06-50-51  O     Po wymianie dysku
4    >  2023-02-25_11-35-53  B     Nowy GRUB

I'm aware that Timeshift's snapshots includes symbolic and hardlinks. That's why the only way to copy them properly is :
sudo rsync -aHXAS --info=progress2 /timeshift /mnt/Timeshift/

To keep it consistent and avoid copying the same file multiple times (had that issue with Timeshift on Linux Garuda where simples rsync from total 490GB of snapshots tried copy 2,9 TB  :) Madness!)
Let's keep going. So my copied Ubuntu back ups on a new partition take around ~60GB:
Timeshit folder properties
Disk utility
Here output of mount |grep timeshift:
/dev/sda4 on /run/timeshift/backup type ext4 (rw,relatime)

Checking ncdu /mnt/Timeshift/ we get:
ncdu Timeshift backup partition
Why /dev/sda4 point on /run/timeshift/bacups while it's mounted on /mnt/Timeshift/?
And why it's linked with 2 destinations? Any idea? Why it can't point just only /mnt/Timeshift/?
Next is output on ncdu / :
ncdu /
As you see size is around 200GB while it's litteraly almost the same system which was stored on the previous 120GB SSD! Please keep in mind that also I have removed here folder /timeshift. That's why I was expecting decreasing of total size to 60GB as result. Finally system space was rised up!
Why? Can anybody explain it to me what happened here, please? From my perspective it's just illogic! :)
How Ubuntu calculate used space? Does mounted folders also included into total space even if they are on separate partition?
Comment: TimeShift is one of my favourite apps as well. It's great for system recovery if you mess something up or an update goes wrong. It is not a good tool for data backup though. That is why the home directory is not included in the snapshot by default. You can easily have the situation where you need the system from one snapshot but your latest data is in another
Answer: I think the mount points are confusing you. When you run timeshift it adds the mount point /run/timeshift/backup which contains all the snapshots from the backup location wherever that is. You must have mounted that location at /mnt/Timeshift. Then you have used ncdu to ask the question "How much used space is attached to /?". Answer is 60GB that you started with for the system etc plus about 60GB from the first TimeShift mount and 60GB from the second TimeShift mount.
You don't really need the /mnt/Timeshift mount now you have copied your data. Remove it and the ncdu result will drop by 60GB. Reboot and try it again and the result will drop by the other 60GB until you open the TimeShift app.
So yes Ubuntu (or any Linux) will count by default any partition attached to the start point of the ncdu command. However if you use ncdu -x / it shouldn't cross filesystem boundaries.
Answer: PonJar you are absolutelly right! It confuses me a lot while from my perspective it's illogic :) It's like when you check your bank account ballance and you get total sum of all bank's clients ..
Done additional check according to yours advice. At first unmounted following:
mount | grep -i timeshift
/dev/sda4 on /mnt/Timeshift type ext4 (rw,nosuid,nodev,relatime,x-gvfs-show)
/dev/sda4 on /run/timeshift/backup type ext4 (rw,relatime)

And the size dropped down to somewhere I have expected.
ncdu 1.15.1 ~ Use the arrow keys to navigate, press ? for help
--- / --------------------------------------------------------------------------
   59,5 GiB [##########] /media
   26,1 GiB [####      ] /snap
   16,0 GiB [##        ] /var
   12,8 GiB [##        ] /usr
    7,2 GiB [#         ] /home
    2,0 GiB [          ]  swapfile
    1,8 GiB [          ] /opt
  266,4 MiB [          ] /boot
   36,7 MiB [          ] /etc
   29,8 MiB [          ] /root
.   2,3 MiB [          ] /run
  360,0 KiB [          ] /tmp
e  16,0 KiB [          ] /lost+found
    4,0 KiB [          ] /dev
e   4,0 KiB [          ] /srv
e   4,0 KiB [          ] /mytestsite
e   4,0 KiB [          ] /mnt
e   4,0 KiB [          ] /cdrom
.   0,0   B [          ] /proc
    0,0   B [          ] /sys
@   0,0   B [          ]  libx32
 Total disk usage: 125,7 GiB  Apparent size: 128,1 TiB  Items: 3642695

Another (or more detailed ) explanation is a fact that by default I have set up mounting of /dev/sda4 on  system start up and what's really interesting here - type of folder is node/directory, which include just list of files and doesn't include files data! So we could simplify sentence that those are just links ;)
Last question which comes to my mind is: what will heppen when total size sum  will be equal or greater than size of main partition? System will report low unused space capacity or it will be runing without an issue? In second case: how do you know when you are close to run out of disk space?
Thank you for your help and explanation!
Comment: The system will not be concerned if the sum of all the mounts adds up to more than the size of the device. From its perspective the size available is also summated so it's not an issue.
Comment: The system will tell you if you are running low on space on the root partition. ext4 reserves about 5% of the root partition that only it can use. This guards against an unrecoverable system due to space issues but you can still get in a right mess if space gets too short. Just keep an eye on the space available on your root partition. On other partitions you will get no warning, suddenly there will be no space left and you cannot save data
Comment: If you think my answer fully answered your question please accept it. This helps others searching for questions with accepted answers
Comment: What happened here is not illogical. You asked the question "How much used space is attached to /?". You thought you had asked "How much space is used on my root partition?" Linux can be very subtle. It's worth reading the man page for the command you are using, it will reveal options and defaults that could be relevant.
Comment: Timeshift work the best for me. I've tried already: back in time, snapper, clonezilla and also Macronium Reflect which is Windows based app - but really good one and currently is capable to image and recover ext4 and btrfs partitions! In last case it just take really long time, but in the end of the day it works. Marked  answer as solved. One more time - thank you!
Comment: I'm not saying don't use TimeShift. It's brilliant to recover your system. However if you are serious about understanding Linux study rsync. It's used at the core of TimeShift and is easy to use to maintain backups of your data. I use a systemd timer to run a simple rsync to create a data backup on a daily basis. A great Linux skill to learn


How to get a value from map in a map?

Question: I have a map where there are three values for every key, and can print them. However, I don't know how to reference each individual value.
const planinfo = await statement.planInformation(pool);
//  console.log(planinfo);
  let planinfoMap = new Map()
  planinfo.forEach(value=> {
    planinfoMap.set(value.plansubdomain, new Map([
      ['plancode',value.plancode],
      ['urlbucket',value.urlbucket],
      ['planemail',value.planemail]
      ]))
  })
// get subdomain here
console.log(planinfoMap.get(subdomain));

Map(3) {
  'plancode' => '222',
  'urlbucket' => 'somes3bcuket',
  'planemail' => 'firstname.lastname@example.com'
}

Map(3) {
  'plancode' => '111',
  'urlbucket' => 'thiss3bucket',
  'planemail' => 'firstname.lastname@example.com'
}

How do I reference plancode, urlbucket, and planemail individually?
Answer: You need to access the object's properties. For an exhaustive explanation read the doc on Object and the doc on Map.
let oneMapObject = planinfoMap.get(subdomain);
console.log("You mapped: %s, %s, %s", oneMapObject.get("plancode"), oneMapObject.get("urlbucket"), oneMapObject.get("planemail"));
console.log("This mapObject has plancode: %s", oneMapObject.plancode);
console.log("Another way to look at it: %s & %s (urlbucket and planemail)", oneMapObject["urlbucket"], oneMapObject["planemail"] );

How to get a value from map in a map?


Show events in fullcalendar.js shift-wise (Morning, day, evening, night) for basicDay view and basicWeek view

Question: I have many events for each day. Is there a way to separate these events in horizontal shift-wise categories? Can I add an extra flag (or class viz: morning, day, evening, night) along with     'title:' and     'start:' so that the events would organize in respective horizontal shifts within a same day? I used
start: new Date(y,m,d,h,i),
allDay:false

to show different events of the same day.
I could then limit just 5 events on each shifts using eventLimit. p.s. I am only using basicDay and basicWeek view.
Answer: You can add 'className' parameter in youe event object. And different class with color by checking event time.
Like
var eventClass = '';

if (event.start > night && event.start < day) {
  var eventClass = 'morningClass';
} else if (event.start > morning &&  event.start <  evening) {
  var eventClass = 'dayClass';
} else if (event.start > day &&  event.start <  night) {
  var eventClass = 'eveningClass';
} else if (event.start > evening &&  event.start <  morning) {
  var eventClass = 'nightClass';
}

then
start: new Date(y,m,d,h,i),
allDay:false,
className: eventClass

and based on className count (using clientEvents (method) )you can restrict 5 event's per shift.
Comment: I no longer have access to the code file so cannot try your answer. Thanks for the help though, might be helpful for someone who comes looking for this issue.
Answer: As far as I understood your requirement, you need to use resource view feature of the calendar.
Here is a post about the resource view
Comment: I no longer have access to the code file so cannot try your answer. Thanks for the help though, might be helpful for someone who comes looking for this issue.


Does time pass while writing a book?

Question: Say I am writing an extensive novel about Creepers in a book in Survival. Should I worry about crops growing, furnaces baking, the sun setting, etc.?
Answer: No, time doesn't pass while writing a book (in singleplayer). Most interfaces won't pause time, such as looking inside a chest or using a crafting table, but a Book & Quill is an exception to that rule.
You can test this by making a new Creative world, using a spawn egg to spawn in some mobs, and then opening a Book & Quill. All the monsters you can see around the edges of the book-writing interface will be frozen.
(In multiplayer, of course, no interface pauses time.)

Does time pass while writing a book?


Ubuntu doesn't see my partitions correctly

Question: I bought a new desktop and installed Windows 7 first. I am now trying to instal Ubuntu 11.04, but it doesn't see my partions corectly.
Any thoughts are appreciated. Thanks.
Here is the windows setup:

What live cd partioner sees:

What ubuntu live cd sees:
Answer: Your harddisk is using the Dynamic Disk Format, which is not compatible with Linux and some Windows Version (Home Editions). Windows allows you to convert every disk to a Dynamic Disk but not back to a Basic Disk. Dynamic Disk format is used to provide features like Software RAID. You're setup doesnt seem to use such a feature, therefor you can safely use the Basic Disk format.
You can backup all your data, delete all partitions and create a new partition table (make sure you don't convert it to a Dynamic Disk again).
There are ways to convert this disk back to a Basic Disk without copy all data around. This Blog entry describes a method using Test Disk. But be careful, and as always, make a backup first!
Comment: First screenshot, 3rd column in list-view: All Dynamic. Nicely spotted.
Answer: My guess is this: your Windows setup is using some sort of LVM on your drive. So D:Work, E:Torrents and F: are not real partitions, but rather LVM logical volumes. Nautilus can see and read them (hence your 3rd picture showed them all), but the installer is instead showing you the real partition table. So, you have:

/dev/sda1: 1MB   - Windows "LVM fake partition table" maybe?
/dev/sda2: 100MB - Windows "System Reserved" partition (created by windows 7 for many purposes - encryption, page file, etc)
/dev/sda3: 200GB - Windows OS partition
/dev/sda4: 750GB - Anything else (combined D:Work, E:Torrents and the empty F: partition)

As you can see, Ubuntu can read those logical volumes, but cannot install into one of them. And since you're already using your 4 primary partitions, you need to delete one to created an extended partition so you can overcome this 4-partition limit.
My suggestion on approach would be:

Back up everything. Seriously.
Read the link I provided you to remove the System Reserved partition.
Make sure your Windows 7 still boots fine after removing it.
Using Ubuntu Live CD, shrink the 200GB Windows partition to make room for Ubuntu
Create an extended partition there. 50GB will be more than enough. 15GB if you're really desperate.
Run the installer. Now you can create additional partitions inside the extended for Ubuntu (10~20 GB), Swap (~5GB) and, if you want, /home (whatever space you have left)

These are just directions... just say so if you need more details in any of the steps above.
Good luck!
Comment: isnt there a way to delete the last partition "New volume" and use that space to install ubuntu? tnx
Comment: As far as i know, no. The partition table which describes the start and end of the partition is not compatible with Ubuntu. Therefor you need to create a new patition table.
Comment: @solomongaby: no, you can't. As I said, "New Volume" is not a real partition, but part of a Windows LVM setup (called "Dynamic disks"). You need to delete a "real" partition to make room for Ubuntu's install. The 100MB is a real one, but its too small. So you need to delete it AND shrink windows 200GB one.
Answer: I have had trouble with NTFS filesystems since I started using Linux with Ubuntu 8.10! I still have difficulty every once in a while... I think your best chance would be to use the windows 7 install disc to just delete the partition that you want to use for Ubuntu, and then you can format it in Ubuntu (most likely) with ext3 or ext4. Thats how I have always got around it. Sometimes Gparted's live CD from a couple years ago works better on NTFS than the newer versions. I wouldn't take my advise though, as I have only switched 20 or so people from using Windows xp, vista & 7 to flavors of Debian / Ubuntu...


Creating a knockoutJS custom binding for simple jQuery plugin

Question: Is there a general approach or at least a set of steps a KnockoutJS developer needs to take to create a binding for simple jquery plugins.
For example, if the plugin is triggered like this in "common code":
$('#tag1').tagsInput({
    // my parameters here
});
how would a simplest custom KO binding for this plugin look like?
Answer: Here is a common way, for example for jQuery button:
ko.bindingHandlers.jqButton = {
    init: function(element, valueAccessor) {
        var options = valueAccessor() || {};
        $(element).button(options);
    }
};

<button data-bind="click: greet, jqButton: { icons: { primary: 'ui-icon-gear' } }">Test</button>

Read this article for some best practices: http://www.knockmeout.net/2011/07/another-look-at-custom-bindings-for.html


LG oven -- power cord burning

Question: I purchased new LG oven 2 weeks ago and smelled burning last night.
Come next morning, the oven doesn't turn on.
I checked on back of power cord section and opened the cover.
Inside, 3  of the wires (black, white, and red) were not secured at all, instead hanging from the bolt with no nut. The red wire was completely burned..
Is this normal???
Comment: I presume the cord is exiting out the bottom, correct?  Or is this oven hardwired?
Comment: Yes, exiting out the bottom from the oven hardwire. BUT NEVER CONNECTED WITH NUTS... just moving in & out when I opened the cover.
Answer: I first want to comment that you are extremely fortunate to have discovered this before issue before it became a full scale fire in your dwelling.
Having no nuts on the studs to secure the lugs of the supply cord is a serious safety situation. Someone that installed the cord assembly screwed up royally.
If you received the LG oven with the cord already installed from the store or warehouse I would be recommending that you take it back and demand that they give you a replacement that is wired properly.
There is a possibility that the oven is OK and that acquiring a new cord assembly and installing it properly will be the cure to the problem. BUT... be aware that the red wire melted because the connection was high resistance and created a tremendous heat to melt the insulation like that. You will need to very carefully check the red wire from the oven internals that also connects to that stud. If it is in any way melted or discolored then you should seriously look at getting a replacement.
Comment: @MARTIN - It is possible that the LG customer centre is not the guilty party here. Many times the ovens are not pre-equipped with cordsets and these are installed by the dealer/store. (Sometimes it is dealt with by the purchaser or installer). Your first course of action has to be to go back to the folks you bought the thing from. It should be their responsibility to deal with the problem and if it falls to LG they should be dealing with that.
Comment: Thanks for your reply and I'm pushing LG customer centre.. I DON'T RECOMMEND THIS LG.... LOL..

LG oven -- power cord burning


Is click-spamming hindering my abilities?

Question: I just discovered on my Demon Hunter that I can cast his abilities by keeping pushed down the corresponding key, instead of clicking it like a madman. Overall I've noticed an improvement in damage output and responsiveness, is that just an impression? Or was my click-spamming really being an obstacle?
Answer: It is possible. The inverse is not true however. You can't click faster than you can cast by holding down (you used to be able to, but they patched that out), however if you click fast enough you can do the same DPS.
It is possible that you aren't clicking fast enough to keep up the same DPS, however it should only be necessary to click as fast as your attack speed, whatever that is. If you have a lot of +attack speed gear than it is very possible that you simply can't keep up. If you are clicking faster, then you shouldn't be at a disadvantage (? someone clarify if I'm wrong here).
In short: No disadvantage to holding down your button. No disadvantage purely for clicking, but there is a possible disadvantage if you can't click fast enough.
Comment: It's possible the clicking was creating a mini-queue of attack actions so that when he went to perform an additional action the game would finish up the queue of earlier attacks and _then_ perform the new action
Comment: @ChrisRasys: That's also a possibility, but in most games that sort of queue is only one ability long.
Answer: Actually, the opposite is true. You can get higher attack speeds through clicking than through holding the button down. You can see the question "Is there a difference in DPS depending on how you attack?" for more details.
However, Bashiok (D3 community rep) acknowledged that this was a bug, and would be fixed. I do not know if the fix is live, but I believe the goal is that no matter how you trigger your skills, they do the same DPS.
Comment: I don't have a source, but I believe they did get it fixed, hence my answer.


CSS not taking effect on spans

Question: I'm currently having some trouble getting spans to work with this function I made in Javascript. It calls the OpenWeatherMap API and outputs current weather conditions, but adding CSS to the mix doesn't effect the spans I need it to, although doing the same sort of thing in a function to update the time does it perfectly well.
EDIT: Should probably mention that the digitalFont in my CSS is a custom font, and works perfectly fine with my other CSS elements.
JS:
function getCurrentWeather() {
    fetch('https://api.openweathermap.org/data/2.5/weather?q=Tokyo&appid=')
    .then(res => res.json())
    .then(res => {

        var icon = res.weather.map(d => {return d.icon});
        var con = res.weather.map(d => {return d.main});
        var tempC = Math.floor(res.main.temp - 273.15);
        // var tempF = Math.floor((res.main.temp - 273.15) * 1.8 + 32);

        var iconPNG = `../res/img/weather_icons/${icon}.png`

        document.getElementById('tempC').innerHTML = `${tempC}`;
        // // document.getElementById('tempF').innerHTML = `${tempF}`;
        document.getElementById('condition').innerHTML = `${con}`
        document.getElementById('icon').innerHTML = `<img src="${iconPNG}">`

    });
}
getCurrentWeather();
setInterval(getCurrentWeather, 3600000) // Update every hour

HTML:

        C

CSS:
.tempC {
    font-family: digitalFont;
    font-size: 60px;
    text-align: right;
}

Comment: `tempC` appears to be an ID rather than a class - so you want `#tempC` (not `.tempC`) in your CSS
Comment: Also notice "C" is outside span
Answer: In CSS, . is used to select elements with a certain class. You need to use # to select an element with a specific id.
#tempC {
    font-family: digitalFont;
    font-size: 60px;
    text-align: right;
}

Answer: Check this need to change .tempC with #tempC & content inside span tag C for applying style to selected tag.

#tempC {
    font-family: digitalFont;
    font-size: 60px;
    text-align: right;
}

        C

Answer: You've written ID's instead of classes, try:

        C

CSS not taking effect on spans


Are both these two cleaning buffer methods equivalent?

Question: I was wondering:
do they do exactly the same thing? calling c = getchar on expression is the same as doing it with a do...while loop?
void clrbuf(void)
{
    int c;
    while ((c = getchar()) != '\n' && c != EOF);
}

void clrbuf(void)
{
    int c;
    do c = getchar(); while (c != '\n' && c != EOF);
}

edit: c was once typed char, but folks told me int was the appropriate type for it
Comment: Both better as `int c;` to distinguish and cope with the typical 257 different responses from `getchar()`.
Comment: Well, not only better, it is a must
Comment: C or C++? These are two different languages.
Comment: C++: `stream_name.ignore(std::numeric_limits::max(), '\n');`
Comment: Both are wrong.
Comment: https://stackoverflow.com/questions/7119470/int-c-getchar
Comment: @Yksisarvinen C. I didn't know it could be different in C++. I'll delete the tag. thanks
Comment: why, @0___________?
Comment: `c` has wrong type.
Comment: would simply `int c` instead of `char c` make it better, then?
Comment: Also: `while (1) { int c = getchar(); if (c == '\n' || c == EOF) return; } } `
Answer: For starters the variable c should be declared like
int c;

because if the type char behaves as the type unsigned char then this condition
c != EOF

will be always true.
According to the C Standard (7.21 Input/output <stdio.h>)
EOF

which expands to an integer constant expression, with type int and a negative value, that is returned by several functions to indicate
end-of-file, that is, no more input from a stream;

So if the type char behaves as the type unsigned char (this depends on compiler options) then the value stored in the variable c after the integer promotion to the type int will be still a non-negative value.
The first while loop
while ((c = getchar()) != '\n' && c != EOF);

may be rewritten using the comma operator like
while ( c = getchar(), c != '\n' && c != EOF );

that is in fact it consists of two parts: the assignment expression c = getchar() and the condition c != '\n' && c != EOF.
As you can see it is equivalent to the do-while statement
do c = getchar(); while (c != '\n' && c != EOF);

However the first while loop
while ((c = getchar()) != '\n' && c != EOF);

is more expressive and clear.
Comment: The first loop is more idiomatic C (and that helps make it more expressive and clear).


Row exchanges that turn each of an invertible matrix's diagonal entries nonzero

Question: So I need help for this problem. For a more formal statement, suppose $A\in M_n(\Bbb R)$ is non-singular, I need to prove that there exist row exchanges $P_1,\cdots,P_n$ such that
$$B=P_1\cdots P_n A$$
And each of $B$'s diagonal entry is non-zero.
The trouble is I'm only permitted to use  row exchanges, so I don't know how to prove it constructively. If I use the column-to-column  strategy, when I'm done with the first column, namely, potentially having exchanged  the first row with another one whose first entry is nonzero so that $A_{11}$ is nonzero, then when I proceed to the second column, the will be trouble: I don't know if there is any zero entry among $A_{22},A_{32},\cdots,A_{n2}$, for instance
$$\begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix}$$
is troublesome for this procedure.
Of course I only need to show the existence, but even this is difficult for me now.
Comment: Sorry. Need to add that only *row* exchanges are permissible.
Answer: By Laplace's formula we have $\det(A) = \sum_{i=1}^n (-1)^{i+1} A_{i1} \det(A^{(i,1)})$ where $A^{(i,j)}$ denotes the $(i,j)$-th minor of $A$. Because $A$ is invertible we have $\det(A) \neq 0$, so there exists some $1 \leq i \leq n$ with $A_{i1} \neq 0$ and $\det(A^{(i,1)}) \neq 0$.
Exchanging the first and $i$-th row of $A$ results in a new matrix $B$, such that the first diagonal entry of $B$ is nonzero and $B^{(1,1)}$ is invertible. Because $B^{(1,1)}$ is of size $(n-1) \times (n-1)$ we can now apply induction. (To see that $B^{(1,1)}$ is invertible simply notice that $B^{(1,1)}$ results from $A^{(i,1)}$ by exchanging the rows.)
Comment: Bravo answer ! Thanks


apt-get update error ubuntu 12.04 to version 14

Question: i can't run an update from ubuntu 12.04 to 14, during the update process i got souces error. But my network seems to be ok. How can i fix it?
I did the update on my laptop, but i can't do it on my desktop :/

W:Impossible de récupérer
  http://fr.archive.ubuntu.com/ubuntu/dists/trusty/main/binary-armhf/Packages
  404  Not Found [IP : 2001:67c:1360:8c01::19 80]
  (...)
  404  Not Found [IP : 2001:67c:1360:8c01::19 80] , W:Impossible de
  récupérer
  http://fr.archive.ubuntu.com/ubuntu/dists/trusty-proposed/universe/binary-armhf/Packages
  404  Not Found [IP : 2001:67c:1360:8c01::19 80] , E:Le téléchargement
  de quelques fichiers d'index a échoué, ils ont été ignorés, ou les
  anciens ont été utilisés à la place.
Comment: What do `dpkg --print-architecture` and `dpkg --print-foreign-architectures` say?
Comment: it returns "amd64" for the first command and "i386
armhf" for the other.
Answer: To do a release update on ubuntu you need to run sudo do-release-upgrade as apt-get update just refreshes the sources for packages and apt-get upgrade just updates all packages to the latest version, but doesn't update to the latest ubuntu release.
Comment: i tried sudo do-release-upgrade, and the other way with the graphical update manager. The update stopped because of mysterious network errors in both case.
Answer: There are no Ubuntu repositories for the armhf architecture. To upgrade, you need to disable the support for this arch during the release upgrade.

Find out, what packages built for armhf you have installed: dpkg -l | grep armhf
Uninstall these packages, if there are any. They cannot be upgraded automatically.
Remove armhf from the multiarch system: sudo dpkg --remove-architecture armhf
Do the upgrade: sudo do-release-upgrade

Optional, if you still need the software you just removed:

Readd the armhf architecture: sudo dpkg --add-architecture armhf
Install the armhf software you removed. (The same way you installed it before.)
Comment: there is no armhf packages left. finally i succefully the upgrade. but the apt-get update still returns 404 errors
Comment: The same errors? The ones according the `main/binary-armhf/` tree?
Comment: the errors begginig with  http://fr.archive.ubuntu.com/ubuntu/dists/trusty
Comment: Did you add the `armhf` arch after the upgrade? If you don't need it, leav it away.


Python count the frequency of values in dataframe column

Question: I have the following program:
df = pd.DataFrame({'student':['a'] * 4 + ['b'] * 6,
                           'semester':[1,1,2,2,1,1,2,2,2,2],
                           'passed_exam':[True, False] * 5})

    print (df)
      passed_exam  semester student
    0        True         1       a
    1       False         1       a
    2        True         2       a
    3       False         2       a
    4        True         1       b
    5       False         1       b
    6        True         2       b
    7       False         2       b
    8        True         2       b
    9       False         2       b

    table = df.groupby(["student","semester","passed_exam"])
              .size()
              .unstack(fill_value=0)
              .rename_axis(None, axis=1)
              .reset_index()
    print (table)
      student  semester  False  True
    0       a         1      1     1
    1       a         2      1     1
    2       b         1      1     1
    3       b         2      2     2

I want to add a new column to the second dataframe that counts total number of students. Something like this:
   student  semester  False  True Total_St
0       a         1      1     1     4
1       a         2      1     1     4
2       b         1      1     1     6
3       b         2      2     2     6

Any ideas?
Thank you in advance!
Answer: Since the table has two rows per student, one approach is to use original df to find the student count and map to table
table['total_st'] = table['student'].map(df.groupby('student').size())

passed_exam student semester    False   True    total_st
0           a           1       1       1       4
1           a           2       1       1       4
2           b           1       1       1       6
3           b           2       2       2       6

Comment: Thanks!! I get the result in the first row  for each student and for other rows it returns Nan values
Comment: Can you provide the case on which you tested?
Comment: Solved it! Thanks again!!
Comment: Also I used this code to create table: table = df.groupby(["student","semester","passed_exam"]).size().unstack().reset_index().
Answer: Groupby 'student', use size to count them up, then merge with table:
table.merge(pd.DataFrame(df.groupby('student').size()).reset_index(), on='student')


Mobile apps and websites

Question: I have wondered this for a long time now,but it came up again when my mother asked me:
"Why does facebook open sometimes in the browser if i downloaded the app ?" So i thought is this a technical question and tried to explain her links work,but in the middle of the explanation i wondered..why does facebook even have a website at all? Why is this so confusing to new users? What is the point of adding more confusion-as most people agree the dedicated  app experience is usually superior,and the mobile website uses a completely different design!
The question isnt really about facebook in particular,since there are multiple services which have a mobile website in ADDITION to their own application. Most of these apps are supported on most mobile operating systems so saying "compatibility" is not an acceptable answer in most cases.
I would like some insight on how this works in a UX perspective,this is NOT a marketing/design question
Comment: What, exactly, is your question? Are you asking why some companies have both mobile apps and mobile/responsive web sites?
Comment: @DA01 yes,why it's worth the confusion!
Answer: It's not really a UX question as much as it is a marketing/business decision.
A mobile (or responsive) web site is a must today. So that's the baseline. A company must have a mobile presence on the web as the web is increasingly being accessed on mobile devices and that trend is not going to go away anytime soon.
The reasons to add a mobile app to the mix are varied. They can include:

a desire to have a presence in the app stores. This is more to do with marketing
the CEO really likes apps. This is more to do with vanity.
there is a need/desired to leverage some of the native features of an app (such as push notifications). This is sometimes a UX decision. Often it's a business/marketing decision.
there is a need/desire to provide a level of UX that comes with focusing on the native app for a particular program.

And there are many more, of course.
Mom's aside, I don't think there's necessarily confusion for the user when there are both apps and web sites. In fact, I'd say this is a benefit to the user. It simply gives them another option.
However, there are times when having both is a bad business decision due to the bigger picture. I've seen the following:

A mobile app is created instead of making sure the web site works well on mobile. This forces anyone with a mobile device to download the app. Not a great experience.
A mobile app is created without ensuring design, development and support resources are increased to handle it. This causes a split where you now have half the team working on the mobile web, the other half on the mobile app and both end up suffering for it.
The responsive web site begins to be on-par or exceed the feature set of the mobile app. At this point, the mobile app could be seen as a liability as it's funneling users away from the more powerful option.
The mobile app is a mobile app in name only and is actually a compiled web/hybrid app. While there is nothing inherently wrong with that, I often see it being done as a 'shortcut to the app store' where the only real benefit is for marketing--and the app itself is sub-par.
Comment: nice detailed answer, the issue is that most services like that START as websites and only turn into apps later on, therefore all the scenarios you have suggested are pretty right in my opinion. also talking about useless app forcing decisions *facebook messenger* immediately comes to mind, that annoyed me a whole lot.
Answer: First of all a website is a web-site, which means it runs in a browser. The reason why web became so popular was because of a single medium that translates everything into a single output called HTML.
Mobile apps like Facebook's came later. They became mainstream after Apple introduced their iPhone in 2007. Since the experience on the small, less powerful, mobile browser was not as good as the one on desktop, people opted for developing apps for their websites. And guess what? They became popular because you could do a lot with native apps.
The reason why people have both apps and websites is because not everyone has a phone or not at all times at least. People want to have access to their email, Facebook, etc. anytime and from anywhere.
That said, I think the question should be wether a website should have an app at all. And the answer is yes at least until HTML5/CSS3 become so powerful that it can be on a par with its app counterparts.
Comment: Then why do companies maintain their mobile sites? Since you said native apps are better,and the existence of desktop websites aren't questioned i don't see a reason to use the *less powerful* mobile sites.
Comment: @downrep_nation because you need to have your website to be available from everywhere. Not everyone has an Android and iPhone and even if they do, it's not necessarily the case that they have the native apps installed. I don't have a Facebook app on my iPhone because I don't use Facebook that much but I still want to have access to the service from my mobile browser when I get a message or something in my mailbox.
Comment: i dont buy into that idea,because you are getting a worse experience due to being to lazy/not bothered to get the fairly polished app. Also people who have neither and android/iOS are a massive minority.
Comment: @downrep_nation You are entitled to your opinion. But there's billions of people in the developing world who don't have smartphones. You probably live in a bubble.
Comment: flip phones? What mobile device doesn't have an app store kind of application? Id disagree i live in a bubble.. People who cant get the mobile Facebook app,probably cant properly use the facebook mobile website
Comment: Although I do think it would be interesting if every time you tried to visit a site you already have the app for it opened in the app instead. Not sure if it would be ideal but it would be worth looking into.
Comment: @DasBeasto youtube already does this if you open it thru chrome, and i think thats excellent!
Comment: @downrep_nation The total number of internet users is over 3 billions. Facebook has only 1.44 billion users. If Facebook had an app version only and someone shared a link from Facebook only less than 50% will be able to click on it. I don't have the exact number but Facebook wouldn't be stupid to have the web version if it didn't get significant traffic. Please keep in mind, not everyone uses a smartphone. There were only 1.9 billion smartphones worldwide in 2015.
Comment: @Noah yet again,i didn't criticize the desktop version. Plus im only talking about mobile devices which have access to both apps and the mobile website
Answer: There are many reasons to have a mobile website as well as an app. The main reason being:
No one is going to download an app version of a site they've never used.
Sure Facebook is used by practically everybody, but in fact there are plenty of people that have never used it. It is highly unlikely I am going to go through the effort to download the app just to see what the site is, especially if it's a much lesser known site. Could you imagine doing a google search on your phone and for every site on the results list you had to download their app instead of using their mobile site?
Asside from that there are plenty of reason to keep a site instead of only having an app.

There are those that don't know of the app
Those under parental lock/restriction that can't download the app
Those on work related devices that aren't permitted to download the app
Apps that aren't supported on certain devices (not the case in FB but many sites don't make apps for certain devices especially Windows phones).
People that need to use browser tools such as screen readers, cookie management, plugins, etc.
Phones that don't have enough memory to download an app for each site they want to use.
So links from other sites will work on phones. (in some cases links will open the app but not always)
Comment: i have downloaded multiple apps that dont have a website! the appstore is full of applications without a website
Comment: @downrep_nation That's why I specified app versions of websites, sure games and utility apps are downloaded with no websites. But if I were to say that http://www.designforfounders.com/web-app-ux/ might have some good information about this, and you only had access to your phone. Would you want to click that link and read the article or would you want to go to the app store, find that websites app, download it, find the article I mentioned, and then realize it actually has little to do with your question.
Comment: oh! sorry for missreading, but i think we as you say dont get the app version of a website before trying it. but are you implying that websites are only timely platforms since the developers expect all the frequent users to get the app anyways? i acknowledge some people cant just download any app they want to. but its like we are searching for excuses **NOT** to use the app rather than reason to use the website
Comment: Developers *hope* users download the app not *expect it*. It is certainly ideal for users to have the app from the devs perspective as it likely increases users retention and usage, and from the users perspective as it likely runs smoother and has features like push notification. But there will always be mobile site versions simply for the wide availability, ease of use, and for those you haven't convinced that your site is worth downloading and app for.

Mobile apps and websites


Style does not get added after Importing css into React component

Question: I have this class in a CSS file (TextBoxStyle.css) -
.CustomTextBox{
width: 100%;
border-radius: 4px;
height: 30px;
}

Then I am trying to use this in a React component -
import React from 'react';
import ReactDOM from 'react-dom';
import styleClass from  './TextBoxStyle.css';

export class TextBox extends React.Component{

render(){
                return  (
                <input className={styleClass.CustomTextBox}>
                </input>
                );
}
}

My project gets build successfully as I have installed all necessary loaders through webpack.
However, the class 'CustomTextBox' does not show up in my final html page.
Please let me know if I need to elaborate on any point.
Highly appreciate any help.
Comment: can you include your `webpack.config.js` file?
Answer: If you don't absolutely need to reference CustomTextBox, you could try importing the CSS directly like so:
import './TextBoxStyle.css';

Then change the className on the input like so:
<input className="CustomTextBox">


syntax for merging two tables without column

Question: I am merging two tables where I have 3 conditions to match. But one of them is not the column but only text as "320" for the column "Hesap Grubu".
<code> #"Merged Queries" = Table.NestedJoin(#"Removed Duplicates",
                     {"FirmaID", "Hesap No", {320}},
                     #"Mizan Özet", {
                      "FirmaID", "Hesap No", "Hesap Grubu"},
                     "Mizan Özet", JoinKind.RightAnti),
</code>
I tried 320 and also {320} but it didnt work. Is there any proper syntax for that ?
I also tried as VAR but it is looking for the column named "320" ♂
<code>HesapGrubu = "320",
Table.NestedJoin(#"Removed Duplicates", {"FirmaID", "Hesap No", HesapGrubu }
</code>
I could add one custom column to the table as 320 but i wont prefer if there is a proper syntax to solve faster...
Thanks,
Answer: Wrap the table name with Table.AddColumn (tablename, "new column", each 320) before using it
Comment: Yes, powerquery does not have an option yet to merge on a column that does not exist
Comment: thank you but I've known this option already but it shouldnt be necessary to add a column to merge tables... i think no such option developed yet in powerquery...


What is the last entry in an unfilled array (C++)?

Question: I put C++ because I'm just starting in C# and I'm not sure if there's a difference.
if you declare an array
char arr[10]

and fill in values for arr[0] through arr[8], what value will be put in arr[9]?
a space ' '? An endline '\n'? '\0'? Or is it nothing at all?
I'm asking this because I've always used tactics like this
char word[20];
for(count = 0 ; count < 20 ; count++)
{
  cout << word[count];
}

to print the entire contents of an array, and I was wondering if I could simplify it
(e.g., if the last entry was '\0') by using something like this
char word[20];
while(word[count] != '\0')
{
  cout << word[count];
}

that way, I wouldn't have to remember how many pieces of data were entered into an array if all the spaces weren't filled up.
If you know an even faster way, let me know. I tend to make a bunch of mistakes on arrays.
Comment: "I put C++ because I'm just starting in C# and I'm not sure if there's a difference." There is a HUGE difference.
Comment: I think @Mark severely understated the word HUGE.  It should have been bold, blinking, and had a sound effect.
Comment: I suggest you use a dynamic data structure instead of arrays.
Comment: @JaredPar: And `` too.
Answer: The C# syntax for constructing a character array is:
char[] arr = new char[10];

All values in the array will be initialized to '\0'.
Perhaps a List<char> would be better for your situation where you don't know how many characters you need. Another option to consider is a StringBuilder. Or use a string if you don't need mutability.
Comment: @jwaffe: C#. The C++ equivalent of `List` is `std::vector`. You should really decide which language you wish to program in. It is very unclear from your question whether you want an answer for C++ or C#.
Comment: ok. List, I haven't heard of that. Is that C# or C++?

thanks!
Comment: ok. Sorry, I'm just starting in C#, I don't know enough to really use it for everything, so I still use C++ for console apps. I was trying to fix a bad habit while I was figuring out how C# handles arrays for the first time.
Comment: @jwaffe: Next time I suggest you make two separate questions. :)
Answer: In C++ an array declared like char word[20] will essentially have garbage at every entry.  It does not have nice default values like C# but instead likely just has whatever previously occupied that particular place in memory.  In short don't trust the value unless you've explicitly set it yourself.
Comment: This is true, but not very helpful and doesn't answer the question at all.
Comment: @jwaffe: Suppose the array is allocated on the stack. The "garbage" that is there is the contents of whatever was previously using the stack at that address: local variables, return addresses, whatever. Suppose the array is allocated on the heap. The garbage that is there is whatever was previously using the heap at that address: free list pointers, block sizes, old data, and so on. Because languages like C++ make no guarantees about the contents of memory, they save on the expense of having to initialize it. The cost in the bugs and vulns this strategy causes is passed on to you.
Comment: +1, Although some third party memory management libraries will overwrite the heap they manage with a well-known (to them) pattern in order to detect buffer overruns, new/delete problems, etc.