(Random Walk) Compute average ratio for the number of right cookies to total cookies eaten in a single cycle

Question: This question is a continuation of this post.

Currently I am reading the paper Excited Random Walk in One Dimension.
At page $8$ right column, the authors obtain equation $(33)$.

The joint probability of eating $r$ consecutive cookies on the right and then $l$ consecutive cookies on the left before the next right cookie is eaten, under the initial condition that the walk starts at the position of the right extreme cookie, is
  $$P(r,l) = 4pq \frac{\Gamma(L)}{\Gamma(L-2q)} \frac{\Gamma(L+r-1-2q)}{\Gamma(L+r-2p)}\frac{\Gamma(L+l+r-1-2p)}{\Gamma(L+l+r)}.$$

Let $s = r+l.$
Then the authors used the following formula
$$\bigg\langle \frac{r}{s} \bigg\rangle = \int_0^\infty ds \int_0^s \frac{r}{r+l} \, \tilde{P}(r,s)\,dr$$
to calculate the average ratio for the number of right cookies to total cookies eaten in a single cycle
I am confused with the upper limit of the second integral.
Why do we integrate till $s$ instead of $\infty?$
On the other hand,

Question: What is the formula to calculate average ratio for the number of right cookies to total cookies eaten in a single cycle?

Is it
$$\sum_{l=1}^\infty \sum_{r=1}^\infty \frac{r}{l+r} P(r,l)?$$
Comment: in the paper eq. (33) is different from the one you are reporting
Comment: @G Cab Eq $(33)$ is the asymptotic approximation of the one I report above. What I would like to have is the exact calculation of average ratio...
Comment: in the paper I downloaded as per your link, eq.(33) reads as $P(r,l) = 4pq{{\Gamma (L)} \over {\Gamma (L - 2p)}}{{\Gamma (L + l - 1 - 2p)} \over {\Gamma (L + l - 2q)}}{{\Gamma (L + l + r - 1 - 2q)} \over {\Gamma (L + l + r)}}$
Comment: I believe the formula obtained by the authors has some mistake. I could not obtain exactly the same as their.
Comment: I'll try and investigate on this aspect as well.
Comment: @G Cab Any progress on your investigation?
Answer: a) Changing the variables from $(r,\;l)$ to $(r,\;s=r+l)$ means that
their range will change as follows
$$
\left\{ {\matrix{   {1 \le r < \infty }  \cr    {1 \le l < \infty }  \cr
 } } \right.\quad  \Rightarrow \quad \left\{ {\matrix{   {1 \le r < \infty }  \cr    {r + 1 \le s = r + l < \infty }  \cr
 } } \right.\quad  \Rightarrow \quad \left\{ {\matrix{   {1 \le r < s}  \cr    {2 \le s = r + l < \infty }  \cr
 } } \right.
$$
Note that the map $\left( {r,l} \right)\; \leftrightarrow \;\left( {r,s} \right)$ is bi-jective
so that we can freely convert $P(r,l)$ to $P(r,s)$ and v.v.
$$
P\left( {r,l} \right)\quad \matrix{
   {\buildrel {l\, = \,s\, - \,r} \over \longrightarrow }  \cr
   {\mathrel{\mathop{\kern0pt\longleftarrow} \limits_{s\, = \,r + l}} }  \cr
 } \quad P\left( {r,s} \right)
$$
and we can convert a sum in $P(r,l)$ to a sum in $P(r,s)$  by applying the conversion above to the summand,
and changing the range of summation as specified above.
Analogously can be done for the integral, since the Jacobian of the transformation equals $1$.
We can then write
$$
\eqalign{
  & E\left( {{r \over {r + l}}} \right) = \left\langle {r/s} \right\rangle
  = \sum\limits_{l = 1}^\infty  {\sum\limits_{r = 1}^\infty  {\left( {{r \over {r + l}}} \right)P(r,l)} }
  = \sum\limits_{r = 1}^\infty  {\sum\limits_{l = 1}^\infty  {\left( {{r \over {r + l}}} \right)P(r,l)} }  =   \cr
  &  = \sum\limits_{r = 0}^\infty  {\sum\limits_{l = 0}^\infty  {\left( {{{r + 1} \over {r + l + 2}}} \right)P(r + 1,l + 1)} }  =   \cr
  &  = \sum\limits_{s = 2}^\infty  {\sum\limits_{r = 1}^{s - 1} {\left( {{r \over s}} \right)P(r,s)} }
  = \sum\limits_{s = 0}^\infty  {\sum\limits_{r = 0}^s {\left( {{{r + 1} \over {s + 2}}} \right)P(r + 1,s + 2)} }  \cr}
\tag{a.1}$$
b) Upon rescaling the variables dividing by $L$, then for large values of $L$
same as in the precedent post, you can approximately consider $\tilde r=r/L,\; \tilde s =s/L$ to be continuous,
i.e. convert the sum in a Riemann sum in $\Delta r/L, \; \Delta s/L$, and approximate with the corresponding integral.
The multiplicative factor is included in the approximation provided for $P(\tilde r, \tilde s)$, which integrates to $1$.
In passing to the integral the small "deviations" in the integration bounds given by the limits in the sum , will be negligible once
divided by $L$.
c) Concerning the possibility to evaluate exactly the expected ratio $r/(r+l)$, we are going to have
$$
\left\langle {{r \over {r + l}}} \right\rangle  = \sum\limits_{r = 0}^\infty  {\sum\limits_{l = 0}^\infty  {\left( {{{r + 1} \over {r + l + 2}}} \right)P(r + 1,l + 1)} }
\tag{c.1}$$
Taking  $P(r,l)$ to read as given in the paper
$$
P(r,l) = 4pq{{\Gamma (L)} \over {\Gamma (L - 2p)}}{{\Gamma (L + l - 1 - 2p)} \over {\Gamma (L + l - 2q)}}
{{\Gamma (L + l + r - 1 - 2q)} \over {\Gamma (L + l + r)}}
\tag{c.2}$$
we get
$$
\eqalign{
  & \left\langle {{r \over {r + l}}} \right\rangle
  = \sum\limits_{l = 0}^\infty  {\sum\limits_{r = 0}^\infty  {\left( {{{r + 1} \over {r + l + 2}}} \right)P(r + 1,l + 1)} }  =   \cr
  &  = 4pq{{\Gamma (L)} \over {\Gamma (L - 2p)}}\sum\limits_{l = 0}^\infty  {{{\Gamma (L + l - 2p)} \over {\Gamma (L + l + 1 - 2q)}}
 \sum\limits_{r = 0}^\infty  {\left( {{{r + 1} \over {r + l + 2}}} \right){{\Gamma (L + l + r + 1 - 2q)} \over {\Gamma (L + l + r + 2)}}} }  \cr}
\tag{c.3}$$
The inner sum becomes
$$
\eqalign{
  & \sum\limits_{r = 0}^\infty  {\left( {{{r + 1} \over {r + l + 2}}} \right){{\Gamma (L + l + r + 1 - 2q)} \over {\Gamma (L + l + r + 2)}}}  =   \cr
  &  = \left( {{1 \over {l + 2}}} \right){{\Gamma (L + l + 1 - 2q)} \over {\Gamma (L + l + 2)}}\;
  {}_3F_{\,2} \left( {2,\,2 + l,\,L + l + 1 - 2q\;;\;3 + l,\,L + l + 2\;;\;1} \right) \cr}
\tag{c.4}$$
and, although there might be some other ways to put it, I do not see an easy way to express the double sum.
d) Passing to asymptotics, using for $P(r,l)$ the expression provided at the end of eq.(33)
$$
P(r,l) \approx 4q\left( {1 - q} \right)L^{\,2q} \left( {L + r} \right)^{\,1 - 4q} \left( {L + r + l} \right)^{\,2q - 3}
\tag{d.1}$$
we get
$$
\eqalign{
  & \left\langle {{r \over {r + l}}} \right\rangle
  = \sum\limits_{l = 0}^\infty  {\sum\limits_{r = 0}^\infty  {\left( {{{r + 1} \over {r + l + 2}}} \right)P(r + 1,l + 1)} }  =   \cr
  &  = 4q\left( {1 - q} \right)L^{\,2q} \sum\limits_{r = 0}^\infty  {\left( {L + r + 1} \right)^{\,1 - 4q}
  \sum\limits_{l = 0}^\infty  {\left( {{{r + 1} \over {r + l + 2}}} \right)\left( {L + r + l + 2} \right)^{\,2q - 3} } }  =   \cr
  &  = 4q\left( {1 - q} \right)L^{\,2q} \sum\limits_{r = 0}^\infty  {\left( {L + r + 1} \right)^{\,1 - 4q} \left( {r + 1} \right)
  \sum\limits_{l = 0}^\infty  {{1 \over {\left( {r + l + 2} \right)\left( {L + r + l + 2} \right)^{\,3 - 2q} }}} }  \cr}
\tag{d.2}$$
From here, and starting from the inner sum, various approaches can be taken and evaluated
against the expected error.
 It is not this the place to conduct such an analysis, so I will limit to hint  some possible approach.
For instance, since $3-2q$ ranges from $1$ to $3$, then we can develop the sum
$$
\sum\limits_{k = 0}^\infty  {{1 \over {\left( {k + a} \right)\left( {k + b} \right)^{\,n} }}} \,\;\left| {\;n = 1,2,3} \right.
$$
into partial fractions, solve in terms of the polygamma functions $\psi^{(0)},\,\psi^{(1)},\,\psi^{(2)}$,
and interpolate for the actual value of $3-2q$.
Otherwise we can replace the summand with its asymptotic series for $k \to \infty$
$$
\sum\limits_{k = a}^\infty  {{1 \over {k\left( {k + b} \right)^{\,c} }}}
  = \sum\limits_{k = a}^\infty  {\sum\limits_{j = 0}^\infty  {{{\left( { - 1} \right)^j b^j c^{\,\overline {\,j\,} } } \over {j!k^{\,c + 1 + j} }}} }
$$
appropriately truncate it, use the Hurwitz zeta function, ...
e) If, as you requested, we want to work directly on the sum given in c), then we have better and put it
under the version
$$
\eqalign{
  & \left\langle {r/s} \right\rangle  = \sum\limits_{s = 0}^\infty  {\sum\limits_{r = 0}^s {\left( {{{r + 1} \over {s + 2}}} \right)P(r + 1,s + 2)} }  =   \cr
  &  = 4pq{{\Gamma (L)} \over {\Gamma (L - 2p)}}\sum\limits_{s = 0}^\infty  {{1 \over {s + 2}}  {{\Gamma (L+s+1-2q)} \over {\Gamma (L+s+2)}}
  \sum\limits_{r = 0}^s {\left( {r + 1} \right){{\Gamma (L + s - r - 2 + 2q)} \over {\Gamma (L + s - r + 1 - 2q)}}} }  =   \cr
  &  = 4\left( {1 - q} \right)q{{\Gamma (L)} \over {\Gamma (L - 2 + 2q)}}
 \sum\limits_{s = 0}^\infty  {{1 \over {s + 2}}\left( {L + s + 2} \right)^{\,\overline {\, - 1 + 2q\,} }
 \sum\limits_{r = 0}^s {\left( {r + 1} \right)\left( {L + s - r + 1 - 2q} \right)^{\,\overline {\, - 3 + 4q\,} } } }  \cr}
\tag{e.1}$$
where $x^{\,\overline {\,a\,} }$ and $x^{\,\underline {\,a\,} } $ denote respectively the Rising and Falling factorials.
Now the matter here is that the exponents in $q$ are in general not integer. Therefore

for an "exact" approach I cannot devise other than the approach through the Hypergeometric
function already described, for which the second sum would be difficult to express.
going asymptotically, for large $L$ and thus large values of the base argument of the Rising factorial,
I can devise only a couple of ways

e.1) asymptotics of Gamma by using
$$
\eqalign{
  & z^{\,\overline {\,w\,} } \quad \left| \matrix{
  \;\left| z \right| \to \infty  \hfill \cr
  \;\left| {\arg (z + w)} \right| < \pi  \hfill \cr}  \right.\quad  \propto   \cr
  & z^{\,w} \left( {1 + {{w\left( {w - 1} \right)} \over {2z}} + {{w\left( {w - 1} \right)\left( {w - 2} \right)\left( {3w - 1} \right)} \over {24z^{\,2} }}
 + O\left( {w^{\,6} /z^{\,3} } \right)} \right) \cr}
\tag{e.2}$$
which, when taking the first term only would give the asymptotics reported by them at the end of eq.(33),
but when applied to the $P(r,l)$ that you report here in your post, and not that in the same eq.(33).
So it seems you are right for this: I did not analyze this aspect yet.
e.2) interpolation of solutions with integer exponents
since for $q=0,1/4,1/2,3/4,1$  the factorial can be split in a few terms , it might be possible to
absorb the $(r+1)$ factor in front of it by partial fractions and express the inner sum with a few terms in $\psi$,
to be then interpolated ...
However everything depends on what is your goal: better approximation ?
f)  Upon further investigation, the most promising approach seems that can be derived from these
integral representations of the Rising Factorial
$$
x^{\,\underline {\,y\,} } \quad \left| \matrix{\;x,y \in \; \mathbb R \hfill \cr
  \; - 1 < y \hfill \cr}  \right. = {{\Gamma (y + 1)} \over {2\,\pi }}\int_{ - \,\pi }^\pi  {e^{\, - \,i\,y\,t} \left( {1 + e^{\,i\,t} } \right)^{\,x} dt}
\tag{f.1}$$
derived from the representation of the Binomial, and
$$
z^{\,\overline {\, - w\,} } \quad \left| \matrix{
  \;0 < {\mathop{\rm Re}\nolimits} (z) \hfill \cr
  \;0 < {\mathop{\rm Re}\nolimits} (w) \hfill \cr}  \right.\quad
 = {1 \over {\Gamma (w)}}\int_{\,0}^{\,1} {t^{\,z - 2} \left( {{{1 - t} \over t}} \right)^{\,w - 1} dt}
\tag{f.2}$$
derived from that of the Beta function.
Then, for instance, the inner sum in (e.1) becomes
$$
\eqalign{
  & \sum\limits_{r = 0}^s {\left( {r + 1} \right)\left( {L + s - r + 1 - 2q} \right)^{\,\overline {\, - \left( {3 - 4q} \right)\,} } }
 \quad \left| {\,q < 3/4} \right.\quad  =   \cr
  &  = \sum\limits_{r = 0}^s {\left( {r + 1} \right){1 \over {\Gamma (3 - 4q)}}\int_{\,0}^{\,1} {t^{\,L + s - r + 1 - 2q}
 \left( {{{1 - t} \over t}} \right)^{\,2 - 4q - 1} {{dt} \over {t^{\,2} }}} }  =   \cr
  &  = {1 \over {\Gamma (3 - 4q)}}\int_{\,0}^{\,1} {\left( {\sum\limits_{r = 0}^s {\left( {r + 1} \right)t^{\, - r - 2} } } \right)
 \left( {{{1 - t} \over t}} \right)^{\,2 - 4q - 1} t^{\,L + s + 1 - 2q} dt}  =   \cr
  &  = {1 \over {\Gamma (3 - 4q)}}\int_{\,0}^{\,1} {{d \over {dt}}\left( {\sum\limits_{r = 0}^{s + 1} {t^{\, - r} } } \right)
 \left( {{{1 - t} \over t}} \right)^{\,1 - 4q} t^{\,L + s + 1 - 2q} dt}  =   \cr
  &  = {1 \over {\Gamma (3 - 4q)}}\int_{\,0}^{\,1} {\left( {{{\left( {s + 2} \right)t - 1 - s - t^{\,s + 2} }
 \over {t^{\,s + 2} \left( {1 - t} \right)^{\,2} }}} \right)\left( {{{1 - t} \over t}} \right)^{\,1 - 4q} t^{\,L + s + 1 - 2q} dt}  =   \cr
  &  =  - {1 \over {\Gamma (3 - 4q)}}\int_{\,0}^{\,1}
 {{{\left( {\left( {s + 1} \right) - \left( {s + 2} \right)t + t^{\,s + 2} } \right)t^{\,L + 2q - 2} } \over {\left( {1 - t} \right)^{\,1 + 4q} }}dt}  \cr}
$$
Since the exponent of $(1-t)$ is negative, it seems that
we cannot convert the integral to a combination of Beta functions:
to be checked.
However we can take due advantage of the fact that $0 \le t \le 1$
to develop the integral in series.
Similarly for the outer summation.
Comment: I understand the change of variables in (a). However, when you calculate $E\left( \frac{r}{r+l}\right),$ why do we switch from $P(r,l)$ to $P(r,s)?$ I thought we have formula for $P(r,l)$ but not $P(r,s)?$ Possible to have exact calculation for $E\left( \frac{r}{r+l}\right)?$
Comment: @Idonknow: added note to a) and para. c) to answer to your comment above
Comment: @ G Cab at eq $(36)$, the authors manage to obtain an equation in an asymptotically manner, that is, the equal sign in the equation refers to asymptotically equal. Would that equation help in some way for your double sums to go through?
Comment: @Idonknow: they obtain eq.(36) by integration. Passing to asymptotics, the approximation they give at the end of eq.(33) could be used in the sum.
Comment: @G Cab I see. Is it possible to obtain similar result using series provided above?
Comment: @Idonknow: added para. d) to this regard
Comment: sorry, there was a typo in formulas in c) :  amended
Comment: @ G Cab at the beginning of paragraph (d), you used asymptotic approximation of $P(r,l)$, is it possible that we do not use the approximation and conduct analysis on the original $P(r,l)$?
Comment: @G Cab In paragraph (d), you stated that various approaches can be used to evaluate the expected error. Possible to show one approach on how to calculate the error? Thanks.
Comment: @Idonknow: added e)
Comment: @G Cab In e.1), you mentioned the following:

'when taking the first term only would give the asymptotics reported by them at the end of eq.(33), but when applied to the P(r,l) that you report here in your post, and not that in the same eq.(33).
So it seems you are right for this: I did not analyze this aspect yet.'

Do you mean that my $P(r,l)$ reported in my post can give us correct asymptotic equation in the paper?
Comment: @G Cab Also, regarding the last question in your answer above, I would like to obtain eq (36) in the paper. Is it possible?
Comment: @G Cab I just realize, in (c), what is $_3 F_2?$
Comment: @G Cab I found Appell series, (https://en.wikipedia.org/wiki/Appell_series) which is a double hypergeometric series. Would it help for exact form of the series to obtain eq(36)?
Comment: @Idonknow: 1) yes, (e.2) applied to your $P(r,l)$ gives (d.1)  2) I deem the best way is through integrals as they did 3) it is a [generalized hypergeometric](https://en.wikipedia.org/wiki/Generalized_hypergeometric_function) 4) Appell series is really interesting..let's see if we can fit it in
Comment: @G Cab 2) possible to show me how integration leads us to eq 36 of the paper? 4) it would be very interesting if we can use Appell series to obtain eq 36.
Comment: @Idonknow: wandering around the pros&cons of various approaches I finally arrived to the Integral Representation: this looks to me promising for many reasons. So sorry, I left out (for the moment at least) the other possibilities.
Comment: @G Cab after representing rising factorial as integration, I fail to understand why we put the summation inside the integral. In other words, I do not know how to evaluate the integral of the sum. May you be able to give me some hints?
Comment: that is just the derivative of $(t - 1/t^(s + 1))/(t - 1)$: finally we get a rational expression with $t$ and $(1-t)$ at non integer exponents. We cannot find the integral directly (too nice!), but we shall wisely manipulate the fraction and expand it into series in $t$ (or $t-1/2$), and we should also be able and find an $O(t^m)$ to bind the error.
Comment: @Idonknow: thanks: the problem is interesting and I will continue to look if I can find a better solution
Comment: @G Cab I offer another bounty for obtaining a closed form formula for the average ratio at another post. https://math.stackexchange.com/questions/2977213/simplify-sum-l-0-infty-sum-r-0-infty-frac-gammalr-2q-gammalr-1
If you are interested, you can try to solve it.


What is behind the statue in majula

Question: What exactly is behind the statue in majula? I haven't opened it yet because I don't want to be attacked.
Comment: It's not entirely clear what you are asking? Can you be a bit more specific about which statue/where it is located. Perhaps include a screenshot?
Comment: I have edited the question to correct the location name. If you are referring to a different location, please correct it.
Comment: Majid isn't a place in DS2... do you mean Majula? If so, what makes you think you'd be attacked? This is extremely unclear due to the place being asked about not existing. If you could update the question with more information, that would be very helpful.
Comment: I'm so sorry I ment Majula.I was also taking about Rosabeth of Melfia. And l'm kind of a new to this game and have a weak character. But thank you Ben for your answer it was very helpful
Comment: Vemonus, you made it sound like I wouldn't be attacked but a group of troll things attacked me.How am i to kill all of them man?
Answer: There are only 2 statues in this area, one is in Majula, the other in Things Betwixt (if you are playing SotFS)
Majula: This statue is Rosabeth of Melfia, and she blocks the entrance to the Shaded Woods. You will need to free her, if you want to progress through the game.

Things Betwixt: There is now a statue found in Things Betwixt, of an undead. This statue blocks the way to an Estus Shard. I'm not sure which one was moved, but I'd say it is one of the intended 12 needed to completely upgrade your Estus Flask (Which is redundant, because you can simply get them in ng+).

What is behind the statue in majula


Can I add visualizations related to mulitple indexes to single kibana dashboard?

Question: I have two indexes which configured in kibana.
I want to display graphs from two indexes in one dashboard is kibana support this? In kibana4 and above has this but I would like to know is this supports in kiban3
Answer: you can do this by adding an index pattern that matches the two indices, and then select this index pattern to create visualization.


get a csv file as a http download

Question: I have to create a CSV file on a nightly process and avail those files to client as an http download.
I have created a CSV with the help PLSQL block as:
DECLARE
    F UTL_FILE.FILE_TYPE;
    CURSOR C1 IS SELECT emp_id, name FROM employee;
    C1_R C1%ROWTYPE;
BEGIN
    F := UTL_FILE.FOPEN('EXPORT_DIR','employee.csv','w',32767);
    FOR C1_R IN C1
    LOOP
        UTL_FILE.PUT(F,C1_R.emp_id);
        UTL_FILE.PUT(F,','||C1_R.name);
        UTL_FILE.NEW_LINE(F);
    END LOOP;
    UTL_FILE.FCLOSE(F);
END;
/

this will create a CSV file "employee.csv" on the database server. Now I have to avail this file to the clients as a HTTP downloadable file. How to do that ?
Comment: where is your files store is it in table ?
Comment: no, its on server side on, stored on the disk with a specific name.
Comment: ok.. than passed that file path to below example. This will prompt user to save or open file.
Answer: You can provide one Servlet to download your file as a csv format.
DoanloadServlet.java :
public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

try{
     //set content type to csv and response as attachment
     response.setHeader("Content-Type", "text/csv");
     response.setHeader("Content-Disposition", "attachment; filename=Myfile.csv");
     OutputStream out = response.getOutputStream();

     //read your file from database in outputstream
     FileInputStream in = new FileInputStream(my_file);
     byte[] buffer = new byte[4096];
     int length;
     while ((length = in.read(buffer)) > 0){
          out.write(buffer, 0, length);
     }
     in.close();
     out.flush();
  }
  catch(Exception e)
  {
    //Exception handling
  }

}

Give user a link and call this servelet with required parameter to find file from database.
You link look like this
http://serveraddress.com/DoanloadServlet?fileName=name_of_file
Answer: I found it easy to copy the generated file web server. we can just use SCP or FTP to the generated file on webserver. e.g.
scp /mnt/csv_dir/feed.csv root@server:/home/stackoverflow/www/csv

Add this command in a nightly process to run
The above command will move the feed.csv from csv_dir to csv folder of web server.
now we will be able to access the file using the web url.

get a csv file as a http download


Paint and Application Method for Stair Risers

Question: I'm getting ready to install pre-finished hardwood on  the treads of a staircase that was previously carpeted. Rather than installing the hardwood on the risers as well, I'm planning to install white, painted boards. I intend to paint the boards before I install them, and I'm just looking for some advice on the type of paint to use and how I should apply it, as I've struggled to get good results painting trim and doors in the past. I've always used water-based semi-gloss paint, and recently I've started adding floetrol, which has helped some with brush marks, but I still haven't been able to get the kind of results I would like.
I would really like to avoid brush marks on these treads if I can help it, and I'd also like to go with a really tough paint that won't scuff easily and that will clean up well. So should I go with an oil-based paint? I gather that spraying is probably the best way to paint these, but I don't have a paint sprayer. Any suggestions to work around that? Or should I just suck it up and buy a sprayer? Any tips, tricks, or suggestions are appreciated.
Comment: Renting an airless sprayer beats buying a cheap one for a single use. Even if the cost is similar the rental will be a much higher quality. Personally I would opt for a small roller.
Answer: My recommendation is a gloss cabinet paint with a good paint brush.
We painted our stairs(after filling in the nail holes) with this type of paint. Put a carpet runner on. Now it looks like a staircase from a design magazine.
Answer: You can attain a beautiful mirror-like finish with no brush marks if you:

use only the best professional grade paint brush you can get; seriously, this will probably be the biggest factor in getting the finish you want
use high quality paint and never do it in direct sunlight or when it's too hot (>80°F), no Floetrol necessary
lay the panels flat on sawhorses and paint each panel all in one go; always maintain a wet edge, never stop midway through
if the wood is bare, prime first
use high gloss paint for best durability and "washability"
high quality water based paint will perform perfectly and will be easier as opposed to oil


How to get the "Overkill" achievement on Minecraft?

Question: I'm having some problems to get the "Overkill" achievement.
The achievement's description says:

Deal eight hearts of damage in a single hit.

So to achieve this achievement I built a Diamond Sword and then I used the last enchantment at the enchantment list and it didn't worked.
What should I do to achieve this achievement?
NOTE: The enchantment was the one that used something like 9 of my levels.
Comment: If the last enchantment in the list only used 9 levels, you don't have a very efficient enchantment table setup! [This image](http://unix.stackexchange.com/questions/137905/can-i-drag-a-file-into-a-window-without-a-file-manager) that I just stole off the wiki shows how you can place bookshelves near your enchantment table to get more powerful enchantments, but they will cost you more levels.
Answer: So the diamond sword was a good start.
Enchanting is the right way to go, you'll want a high level enchantment though, save up your 30 levels and spend them all at once (it doesn't take too long to get to 30).
Make sure you've got one of Smite, Bane of Arthropods or Sharpness. The first two are better, as they deal more damage, but you can still do it with Sharpness.
Once you've enchanted, find out what your sword can damage most. I.e. if it's got Bane of Arthropods, find a spider.
Next, maximise your damage by jumping to deal a critical hit. With all these factors you should easily deal 8 hearts of damage.
Remember that the amount of damage per hit varies, so you may need to whack a few mobs before you get the achievement.
Comment: Thanks for the answer fredly, but what's the best way to get levels fastly?
Comment: It depends! Mining ore is pretty good, but gets a bit tedious. Fighting mobs is quick, but risky as you might die and lose all of them. Building a mob/exp farm is fastest, but requires quite an investment of time to get it up and running.
Answer: For me a Strenght 2 potion and a Iron Sword with Sharpness 1 killed zombies and skeletons in 1 hit, without critting. Enderman went down in 2 hits.
Answer: You must enchant a sword for bonus attack. Then,you can either fly to deal a critical hit or drink a Strength potion. Note that the attack a weapon has are half-hearts (e.g. The diamond sword gives +7 attack strength= +3.5 hearts damage dealt).
Answer: I got a diamond sword, decided to go absolutely ballistic, (I had about 200 levels) and enchanted it with all possible enchantments, even the ones not meant for swords. (I did this by combining the sword with enchanted books) I then got a critical hit on a zombie to complete the mission. Not only I did the 8 hearts of damage, I killed it in one single hit! Hope this helps.


Programmatically select a specific TreeViewItem into an unbound TreeView

Question: In the code behind of my Silverlight application, I have the need to re-populate the TreeView and then make a specific TreeViewItem selected.
The code itself is pretty simple, here it is (i'll trim and pseudo-code-ify it to make it as short as possible)
private void Button_Click()
{
    Guid idToSelect = TellMeWhatToSelect();
    List<myObject> myDataList = myObjectRepository.RetrieveData().ToList();

    myTreeView.Items.Clear();
    foreach(myObject o in myDataList)
    {
        myTreeView.Items.Add(new TreeViewItem() { Content = o.DataField, Tag = o.Id });
    }

    myTreeView.Items.First(o => ((Guid)(o as TreeViewItem).Tag).Equals(idToSelect)).IsSelected = true;

}

That's basically it: i'm reading some data into myDataList, then i cycle through it and create as many TreeViewItems as needed in order to display the data.
Problem is, myTreeView.SelectedItem is null at the end of this, and SelectionChanged event isn't triggered. I would think that, since Items collection has been cleared and re-filled, switching IsSelected on one of the items would act like clicking, but it seems it doesn't).
Oddly enough (for me at least), issuing myTreeView.Items.First().IsSelected = true; by itself (that is, calling a method with that single line of code inside) works as expected: SelectedItem is there and all events are fired appropriateyl.
What's wrong with my code and/or what am I missing ? Looks like cleaning items up kind of breaks something.
I'm fairly sure others have had similar issues, but a bunch of searches I tried didn't help (most of the info & questions I came up with are WPF-related).
Thanks for your time, I'll provide more info if needed. Also, sorry for the wall of text.
UPDATE
Modifying code like this, now the method works as expected.
private void Button_Click()
{
    Guid idToSelect = TellMeWhatToSelect();
    List<myObject> myDataList = myObjectRepository.RetrieveData().ToList();

    myTreeView.Items.Clear();
    foreach(myObject o in myDataList)
    {
        myTreeView.Items.Add(new TreeViewItem() { Content = o.DataField, Tag = o.Id });
    }

    Dispatcher.BeginInvoke(()=>
    {
        myTreeView.Items.First(o => ((Guid)(o as TreeViewItem).Tag).Equals(idToSelect)).IsSelected = true;
    });
}

Answer: Set property IsSelected inside of Dispatcher.BeginInvoke.
Comment: Right on the spot! Going to update my question to show the updated code. Thank you very much.
Comment: Let me add some explanation: As I understand this correct you tried to update visual appearance of control before it was build.
Comment: Yes, that must have been the issue. Oddly enough, I could see the selection "move" as the selection box in fact *was* changed, but the application 'thought' there wasn't any selection.
Answer: I had the same problem a while ago, I've solved by calling the UpdateLayout method from the treeview before setting the TreeViewItem as selected.Like this:
 myTreeView.UpdateLayout();
 myTreeView.Items.First(o => ((Guid)(o as TreeViewItem).Tag).Equals(idToSelect)).IsSelected = true;


How distribution nomenclature is done?

Question: How does Ubuntu distribution nomenclature is done? For example why does 14.04 Ubuntu is given the name "Trusty Thar"? Likewise what are the motivation for such nomenclatures for all the released versions? Also who is the authority to decide a name?
Answer:
So, what's with the "Funky Fairy" naming system? Many sensible people have wondered why we chose this naming scheme.
It came about as a joke on a ferry between Circular Quay and somewhere else, in Sydney, Australia:
lifeless: how long before we make a first release?
sabdfl: it would need to be punchy. six months max.
lifeless: six months! thats not a lot of time for polish.
sabdfl: so we'll have to nickname it the warty warthog release.
Source.

That's how the first major Ubuntu release got his name : Warty Warthog ... and since then, the form "Adjective Animal" stayed.

Canonical, in particular Mark Shuttleworth, decides about the release name finally.
But users can propose a name here - it might be picked up by the team eventually.

How distribution nomenclature is done?


Can't open 4444 port in gufw

Question: I've added a SSH rule for adding 4444 port in my distro through gufw but when I run
nmap -sV 10.9.0.136 -A

it shows :
Starting Nmap 7.40 ( https://nmap.org ) at 2017-04-25 11:30 IST
Nmap scan report for 10.9.0.136
Host is up (0.00013s latency).
All 1000 scanned ports on 10.9.0.136 are closed
Too many fingerprints match this host to give specific OS details
Network Distance: 0 hops
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 3.50 seconds

What am I doing wrong?
gufw rule
Comment: Are you sure that service listen for connection on port `4444`. Do you see service in listening state in output from command `netstat -atpn`?
Comment: First, try with command `nmap 10.9.0.136 -P0` and give me output. Also give me output from firewall rules `sudo ufw status`
Comment: Sorry, `nmap` scan first 1024 port's, Add port range in command for scan `nmap -p 1-5000 10.9.0.136 -P0`
Comment: for sudo ufw status: `Status: active To                         Action      From
--                         ------      ----
10.9.0.136 4444/tcp on eth0 ALLOW       10.9.0.136 4444/tcp`
Comment: `Nmap scan report for 10.9.0.136
Host is up (0.000023s latency).
Not shown: 4999 closed ports
PORT    STATE SERVICE
538/tcp open  gdomap` still port 4444 is closed.
Comment: no, there is no service listening on port 4444.
Comment: i've an image for `gufw rule`, please check it out
Comment: Is your sshd_config configured to use port 4444? You can't expect a port to be open if nothing is opening it. All that firewall rule is doing is allowing access through the port, not opening it.
Comment: You need a service configured to listen or use the port in order for the port to be opened. If you configure ssh to use port 4444 for example, the port would then be opened, and your firewall rule would allow connections to that port.
Answer: "By default, Nmap scans the most common 1,000 ports for each protocol. "
Try to specify -p4444
Comment: `Nmap scan report for 10.9.0.136
Host is up (0.00012s latency).
PORT     STATE  SERVICE
4444/tcp closed krb524`

Can't open 4444 port in gufw


how to use my getvalues() method in main to print the list

Question: The method does not show any error but I am unable to use it in main method to display the list.
    if (userinput.equalsIgnoreCase("push") )
    {   calc.push(value);
        calc.displaylist();
         System.out.println(calc.getValues());
    }
    else if (userinput.equalsIgnoreCase("mult"))
    {  calc.push(calc.mult());
       calc.getValues(); }

how to use this method ... instead i used a methos called display list and that works but i need to know how to use my getValues method. both the methods are as below :
Double[] getValues()
    {

      Double[] array = new Double[values.size()];
      return values.toArray(array);
    }

    void displaylist()
    {
        for(Double d : values)
          System.out.println(d);
    }

Comment: thank you all .... here's how I used my getValues() by assigning it to another variable.. I also learned that I should be more clear in expressing my query ... will certainly try to improvise on that.

Double[] returnValues = calc.getValues();
              for ( int i=0; i<returnValues.length; i++)
              System.out.println(returnValues[i]);
Answer: You can use a static method called toString(Object[]) in the java.util.Arrays class.
Answer: Well your displaylist() method contains a for-each loop that will iterate over the contents of a collection.  The collection to iterate over is on the right side of the ':'.  You've got a method that returns a collection - specifically, a Double[] - so you can call your getValues() method in place of the collection.
So, try this:
void displaylist()
{
    for(Double d : getValues()) System.out.println(d);
}

Answer: I'm trying to understand the question - Let me restate it and see if I got it or not:

You have an object that has a Collection (probably a List) of values called values.
You have a method, getValues(), which returns an array containing all of the values in values.
You would like to print out all of the values in values.
You are required (homework?) to use the getValues() method when printing out values in values.  (If you're not required to use getValues(), then I don't see what's wrong with the displaylist() method that you already wrote.)
You tried to just call System.out.println() on the array that you got from getValues(), but that just printed something awful like "[Ljava.lang.Double;@39172e08".

Did I get it?
Unfortunately, even with all that, I'm not sure what to suggest because I don't know what you want the printed out version to look like.
Should the values be separated by commas?  If so, Ash's answer will do this for you.
Should each one be on its own line?  If so, Shakedown's answer will do this for you.
Should the values just be separated by spaces?  If so, then you can modify Shakedown's answer to use print(d + " ") instead of println(d).


OpenShift Redirect Loop between www and non-www

Question: I'm experiencing an infinite redirect loop when I try to access my site. The redirect loop seems to be between the non-www version and the www version.
My DNS has a URL Redirect set for http://domain.tld to www.domain.tld. Then www.domain.tld has a CNAME record for app-namespace.rhcloud.com.
For the app I added the alias www.domain.tld
I've also tried to add an alias for domain.tld, but that doesn't help.
Is there something I'm missing? Thank you very much for your help!
Answer: I'm hosting a laravel 5 project on openshift.  www and non-www are tricky but I finally got it working with a simple 2 part solution...

since you can't use non-www for a cname, make it an A-record to 126.96.36.199 and they will add the www.  That's all they seem to do.  Weird, I know.
Use this in your .htaccess It seems to work better in cloud situations.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Answer: I found the issue. It was due to a redirect from www.domain.tld to domain.tld that was caused by a rewrite rule in the .htaccess file:
<IfModule mod_rewrite.c>
    #RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>
Removing this resolved the issue.
Comment: Facing this exact problem. What is the location of the .htaccess file in Openshift from where you removed these lines?
Comment: That was in the root of my project. I took that from a template some time ago.


jQuery form submit: add element, then $.post problems

Question: On form submit I want to serialize the form's elements, then stick another field on, then submit with $.post. Can't quite get it. The form's submit action looks like:
data = $(this).serializeArray();
data.push({filter: $.toJSON(filter)});

$.post("/datawarehouse/new.php", data);
return false;

But it's just the form's fields and then undefined/undefined. For the record $.toJSON(filter) works as I've seen the output. Also tried:
data.filter = $.toJSON(filter);

And
data['filter'] = $.toJSON(filter);

Any ideas?
Answer: I think you might have better luck putting a hidden field in your form and on form submit, set the value of the hidden field.  Let the jquery serializer handle the serialization.


Create a Minecraft Item that Executes a Command

Question: I am using creative mode to tag Minecraft villagers as an adult or child.
Here is the code I am using:
/data merge entity @e[type=villager,limit=1,sort=nearest] {Tags:["child"]}
/data merge entity @e[type=villager,limit=1,sort=nearest] {Tags:["adult"]}
However, I want players in survival mode to be able to add these data tags to villagers. Can I create an item that, when right clicked, will execute one of these commands? I think I may need to use a carrot on a stick (since it can detect a right click) but I am not certain. Ideally, I would like to use two sticks: one called "child age wand" and the other called "adult age wand." How would I do this?
Comment: Possible duplicate of [How can I apply an effect when a player left-clicks/right-clicks with an item in hand?](https://gaming.stackexchange.com/questions/226476/how-can-i-apply-an-effect-when-a-player-left-clicks-right-clicks-with-an-item-in)
Comment: Do you want this to tag the closest villager (easy, just use useItem scoreboard for carrot on a stick and select closest villager) or the one that the player is looking at (very complicated and laggy, requires raytracing)?
Answer: The only item which supports right-click detection without using tricky methods is the carrot on a stick so that's what I will use for this example.
First, you need an objective to track when the player right-clicks with it. This only needs to be initialized once so you can run it in chat.
/scoreboard objectives add clicked minecraft.used:minecraft.carrot_on_a_stick

this command needs to run in a repeating command block:
/execute at @a[scores={clicked=1..},nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{display:{Name:"\"name_here\""}}}}] run tag @e[type=villager,limit=1,sort=nearest] add child

^ write one more for the other carrot on a stick but change the name and tag. This command should be running in a chain (always active) command block attached to the repeating one:
/scoreboard players reset @a[scores={clicked=1..}] clicked

to generate your carrots on a stick, use this command:
/give @s minecraft:carrot_on_a_stick{display:{Name:"\"name_here\""}}


Gets an error of 500, in the function I want to put in the firestore

Question: Hello everyone I am new here on the site, I joined just a few days ago.
I have a problem that I do not understand why I have it.
I have a server side function I built, I call it axios.
I happen to her on the client side.
These are the steps of calling a function:
Client side calling:
export const getRealtimeConversations = (user) => (dispatch) => {

    //testing
    user = { uid_1: user.handle, uid_2: chat.handle };

    axios.get('/realtimeConversations',
    {
        params: {
            user: JSON.stringify(user)
        }
      }
    )
        .then((res) => {
            dispatch({
                type: userConstants.GET_REALTIME_MESSAGES,
                payload: res.data
            });
        })
        .catch((err) => console.log(err))

}

The axios:
app.get('/realtimeConversations', FBAuth, getRealtimeConversations);

The function itself on the server side:
exports.getRealtimeConversations = (req, res) => {

    if (req.query.user) {
        user = JSON.parse(req.query.user);
      }

    db.collection('conversations')
        .where('user_uid_1', 'in', [user.uid_1, user.uid_2])
        .orderBy('createdAt', 'asc')
        .onSnapshot((querySnapshot) => {

            const conversations = [];

            querySnapshot.forEach(doc => {

                if (
                    (doc.data().user_uid_1 == user.uid_1 && doc.data().user_uid_2 == user.uid_2)
                    ||
                    (doc.data().user_uid_1 == user.uid_2 && doc.data().user_uid_2 == user.uid_1)
                ) {
                    conversations.push(doc.data())
                }

            });
            console.log(conversations);
            return res.json(conversations);
        })
}

I get an error message 500, I tried to run the function through the postman but I get an error 500.
this is how i call it in postman:

I'm pretty sure there's something very small here that's ruining my function. Maybe I happen to function through get in axios, maybe I do not get the parameters properly. But I do not know how to test it, because the function does not work
the error that i got in the client side:
xhr.js:177 GET https://europe-west1-socialife-c468b.cloudfunctions.net/api/realtimeConversations 500

the error that i got in the back side:
eferenceError: user is not defined
    at exports.getRealtimeConversations (/workspace/handlers/chat.js:40:37)
    at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
    at next (/workspace/node_modules/express/lib/router/route.js:137:13)

Comment: Can you add the error message as well?
Comment: Try req.params.user instead of req.query.user
Answer: If you look at the URL generated by postman, you see that there isn't any query string parameter named user, but two parameters uid1 and uid2.
You need to adapt your Cloud Function to get the values of these two parameters.
Comment: Thanks for the help, I tried to change it, I'm currently getting a 404 error inside the postman. It does not run me the function at all, it does not find my request in axios
Comment: please update your question with the adapted code and the new errors corresponding to this new code.


Hide a div using GwtQuery

Question: This is my code to hide a given DIV using GwtQuery:
$("#historySection").hide();

However, it does not hide at all.
This is the actual HTML div:

What's wrong with my code?
Answer: Are you sure that your div is present in the DOM when you run the GQuery code ?
Answer: It looks fine to me. Could you put a breakpoint in your code, just after the hide() method is called? At that point, check the state of the historySection div in the DOM.

Hide a div using GwtQuery


Setting usability tasks for participants to test a website

Question: I recently designed a website and I would like to test its' usability against end users.
I am not sure about how I would set tasks, as I have read online not to give any obvious clues.
One task I would like users to undertake, is to vote on a poll. Now this poll is on my homepage - and simply telling the user to vote on the poll is practically countering against the whole purpose of usability testing. This is how I have defined this task (see below), however I do not know if the task is clear and if I have given away too much information.
The task:
You are entitled to a voice and you are able to express your thoughts and views to some of the questions published on this website. How would you go about answering some of these questions?
Firstly, how can I rephrase and improve the above task? Secondly, what are examples of usability issues?
Would appreciate it if someone could modify my task or give me some general advice.
Answer: Wording for tests depends what you're testing for - If you're trying to find out if they can find where you've put the voting tool and how to use it then it's probably OK to ask them to look at the page and tell you how they would go about voting for 'X'.
If you're trying to find out if you've got the concept of voting right then you're probably going to want to ask them about how they might go about  'expressing an opinion' without referring to the page in your question.
You're right to think about not leading the user too much but you can also go too far the other way to the point where the user may not understand what you're asking them to do. It's good to guerilla test your questions on someone else who is not aware of what you're testing for and find out what they understand from your question before you go and do your proper field work.
Comment: If you want to test both the discovery and usability of the poll, you can have a second follow-up task that says something like "if you didn't notice the poll on the page yet, please find it and...". So in the case the user doesn't naturally discover it, you mark that task as failed, and still get the benefit of them actually using the poll for the remaining tasks.
Answer: First I write down all the tasks I'd like the participant to do.
Then I see if the things I want to test can be turned into a higher level task that touches upon the issues that we want to look at in a way that reflects 'normal' usage patterns. For example we might be interested in looking at whether people:

Can register
Can log in
Can log out
Can find the latest news page
Can post a comment on a page
Can edit their profile.

Might turn into:

Can you post a comment on the latest news page? (requires them to register, find the latest news page, and post a comment.
Can you log out
Can you edit your profile (requires them to login and edit profile).
Answer: If you are using the concept of User Stories, and you have built your functionality to fulfil user stories, your usability testing could follow the same pattern.  (if you are using Cucumber, then your Cucumber tests can also be derived from the user story really easily)
e.g. Example user stories for Amazon.com
User story: As a customer, I want to be able to browse books for sale, in order to decide what to buy
Task for study participant: find a book you want to buy, and add it to your order
User story: As a customer, I want to be able to manage my basket, in order to cancel my purchase
Task for study participant: cancel the purchase of the book that you added to basket in the first task
Your user stories identify the key functionality for your application, and your usability testing should test the key functionality to make sure it works.
The poll on the homepage
Your question seems a bit too obfuscated. What is the purpose / business value of the poll?
In my Facebook group, I have a poll where members can vote on guidelines for social interaction in the group. This means users can see what guidelines are most important to other members, which reinforces the importance of the guideline (i.e. it was not just arbitrarily dreamed up by a moderator, everyone else agrees too).
So, whatever your users are voting on, you could just say something like "vote on the questions about x, y, z" - that should give them enough of a clue without mentioning the word "poll".
Answer: The question I would ask is: why do you need people to answer a poll?
Here are few things I recommend doing before writing your tasks:
1. Define what your goals and objectives for your test. One of the best places to start drawing up what questions to ask is starting with the people who work with your website — your developer, content marketer, manager etc. How much do they know the product ?— features, users, competitors etc. Do they know of any constraints of the product? — development problems.
Once you gain that knowledge, you start asking a set of questions to help focus the team on research questions — "Why do people sign-up but not do x,y,z?" ←this is better than →"We need to do focus groups now!"
2. Ask yourself - What questions need to be answered to achieve my goals/objectives for this test. For example, your goal may be: to identify navigation issues. So the question you will need answering is, do people have problems using our navigation? Do people have problems using search? etc.
There's some really great information about defining your goals here.
When you've created your tasks/questions, you're ready to start testing. I recommend checking out UserTest.io - they're my favourite alternative to UserTesting.
Hope this was of use to you.
Answer: You have designed your web site in order that a visitor may be able to do a things that will give them information (eg the price of an item) or make some actions (eg book a ticket, express an opinion). The key to describing 'user tasks' is to write the task in the users' language, eg: "Book the earliest flight from Washington to Miami on [day] in coach class" or "When is high tide at the Shannon Bridge on [date]?"
If you haven't, then I'm afraid it's time to go back to square one and ask yourself, what do I intend this web site to do or convey?
But assuming you have, you should be able to set half a dozen or so 'user tasks' in this kind a phraseology: that is, starting from the home screen, and leading up to a transaction or getting some information. You might check with airlines involved before you get people making reservations and then not paying for them :)# and in general when faced with situations like that, the task ended with us when the visitor had the 'pay' dialogue pop up. Be warned though, my friend Jared Spool once showed that visitors will be much more thorough and demanding if it's their own money they are actually spending rather than 'play money' or 'stop before you give your card details' scenario. Funny, that.
There are ways of scoring the results: can they do it (well, almost, badly, not), how long does it take them (mind the internet time-lags!), did they thinki it was easy? You might even ask them to evaluate their experience of the website as a whole using some kind of online questionnaire... hmmm... did I mention my little pet duck, wammi.uxp.ie ?


How do I double screw corner posts

Question: I'm building a dog house for our new puppy and got stuck on something.
The plan...
I want to build a frame and put external and internal walls so I can fill with insulation as Winter where we live gets a bit cold. (around 0-2 during the night).
I had some framing timber hang around in the garage so I'm using that for the frame. Some 45x45 posts and treated ply for the walls and floor.
The problem I found is...
I need to put a couple of screws through the posts into the beans but because the posts are corners posts, I will have 4 screws coming in. Kind of like this (below).

The problem i find here is that screws will clash to each other. So I was thinking I could divide the bean in for parts (let's say 1,2,3,4) and in one side I would screw the 1 and 3 and the other side I would screw 2 and 4.
Is there the way to do it or there is a better way?
Thanks in advance
Comment: Even if screws touch they usually pass each other, you could just angle them if you are concerned about that.
Comment: Angling them might be tricky... The framing timber is a 45x70 (I believe) so I don't have a lot of space to play...
Answer: Ed Beal is right. Assuming something like #10 or #12 screws (as opposed to 3/8" lag screws, for example), even if they collide the second will merely glance off the first. It's not an issue.
To avoid the situation altogether, simply offset by 1/4" or so.
Comment: I end up just screwing the second side a tad below. I just wasn't sure if one hits the other, it would bust the wood or something. It's now looking nice and solid. :D
Answer: When you drive the first screws, drive at 1 times your measure and 2 times your measure. Turn the corner and drive at 1 1/2 and 2 1/2 your measure of your measure. (Pick your measure to fit your space). For example if you have a five inch space to fasten, screw first 1 and 3 inches from the bottom, turn the corner and screw 2 and 4 inches from the bottom

How do I double screw corner posts


Does deleting sed pattern space with 'd' erase hold space as well?

Question: Can someone please explain why this is happening?
This is expected:
$ echo -e "foo\nbar" | sed -n 'h; x; p'
foo
bar

I put every line in the hold space, then swap hold space and pattern space, then print the pattern space, so every line is printed. Now, why is the following different?
$ echo -e "foo\nbar" | sed -n 'h; d; x; p'

I thought that wouldn't be, because I delete the pattern space before swapping, so the stored line should be put back to the pattern space anyway. It's the hold space that should be empty after x;, right? I delete the pattern space, then swap. Where does the line I've saved go?
Answer: When you use d, the pattern space is cleared, the next line is read, and processing starts over from the beginning of the script. Thus, you never actually reach the x and p steps, instead just copying to the hold space and deleting.
Answer: I guess it's related to the following line in man sed:

d      Delete pattern space.  Start next cycle.

The following works as expected:
$ echo -e "foo\nbar" | sed -n 'h; s/.*//; g; p'
foo
bar

Sorry for bothering you guys.


How to show field errors and the error message conditionally sent by controller in jquery ajax

Question: I want to show the error message i get from controller in ajax error. So in my ajax error i have:
error: Function(e){
  Errordiv.empty();
  Errordiv.show();
  Errordiv.append(e.responseText);
  $.each(e.responseJSON.fieldErrors, function(i, v) {
    Errordiv.append(v.message);
    Errordiv.append("
");
  });
}

The problem is i get both of them. I don't want this. I want if there is any field error, no other message be displayed and if there is not then the error that controller sends be shown. I put a condition if
if(e.responseJSON.fieldErrors==null){...}

Then show other message and so on but it didn't work. How to solve it?
NOTE: Example message come from controller is "you have voted before!".
Update:
fieldErrors are the validation messages of entity class. If the fields are not valid then the errors will be shown in Errordiv. And if all fields are ok but the user has voted before, the controller will send a message that will be shown by "Errordiv.append(e.responseText)". Now when there is a field error, the erros are shown twice. Once by the foreach loop and once by "Errordiv.append(e.responseText)". But when fields are valid it is ok and the errordiv contains only the message.
Comment: It's not clear what the problem is. What do you mean by 'the problem is I get both of them'. What is 'them'? What is the content of `e.responseJSON.fieldErrors`, and what output are you trying to create from it?
Comment: What does the error object `e` looks like. Please can you update that in the question itself.And what do you mean by **The problem is i get both of them**
Comment: I have edited the question
Comment: try to check if (e.responseJSON) before using it, otherwise use e.responseText. This https://stackoverflow.com/questions/3741574/jquery-how-to-check-response-type-for-ajax-call could help
Answer: I solved it by changing the code to this:
Errordiv.empty();
Errordiv.show();
Errordiv.append(e.responseText);
If(e.responseJSON.fieldErrors.length>0){
Errordiv.empty();
$.each(e.responseJSON.fieldErrors, function(i, v) {
Errordiv.append(v.message);
Errordiv.append("
");
});
}
}
});
});


Glassfish webservice high concurrency

Question: When I send about 100 users to my web service, I get response and web service performs fine, but when I check for 1000 concurrent users none of the requests get reply.
I am using jmeter for testing.
When I send 1000 concurrent users my glassfish admin panel goes time out in browser and it opens after 4-5 minutes only.Same happen for wsdl URL.
I have tested my web service on our LAN and it works for 2000 queries without any issues.
Please help me find a solution.
Edit 1.0
Some more findings
Hi on your recommendation, what I did is that I simply returned string on web service function call, no lookup, no dao, nothing... just returning a string
Thread pool is 2000 no issues on that.
Now when I ran jmeter for 1000 users they run much fast and returned response for ~200 requests
So this means that my PC running Windows 7 with an i5 processor and 4GB RAM is out performing dedicated server of hostgator having 4GB RAM with xeon 5*** 8 cores :(
This is not for what am paying 220$ a month....
Correct me if my finding is wrong, I tested my app on lan b/w two pc's locally and it can process 2000+msgs smoothly
Edit 1.1
After lot of reading,and practicals I have come to a conclusion that it is network latency which is responsible for such a behavior.
I increased bean pool size in glassfish's admin panel and it helped improving number of concurrent users to 300, but issue arise again no matter how much beans I keep in pool.
So friends question is: please suggest some other settings which I can change in Glassfish's admin panel to remove this issue from root!
Comment: Q: Have you checked the OS error logs when this occurs?  What *is* the server OS, anyway?  Q: What about the database logs?  What's the database?  Do you see a spike in locks/deadlocks?  Etc etc - you definitely need to do some more homework to determine where the bottleneck is occurring.
Comment: Please check Edit 1.1,OS has no issue,because php site is also hosted on same box with fairly high concurrency tested for it.
Answer: You need to add some performance logging for the various steps that your service performs. Does it do multiple steps? Is computation slow? Database access slow? Your connection pool not scale well? Do things need to be tweaked in the web server to allow for such high concurrency? You'll need to measure these things to find the bottlenecks so you can eliminate them.
Comment: Hi on your recomendation, what i did is that i simply returned string on webservice function call,no lookup,no dao,nothing...just lame return String

Thread pool is 2000 no issues on that.

Now when i ran jmeter for 1000 users they run much fast and returned response for ~200 requests

so this means that my PC running windows 7 having i5 4GB RAM is out performing dedicated server of hostgator having 4GB RAM with xeon 5*** 8 cores :(
this is not for what am paying 220$ a month....
Correct me if my finding is wrong,i test my app on lan b/w two pc's locally and it can process 2000+msgs smoothly
Comment: Are you trying to compare the performance of running on a lan v.s. over the internet?
Answer: I had the same problem in a server (with 200+ simultaneously users), I studied the official glassfish tuning guide but there is a parameter very important that doesn't appear. I used Jmeter too and in my case the time response increases exponentially but the server's processor stay low.
In the glassfish admin server (configurations/server-config/Network config/thread pools/http-thread-pool) you can see how many users you server can handle. (The parameters are different in glassfish 2 and 3).

Max Queue Size: The maximum number of threads in the queue. A value of –1 indicates that there is no limit to the queue size.
Max Thread Pool Size: The maximum number of threads in the thread pool
Min Thread Pool Size: The minimum number of threads in the thread pool
Idle Thread Timeout: The maximum amount of time that a thread can remain idle in the pool. After this time expires, the thread is removed from the pool.

I recommend you to set Max Thread Pool Size to 100 or 200 to fix the problem.
Also you can set another JMV variables, for example:

-Xmx/s/m
-server
-XX:ParallelGCThreads
-XX:+AggressiveOpts

I hope it helps.
Comment: Hi javier i went ahead and did jvm tunning....but unfortunately i cant exceed more than 100 concurrent users....if i exceed users i get cant open socket exception for all queries in Jmeter

Glassfish webservice high concurrency


Python transform and convert yml to json

Question: I am trying to create a online liner (or two) for converting YAML file to Json and perform a simple transformation.
Here is the code:
<code>#!/usr/bin/python
import yaml,json

yml="""
- AppName: Wiki-server
- InstanceType: m4.large
"""

#                 Version 1:
y = yaml.load(yml)
o=[]
for i in y:
  d={}
  d['ParameterKey']=i.keys()[0]
  d['ParameterValue']=i.values()[0]
  o.append(d)
print json.dumps(o, indent=2)
</code>
I got the result i needed:
<code>[
  {
    "ParameterValue": "Wiki-server",
    "ParameterKey": "AppName"
  },
  {
    "ParameterValue": "m4.large",
    "ParameterKey": "InstanceType"
  }
]
</code>
I attempted to shrink the code and got the same results.
<code>#                 Version 2:
p=("ParameterKey","ParameterValue")
o=[dict([zip(p,d.items().pop()) for d in [s] ].pop()) for s in y]
print json.dumps(o, indent=2)

#                 Version 3:
(pk,pv)=("ParameterKey","ParameterValue")
o=[b for r in [ map(lambda (k,v): {pk:k,pv:v}, s.iteritems()) for s in y ] for b in r]
print json.dumps(o, indent=2)
</code>
Is there a pythonic way to do this ?
Answer: I don't think that golfing always leads to pythonic code, but here's the best I can come up with. I think that it's fairly clear what's going on while also being concise. Not a huge fan of the magic numbers in there though.
<code>#!/usr/bin/python
import yaml,json

yml="""
- AppName: Wiki-server
- InstanceType: m4.large
"""

y = yaml.load(yml)
d = [i.items()[0] for i in y]
d = [{'parameterKey': k_v[0], 'parameterValue': k_v[1]} for k_v in d]
print(json.dumps(d, indent=2))
</code>


What are these bugs on my kitchen ceiling?

Question: I hope someone can help me identify this bug. They are black, really small and have wings.
They are not love bugs, but they are fond of attaching to one another the way love bugs do, and they keep multiplying and coming back no matter how many times you kill them. They limit where they stay to my kitchen,  specifically on the ceiling.
Please help me identity this bug and also give suggestions on how to get rid of them.
The strange insects are on the floor

Those are some of the dead insects on the floor
Answer: "Bugs" means crawly things, which can include insects, arachnids, millipedes, etc. Insects have 6 legs. Most insects have 2 pairs of wings (= 4 in total), some are wingless, and some have only 1 pair (= 2 wings). The insects with 2 wings are the Diptera, which includes the mosquitoes and flies. I can't tell which type of insect you have from the pictures, but they look like some kind of fly.
You want to control them, but despite what the pest control guy might tell you, there is no "fly poison" and a "beetle poison", etc., but just pesticides that will kill all sorts of insects. So you don't have to identify the type of insect in order to apply an insecticide. Whatever insecticide you find at the garden store will work.
If they keep reappearing, it means that they are either finding a way into your house, or that somewhere females laid eggs some time ago (depends on the species, 1-3 weeks ago), and now the adults are coming out in waves. You can apply all of the insecticide in the world, but until you find how they are getting into the house and/or where the eggs were laid, the problem won't go away.
Do a deep cleaning of the kitchen, and make sure the garbage containers are closed with a tight lid. Then make sure that there are no points of entry into the house.
Comment: Even better, take out the trash and give the garbage can a good scrubbing. (No implication that the garbage is over full and spilling everywhere, only that the eggs could be in the current bag of garbage or that something may have spilled out of a bag and into the can.)
Comment: Can't tell from photo, but the most common suspect would be fruit flies. If so, then yes, eliminating access to food for their larvae would be the single biggest step to eliminating the infestation. Keep sink clean, keep trash (and compost bucket if you use one) sealed and empty them regularly. If you're sufficient annoyed, hunting them with a vacuum cleaner hose may help cut the population and lets you vent your frustrations


How to Restructure R Data Frame in R

Question: I have data in this format:
   boss employee1 employee2
1   wil     james      andy
2 james      dean      bert
3 billy      herb    collin
4  tony      mike     david

and I would like it in this format:
   boss employee
1   wil    james
2   wil     andy
3 james     dean
4 james     bert
5 billy     herb
6 billy   collin
7  tony     mike
8  tony    david

I have searched the forums, but I have not yet found anything that helps.  I have tried using dplyr and some others, but I am still pretty new to R.
If this question has been answered and you could give me a link that would be greatly appreciated.
Thanks,
Wil
Comment: I will say that after reviewing the link that you posted, the answer provided by Scarabee and Nick Criswell are much clearer than the linked answers.  As a relatively new person to R, the linked post is dense and has a lot of code, while the answers provided here are much clearer and they are also concise.
Comment: Hey SO moderators, can we get a perma-duplicate-flag for wide to long reshaping? This comes up **all the time**
Comment: Two base R alternatives: using `reshape` along the lines of tyler-rink's answer in the linked post: `reshape(df, direction="long", idvar="boss", varying=2:3, sep="")[-2]`. Then brute force style with `stack` and `cbind` is `cbind(boss=df[1], employees=stack(df[-1])$values)`. This returns a warning, but works out OK.
Comment: @Tucktuckgoose I do understand and appreciate your comment; and I did not find the duplicate I had hoped to--which is more clearly explained. **But:** one of the policies of usage of this community is to first search for your answer and not simply post a duplicate question. New questions should add something to knowledge base not simply complicate the process of finding good answers... **That is, the ideal state is a single, easily findable, high quality answer. It is not numerous lower quality, hard to find, answers.** Good luck as you continue learning R.
Answer: Here is a solution that uses tidyr. Specifically, the gather function is used to combine the two employee columns. This also generates a column bsaed on the column headers (employee1 and employee2) which is called key. We remove that with select from dplyr.
library(tidyr)
library(dplyr)

df <- read.table(
      text = "boss employee1 employee2
      1   wil     james      andy
      2 james      dean      bert
      3 billy      herb    collin
      4  tony      mike     david",
      header = TRUE,
      stringsAsFactors = FALSE
    )

    df2 <- df %>%
      gather(key, employee, -boss) %>%
      select(-key)

> df2
   boss employee
1   wil    james
2 james     dean
3 billy     herb
4  tony     mike
5   wil     andy
6 james     bert
7 billy   collin
8  tony    david

I would be shocked if there isn't a slicker, base solution but this should work for you.
Answer: Using base R:
df1 <- df[, 1:2]
df2 <- df[, c(1, 3)]
names(df1)[2] <- names(df2)[2] <- "employee"
rbind(df1, df2)
#     boss employee
# 1    wil    james
# 2  james     dean
# 3  billy     herb
# 4   tony     mike
# 11   wil     andy
# 21 james     bert
# 31 billy   collin
# 41  tony    david

Using dplyr:
df %>%
  select(boss, employee1) %>%
  rename(employee = employee1) %>%
  bind_rows(df %>%
              select(boss, employee2) %>%
              rename(employee = employee2))
#    boss employee
# 1   wil    james
# 2 james     dean
# 3 billy     herb
# 4  tony     mike
# 5   wil     andy
# 6 james     bert
# 7 billy   collin
# 8  tony    david

Data:
df <- read.table(text = "
   boss employee1 employee2
1   wil     james      andy
2 james      dean      bert
3 billy      herb    collin
4  tony      mike     david
                 ", header = TRUE, stringsAsFactors = FALSE)

How to Restructure R Data Frame in R


libcurl C++: get cookies with multi interface

Question: I want to get the cookies from a POST request.
curl_global_init(CURL_GLOBAL_DEFAULT);
http_handle = curl_easy_init();
curl_easy_setopt(http_handle, CURLOPT_URL, url);
curl_easy_setopt(http_handle, CURLOPT_COOKIEFILE, "");

curl_easy_perform(http_handle);
curl_easy_getinfo(http_handle, CURLINFO_COOKIELIST, &cookies);

In the case above, cookies are retrieved OK.
I'm trying a similar approach with multi interface. I change the latest two lines above for the following code:
int still_running = 1;
multi_handle = curl_multi_init();
curl_multi_add_handle(multi_handle, http_handle);
do {
    curl_multi_perform(multi_handle, &still_running);
} while (still_running)
struct CURLMsg *msg;
int queued;
do {
    msg = curl_multi_info_read(multi_handle, &queued);
    if ((msg) && (msg->msg == CURLMSG_DONE)) {
        CURL *e = msg->easy_handle;
        CURLcode res = curl_easy_getinfo(e, CURLINFO_COOKIELIST, &cookies);
        // res is OK, but cookies are empty
        long status;
        CURLcode res2 = curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &status);
        // res2 is OK, and status gets the status code
    }
} while(msg)

In the code above, I can get for example the response code, but the cookies are empty.
Maybe the multi_info_read does not work to get the cookies? Or could I be missing something?
Answer: Please post an minimal reproducible example. The code in the question has a lot of errors and could not be compiled.
My code works well.
#include <iostream>
#include <curl/curl.h>

int main () {
    CURL* http_handle = curl_easy_init();
    curl_easy_setopt(http_handle, CURLOPT_URL, "http://httpbin.org/cookies/set?key=value");
    curl_easy_setopt(http_handle, CURLOPT_COOKIEFILE, "");

    int still_running = 1;
    CURLM* multi_handle = curl_multi_init();
    curl_multi_add_handle(multi_handle, http_handle);
    do {
        curl_multi_perform(multi_handle, &still_running);
    } while (still_running);
    struct CURLMsg* msg;
    int queued;
    do {
        msg = curl_multi_info_read(multi_handle, &queued);
        if ((msg) && (msg->msg == CURLMSG_DONE)) {
            CURL* e = msg->easy_handle;
            curl_slist* cookies;
            CURLcode res = curl_easy_getinfo(e, CURLINFO_COOKIELIST, &cookies);
            std::cout << "\nSet-Cookie: " << cookies->data << std::endl;
        }
    } while (msg);
    curl_multi_remove_handle(multi_handle, http_handle);
    curl_multi_cleanup(multi_handle);
    curl_easy_cleanup(http_handle);
    return 0;
}

Output:
% ./a.out
...
Set-Cookie: httpbin.org FALSE   /   FALSE   0   key value


What to do with excess gold/elixir in the early game?

Question: I started playing only a few days ago and still have about a day's worth of the newbie shield. I concentrated on upgrading my income while only upgrading my town hall if I absolutely had to. Since I'm not spending any money for gems, I currently have two builders.
I'm finding, now, that I'm generating more resources than I can hold and have lost some resources from a collector being full a time or two. Since my 2 builders are constantly upgrading something, it's difficult to sink excess resources into something productive (especially gold).
Since I'm at a level 3 town hall, the laboratory was a huge help for sinking excess elixir. What are the other constructive, builder-less things I could do with excess elixir/gold while preserving my shield?
Note: I'm open to changing tactics if I can more effectively manage the resources I'm generating.
Answer: If you have excess gold, you must not be upgrading your walls. Walls are very important throughout the game and it takes a while to finish walls, seeing as level 11 walls cost a cool 4 million. Focus on your defenses and resource buildings first, and then dump the remaining resources into walls. That way, you should never have any excess resources (unless, of course, you are waiting for your town hall to finish).
Comment: @Ellesedil yes, walls do require a builder. Although, they take no time to construct or to upgrade.
Comment: Do walls require a builder to upgrade? I have only 50 wall segments available (none built), and I haven't settled on a village design yet.
Answer: Walls are certainly a way to burn excess gold - as you get to 3 and 4 builders, it can be a good idea to leave one builder idle all the time to upgrade walls whenever you have spare resources from raiding sessions.  Later, walls will also be upgradeable using elixir, but for your early-game question it's specifically gold.
It's also a good idea to use excess elixir to clear objects from your land - clearing logs, bushes, etc, has a chance to give you gems, and it's one of the rare ways you get free gems in the game.  If too many objects accumulate, they'll stop spawning which means you're missing chances at gems.
Also, you can use excess elixir to raid in the single player campaign.  Getting certain tiers of stars in the campaign grants you additional gems from achievements.
Finally, in the early game, don't worry too much about wasting a bit of gold or elixir.  As you progress a couple of thousand gold will be completely meaningless.  If you have enough resources to keep your builders busy, that's 90% of what progression in the game is about.
Comment: I like this answer a lot, as I've recently started clearing obstacles since looking into what they are. That was actually triggered by a gem box spawning, and I had to look up what to do with it.
Comment: @Ellesedil, indeed, the Gem Box is quite a find - that was added recently, and is one of very few ways to get guaranteed free gems in the game.


Unrecognised database format E:\filename.accdb not found in MSACCESS 2007

Question: I had created one database with 6 tables and 6 forms. After creating the 6 forms and 6 tables , the access database filename.accdb is opening in only one system. If am sharing with another systems, the database is showing an error which is "Unrecognised database format E:\filename.accdb". . Please let my issue be resolved. After trying so many trials am posting my question here so that m problem regarding the database opening in another systems is resolved.I had tried compact and repair database, changing the filename and storing in another drive. Even though it is not opening in another any single system too.In all the systems its showing the same error except my system.
Comment: Can any one help me out how to change created databased from  microsoft access version 2010 to microsoft access version 2007
Answer: Atlast i had found a solution to it. The database created version is Microsoft Access 2010. But when i dump database in to Microsoft Access 2007, its web compatibility is missing i hope. That's why i am getting an error always when am trying in 2007 version.
Comment: Yes exactly. Web compatibility is missing. Then i had made the changes like changing the version from 2010 msaccess.accdb to msaccess.mdb. But Calculation wizard is not working when i changed the version.


On the dimension of rationals over real numbers

Question: The following two are from Introductory Functional Analysis by E Kreyszig:

2.5-2 Lemma . A [sequentially] compact subset M of a metric space
  is closed and bounded.
The converse of this lemma is in general false.
However, for a finite dimensional normed space we have :
2.5-3 Theorem. In a finite dimensional normed space
  X, any subset $M \subset X$ is [sequentially] compact if and only if M is closed and bounded.

On the other hand, here it shows that $\mathbb{Q}\cap[0,2]$ is not sequentially compact thus must be infinite dimensional (over $\Bbb R$ or $\Bbb C$) but any element of $\mathbb{Q}\cap[0,2]$ can be written as a multiple of some element in $\Bbb R$ (or $\Bbb C$) times 1 so dimension of $\mathbb{Q}\cap[0,2]$ over $\Bbb R$ (or $\Bbb C$) is 1 not infinite! Contradiction?
Answer: Since $\mathbb Q\cap[0,2]$ is not a normed space, there is no contradiction.
On the other hand, $\mathbb R$ is a $1$-dimensional normed space and, indeed, $\mathbb Q\cap[0,2]$ is a subset of $\mathbb R$ whichnot closed and not compact. So, again, there is no contradiction.
Comment: Because it is not a vector space.
Comment: I meant $\mathbb Q\cap[0,2]$ is closed in itself... And why is $\mathbb Q\cap[0,2]$ is not a normed space?


Why is it that aa full deployment will require a minimum of 10 servers?

Question: I wish to try MaaS, and there's only two machine, could I install one with MaaS service, and use MaaS and juju to deploy the other bare machine with openstack nova-compute?
Thank you so much for answering.
Answer: The reason for this is that OpenStack is not really meant for a 2 node cluster. It is meant to scale to thousands of nodes. It has many disconnected components, including mysql, rabbitmq, several API services, etc. For your case of "just trying openstack out" you can simply use the local provider to install everything on one box rather than MaaS which wants to put every component of OpenStack on its own machine (and there are about 9 components, plus 1 for juju/maas).
Have a look at this page to help configure the local provider:
https://jujucharms.com/docs/stable/clouds-LXD
And then follow these instructions:
https://help.ubuntu.com/community/UbuntuCloudInfrastructure
Except instead of setting up MaaS, and generating/downloading the environments.yaml from MaaS, you just put this in:
<code>default: local
environments:
  local:
    type: local
    default-series: precise
    data-dir: /home/youruser/.juju/data
</code>
All of the services will end up in their own containers on the same box, which will have some limitations (like nova volumes not working right).
Answer:
Beside that can you please explain what exactly MAAS gonna install on each server?

You can use community contributed charms where each service like MySQL or RabbitMQ requires dedicated node or write yours where you can combine them.

Does it has some RAID kind of mechanism inside?

You can utilize RAID when deploying node into MaaS.

If one or two servers go down and it may handle everything?

MaaS doesn't provide built in reservation or High Availability for deployed services. If you are talking about OpenStack, the answer is yes: nova-compute can relaunch instances from failed nodes. Best practices for Swift requires 3 copy of your data, so 2 failed nodes is not a problem.

My final question is it says somewhere on Ubuntu docs that each server should
  have at-least 16GB RAM ? Is it Must or optional ?

No, this is not required. Probably, you've mentioned this statement from Mark's blog: "Add another node to the Hadoop cluster, and make sure it has at least 16GB RAM".


Shopify App Url Update Issue For Development

Question: I am trying to develop an app by using webhooks. I configured my app and started to develop. For first 30 mins, everything was fine but then my webhook started to not working. When I check app insights, it seems it is sending webhook request to another URL;
It is webhook request;
App Url Update Issue For Development

It is actually configured URL;

It happened 3-4 times for me while developing and there is no fix. Just it is fixing automatically after 2-3 hours, and it is really disturbing and frustrating. Looking for a solution.
Comment: are you using ngrok?
Answer: It is definetely a bug on Shopify side. I solved it by using cloudflared. It is stabile and there are no issue anymore.


Can I bond gas plumbing via gas water heater's electrical connection ground?

Question: Locale: WA State, U.S.
Inspector approved gas plumbing and followed up later, saying:
"Please note that we will be verifying the bonding of the new gas piping at the next inspection, please contact L&I for any questions regarding electrical. "
Gas plumbing will be connected to tankless water heater via flex hose. I'm assuming the flex hose doesn't count as proper bonding for the gas plumbing. So can I run a ground wire from the electrical outlet where the gas water heater will be plugged in or even bond to the water heater directly (since it is grounded via outlet plug)?
Comment: What type of "flex" is used for the gas connection in question? Are you talking about CSST, or an appliance connector?
Answer: The water heater's equipment grounding conductor takes care of its side.
Check the installation manual (example) for your CSST (Corrugated Stainless Steel Tubing; the bright yellow, flexible gas pipe.)  You should be bonding the gas piping at your service entrance to the home's grounding system.  That's what the inspector is referencing.
Some additional information: http://csstsafety.com/CSST-solution.html
Comment: Corrugated stainless steel tubing is the full name for most flex gas tubing but not all. On the gas water heaters I have installed a grounding clamp was required on the csst at the water heater, silly since the frame is bonded but it has to be continuous to count.
Comment: For those not in the know, what is "CSST"? I don't see any explanation in your answer or in the OP's question.
Comment: Good suggestion, @FreeMan.  I edited my answer to clarify CSST is the flex gas tubing.
Comment: Also, thanks for the manual link. On [page 13](http://homeflex.com/downloads/HOME-FLEX_Installation_Manual.pdf#page=13) - section 2.7, it looks like bonding is needed for the CSST flex connector (connecting branch plumbing to appliance plumbing), in addition to the main gas plumbing (which is galvanized).
Comment: Excellent, thank you!
Comment: It appears we have a couple other grounding conductors doing this already (I believe a Comcast installer also ran one around the exterior of the house (just below the soffits). I'll have to confirm, but it seems like this would be attaching to the "Grounding Electrode System" rather than the "Equipment Safety Ground". If so, can I simply connect to this grounding conductor (since it leads to the same grounding)?
Answer: Grounding and bonding is a whole chapter in NEC.  They're not all just the same thing.
Not least, every house has 2 different networks:

The Equipment Safety Ground which carries grounds from the service panel to all the appliances and outlets. This travels alongside the live conductors, as the green, yellow-green or bare wire in cables or conduits (or in the case of EMT, IMC or RMC, the conduit shell itself).
The Grounding Electrode System, which is the bond between the service panel and the actual earth: It is the heavy bare copper wire going from the service panel to ground rods, Ufer ground, or water main.   (water main grounds are getting dicey because of smart meters).

The gas main should be bonded to the house's Grounding Electrode System.
It definitely should not be connected to any part of the Equipment Safety Ground network that serves subpanels and appliances.
Comment: Perfect. This separation of the two systems by the service panel is exactly what I was wondering about. Thanks for directly addressing that!
Comment: One additional thing: what does the inspection for this entail? I'll check NEC, but I've read they just need to test and make sure resistance is low enough. I want to make sure I'm prepped and ready to go for the inspector with what he needs to see.
Comment: @JakeHassings generally 1 ground rod needs to be tested, but two rods are presumed good enough. Many people just set 2, since it is cheaper than the test.


How do I insert a tab character into a Word document with Word Interop?

Question: The question says it all.  I am attempting to insert a tab character into my Word document which is generated with Word interop.  The usual \t does not work.
I literally just want to insert some text (tab) text (tab) text; so I am not talking about tab indents at the beginning of a line, but within text itself.
Thanks
Comment: I'm not affiliated in any way, but I've had better luck with the Spire.Doc Nuget package (there's a free version) than I ever had with Word Interop. You might want to look into that, if your question goes unsolved. I'm not sure if it'll do it or not, but I think it should be able to.
Comment: Thanks for this.  I'm having a look; looks good so far.
Comment: Yep. I think there are a few things that the free version *doesn't* do, and it's been a little while since I did anything with it, but I know I never encountered a need for any of them, at least with what I was doing.
Answer: Have you tried this:
wordApp.oWord.ActiveWindow.Selection.TypeText("Your custom text");
WordApp.oWord.ActiveWindow.Selection.TypeText("\t");
wordApp.oWord.ActiveWindow.Selection.TypeText("Your next custom text");
WordApp.oWord.ActiveWindow.Selection.TypeText("\t");

or if you just want to go to the end of the document:
object missing = Missing.Value;
object what = Word.WdGoToItem.wdGoToLine;
object which = Word.WdGoToDirection.wdGoToLast;
doc.GoTo(ref what, ref which, ref missing, ref missing);

credits to Alexander Kojevnikov
Comment: This might work, but how do I get the selection to become the very end of the document?


Read CSV file to MySQL with a Datetime column Pandas

Question: I have a csv file with numbers(doubles), strings and datetime. This is how the timestamp in the csv is 15-MAR-20 12.00.13.031000 AM. I have a table in MySQL Database with following column. RowNumber(int), Timestamp(datetime), Amount(double), Transaction_Type(varchar). The table corresponds to the columns in the csv file. The csv file does not have headers or columns headers.
This is a sample of the csv
1     15-MAR-20 12.00.13.031000 AM   23.123    TQWEE
2      17-FEB-20 13.00.13.031000 AM   23.123    QWEFE
Now my question is

How do i read the time and convert it to datetime before writing it to the database.
How do I read the data in the csv file (mycsvfile.csv) and fil1 the table on MySQL whiles keeping datatype.

This is what i have done so far
data['Timestamp']=pd.to_datetime(data['Timestamp'], format='%d-%b-%y %I.%M.%S.%f %p')
And here was the error i got
ValueError: time data '1' does not match format '%d-%b-%y %I.%M.%S.%f %p' (match)
Comment: It seems to me that your code should work. Is there something else going on here? Maybe extra spaces in your columns or something?
Comment: That is my confusion too. i just cant figure out why it is not working
Comment: What you have provided is not a `CSV` file however. Maybe if you provide the actual `csv` text, someone can figure out what's wrong. As things stand, you have not provided enough for someone to understand the problem.
Answer: pd.to_datetime(df['Column name'])

Comment: I have already tried that. I have updated the question please
Comment: No. Here is my Error
`ValueError: time data '1' does not match format '%d-%b-%y %I.%M.%S.%f %p' (match)`


what kind of transition strip do I need to use to transition from 1/8" vinyl tile in dining room to low pile carpet in adjoining living room?

Question: what kind of transition strip do I need to join 1/8" vinyl tile in dining area to low pile carpet in adjoining living room area?
Comment: Is everything down already? Or are you pre-planning?
Answer: You may not even need a transition if they are both laid down well. Otherwise, you could use whatever you want. I'm thinking a thin metal or wood one would look decent.


Executable program files

Question: I have booted Ubuntu 16.04.1 Desktop from a DVD and am attempting to run a wallet program, specifically for Linux, that I downloaded from a website. I'm intimately familiar with the program as it runs on Windows and OSX. For Windows, the program is a simple .exe file (nexxuscoin-qt.exe) that is typically placed on the Desktop and run from there. For OSX, it is a simple .dmg file (nexxuscoin-qt.dmg) that is typically placed in the Applications folder and run from there.
For Linux it is a file without an extension, however the system identifies it as an executable file. It will not run. I'm completely new to Linux. I know there are other Linux users of this particular wallet program because they show up on the blockchain explorer. Must I fully install Ubuntu in order for a program to run or is there something else I'm missing? I have tried checking the box "allow executing file as program" but it makes no difference. The actual filename is: nexxuscoin-qt and as it's downloaded it's compressed. So, I unzipped it with Archive Manager. No matter what I try, it won't run.
I see mention of certain commands as well as references to libraries but I have no idea what they mean. As I said, I'm completely new to Linux. I obtained a space computer to install Ubuntu on with the provision that I backup certain document files before repartitioning the hard drive, which currently contains Windows XP. This will NOT be a dual-boot system. It will be 100% Ubuntu and yes, I have verified that I am attempting to run the correct program. I can determine which operating system it is compiled for by the version number.
$ file nexxuscoin-qt
nexxuscoin-qt: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=236481a719334b8d222179b17fce5e222f668c98, not stripped

$ ldd nexxuscoin-qt
linux-vdso.so.1 => (0x00007ffc4cda7000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f84ee1ef000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f84edd93000)
libdb_cxx-4.8.so => not found
libboost_system.so.1.54.0 => not found
libboost_filesystem.so.1.54.0 => not found
libboost_program_options.so.1.54.0 => not found
libboost_thread.so.1.54.0 => not found
libQt5Widgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007f84ed704000)
libQt5Network.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Network.so.5 (0x00007f84ed5aa000)
libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007f84ed062000)
libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f84ecb8b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f84ec96e000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f84ec5ec000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f84ec2e2000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f84ec0cc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f84ebd03000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f84ebafe000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f84eb8ab000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f84eb59a000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f84eb25f000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f84eb045000)
libproxy.so.1 => /usr/lib/x86_64-linux-gnu/libproxy.so.1 (0x00007f84eae24000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f84eabfe000)
libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f84ea9a0000)
libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f84ea72f000)
libicui18n.so.55 => /usr/lib/x86_64-linux-gnu/libicui18n.so.55 (0x00007f84ea2cc000)
libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007f84e9f38000)
libpcre16.so.3 => /usr/lib/x86_64-linux-gnu/libpcre16.so.3 (0x00007f84e9cd2000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f84e9ac9000) /lib64/ld-linux-x86-64.so.2 (0x00005610d73c6000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f84e98c1000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f84e9650000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f84e942e000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f84e9183000)
libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f84e8f5e000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f84e8d35000)
libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f84e8b32000)
libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f84e892e000)
libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f84e8727000)
libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f84e8524000)
libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f84e82f5000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f84e80e3000)
libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f84e7ee0000)
libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f84e7cd9000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f84e7ad7000)
libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f84e78be000)
libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f84e76b8000)
libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f84e74b2000)
libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f84e72a3000)
libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007f84e57eb000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f84e55e7000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f84e53e0000)

The program I am attempting to run is NOT a Windows .exe file. However, I figured it couldn't hurt to install wine and to try running the program in wine. Or an alternative might be to install wine [sudo apt-get install wine] and try to run the Windows version of this wallet program in wine. However, when I tried to install wine the installation froze after displaying what appears to be a Microsoft truetype font software agreement and the "OK" that appears at the bottom is not clickable and there is no obvious way to continue or complete the installation. I would really prefer to run the Linux version of this program if possible.
Comment: eh. PLEASE don't dump a load of logs in small chunks in comments, ever. Its unreadable, impolite (cause it pings the users who have chatted) and isn't the way we do things. *And* its literally more work than editing the original post, so there's no good reason to do so.
Comment: libproxy.so.1 => /usr/lib/x86_64-linux-gnu/libproxy.so.1 (0x00007f84eae24000)
 libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f84eabfe000)
 libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f84ea9a0000)
 libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f84ea72f000)
 libicui18n.so.55 => /usr/lib/x86_64-linux-gnu/libicui18n.so.55 (0x00007f84ea2cc000)
 libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007f84e9f38000)
 libpcre16.so.3 => /usr/lib/x86_64-linux-gnu/libpcre16.so.3 (0x00007f84e9cd2000)
Comment: librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f84e9ac9000)
 /lib64/ld-linux-x86-64.so.2 (0x00005610d73c6000)
 libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f84e98c1000)
 libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f84e9650000)
 libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f84e942e000)
 libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f84e9183000)
 libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f84e8f5e000)
Comment: libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f84e8d35000)
 libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f84e8b32000)
 libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f84e892e000)
 libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f84e8727000)
 libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f84e8524000)
 libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f84e82f5000)
 libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f84e80e3000)
Comment: libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f84e7ee0000)
 libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f84e7cd9000)
 libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f84e7ad7000)
 libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f84e78be000)
 libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f84e76b8000)
Comment: libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f84e74b2000)
 libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f84e72a3000)
 libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007f84e57eb000)
 libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f84e55e7000)
 libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f84e53e0000)
Comment: will edit the post in the future. thanks @muru
Comment: _"For OSX, it is a simple .dmg file (nexxuscoin-qt.dmg) that is typically placed in the Applications folder and run from there."_ Just for the record: This is simply not true. https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html
Comment: Possible duplicate of [Executable on Ubuntu 14.04](http://askubuntu.com/questions/455347/executable-on-ubuntu-14-04)
Answer: Compiled executables usually don't have a file extension, scripts usually have the file extensions .sh but Linux systems don't care much about file extensions, or at least less than Windows and OS X.
Open a terminal where the file is. You can do this by right-clicking and choosing Open in Terminal.
Then type this:
./nex

, then press Tab to autocomplete and press Enter.
This will only work if you checked the "Allow executing file as program" box in advance (or made the file executable by other means like running chmod +x yourfilename).
If the program needs to be run with root privileges, use
sudo ./nex

and autocomplete.
This should not require the system to be installed.
From the output of file nexxuscoin-qt you have posted by now, it can be taken that you downloaded a binary for a x86-64 architecture, meaning it requires a 64-bit capable x84 CPU running a x86 64 bit operating system (commonly abbreviated to "64 bit OS" or something alike) in order to be executed.
You can easily test this by running
uname -a

whose output should end in x86_64 x86_64 x86_64 GNU/Linux. If it doesn't, you're not running an x86 64 bit GNU Linux. If there is a i386 in there, it means that you're running an x86 32 bit OS.

Executable program files


replace cell values greater than 0 with column name

Question: I have a dataframe with the following structure:
Df = data.frame(
  Col1 = c(1,0,0),
  Col2 = c(0,2,1),
  Col3 = c(0,0,0)
)

What I'm trying to get is a dataframe where those cells with a value greater than 0 get replaced with the column name and those lower than 1 get replaced by NA. The resulting dataframe would be something like this:
Df = data.frame(
      Col1 = c("Col1",NA,NA),
      Col2 = c(NA,"Col2","Col2"),
      Col3 = c(NA,NA,NA)
    )

So far I tried with this solution and with functions like apply(), mutate_if(), and across() but I can't get what I'm after.
Answer: You could do:
Df %>%
 mutate(across(everything(), ~ if_else(. > 0, cur_column(), NA_character_)))

  Col1 Col2 Col3
1 Col1 <NA> <NA>
2 <NA> Col2 <NA>
3 <NA> Col2 <NA>