text:
Q: Switch to `\displaystyle` in superscripts (automatic `\limits`) I have to use a lot of sums in exponential functions like

I would like to have the summation indices of sums to be displayed below the sums for increased readability. I know that I can achieve this for a single sum by placing \limits. Is there also a global solution for all math environments (of course beside inline math)?

Examples why I prefer to use an exponent instead the exponential function.
This:

uses less horizontal space than this:

But is in my opinion just as readable. The second case however will force me to put additional line-breaks or define further abbreviations.

A: Only changing the limits for \sum:
You could use the internal conditional \if@display from amsmath to test whether or not \limits should be inserted.
Below, I'm redefining \sum by adding \if@display\limits\fi to its definition.
\documentclass{article}

\usepackage{amsmath}

\makeatletter %% <- make @ usable in command names
  \renewcommand*\sum{\DOTSB\sum@\if@display\limits\fi}
\makeatother  %% <- revert @

\begin{document}

Lorem $e^{\sum_{n=1}^\infty \frac1n}$ ipsum

\[
    e^{\sum_{n=1}^\infty \frac1n}
\]

\begin{align}
    e^{\sum_{n=1}^\infty \frac1n}&
    \\
    &e^{\sum_{n=1}^\infty \frac1n}
\end{align}

Lorem $e^{\sum_{n=1}^\infty \frac1n}$ ipsum

\end{document}

This can be adapted to work for other operators like \prod, \coprod, \bigcup, \bigotimes, etc. by changing \sum@ in the obvious way.
If you have an operator, say \myoperator, for which \myoperator@ does not exist, you can create it with
\makeatletter %% <- remove if you paste the next line between \makeatletter/-other
  \let\myoperator@\myoperator
\makeatother  %% <- remove this one too, then

and proceed as above.
Alternative:
I originally had another solution that I was quite happy with that uses \everydisplay.
The contents of this register is inserted at the start of every display math environment and I used it to redefine \sum by including \limits.
It works without amsmath (which everyone should use), but apart from that I think it's superceded by the solution above.
Anyway, here it is.
The following would replace the \makeatletter-\makeatother block above.
\makeatletter %% <- make @ usable in command names
  \let\sum@beforelimitmodification\sum
  \everydisplay\expandafter{\the\everydisplay                %% <- old \everydisplay
    \renewcommand*\sum{\sum@beforelimitmodification\limits}% %% <- new addition
  }
\makeatother  %% <- revert @

Changing the limits for all operators:
I just thought of another completely different method that affects all big operators (compatible with \amsmath) at once.
With amsmath loaded, all big operators (apart from integrals) include \slimits@ in their definition, which simply expands to \displaylimits (which acts as \limits in \displaystyle and does nothing in other math styles).
By redefining it, you can give all operators used in display environments limits.
\documentclass{article}

\usepackage{amsmath}

\makeatletter %% <- make @ usable in command names
  \renewcommand*\slimits@{\if@display\limits\else\displaylimits\fi}
\makeatother  %% <- revert @

\begin{document}

Lorem $e^{\sum_{n=1}^\infty \frac1n}$ ipsum

\[
    e^{\sum_{n=1}^\infty \frac1n}
\]

\begin{align}
    e^{\sum_{n=1}^\infty \frac1n}&
    \\
    &e^{\sum_{n=1}^\infty \frac1n}
\end{align}

Lorem $e^{\sum_{n=1}^\infty \frac1n}$ ipsum

\end{document}

↑↑ Output looks identical, so see the image above ↑↑

If this doesn't work for some custom defined operator, say \myoperator, you should add \slimits@ to its definition, like this:
\makeatletter %% <- make @ usable in command names
  \let\myoperator@beforelimitchange
  \renewcommand*\myoperator{\DOTSB\myoperator@beforelimitchange\slimits@}
\makeatother  %% <- revert @

A: I'm still pretty new to latex so forgive me then correct me if I'm wrong.
When the \sum_{min}^{max} command is used in \displaystyle the produced text shows the symbols as you want it with the indices above and below the large, capital Greek sigma.
https://www.sharelatex.com/learn/Integrals,_sums_and_limits
However even when your entire equation is in \displaystyle some parts might still render in \textstyle. When \texstyle\sum_{min}^{max} is called the result is the sigma symbol with adjacent indices. To force the summation symbol to always have the indices above and below the sigma you'll have to force the \sum command to be \displaystyle\sum. If you only have one or two summations the easiest way to achieve this is simply to add the \displaystyle command. However when you have a large scientific document this becomes tedious.
In cases where you want all your summations to have the indices above and below (as you have it in your crazy equation examples) the simplest way is to instruct latex to always render \sum as \dispaystyle\sum. this can be done by redefining \sum to be \displaystyle\sum by adding this to your preamble:
\let\oldsum\sum
\renewcommand{\sum}{\displaystyle\oldsum}

(credit to this guy https://latex.org/forum/viewtopic.php?t=14345).
Take note that this solution will force the \sum to always be in \display even when you are adding inline math so this solution is not perfect. You can however still call the old version of \sum (i.e. \oldsum) for inline cases.
The same thing happens to integrals and products and the same solution should work (although I did not test it on anything other that the \sum command)
\let\oldsum\sum
\renewcommand{\sum}{\displaystyle\oldsum}
$$
y = \frac{\sum{x}}{\sum_{i}^{\infty}{x_i}}
\cdot
\frac{\oldsum{x}}{\oldsum_{i}^{\infty}{x_i}}
$$

shows up as

For completeness I should mention that the same can be achieved by using the \limits command as mentioned in the sharelatex article referenced above.


text:
Q: How to write a gmock test such that it does not call constructor of the fixture class I would like to know if there is anyway I can write a gmock unit test in C++ that does not call the constructor of the existing fixture class.
My question is specific to existing code hence first I will summarize how existing code is structured.
In the C++ file, all the existing unit tests use the fixture. The constructor of that fixture builds configuration needed to execute all those unit tests.
The code in that file looks something like this.
class TestHandlerFixture : public HandlerFixture
{
public:
    TestHandlerFixture()
    {
        // Lot of code here including below call
        HandlerImplemantaion::create_link(Arg1);
    }
    ~TestHandlerFixture()
    {
        // Code to clean up
    }
}

BOOST_FIXTURE_TEST_SUITE(TestHandler, TestHandlerFixture);

BOOST_AUTO_TEST_CASE(test_one)
{

}

BOOST_AUTO_TEST_CASE(test_two)
{

}

// Lot more unit tests

BOOST_AUTO_TEST_SUITE_END();

I modified code that is called by the create_link() function and hence I want to add a new unit test to test the new code. The new code that I added is an error case and is not applicable to the regular flow of the create_link(). In the new test, I want to set error condition first and then assert using EXPECT_CALL(...) when create_link() is called.
Any idea how to do that without affecting the existing test cases or significantly modifying the existing unit tests?
Since create_link() is called inside the constructor and hence it executes for every test, I don't think I can set error condition inside the constructor since it will affect all the existing tests. I can delete create_link() call from the constructor and then explicitly call it in every unit test but that than I have to make changes in lot of places. I would like to know if there is any other way I can write unit test without significantly impacting existing tests. Is there way I can write unit test that does not call the constructor of the TestHandlerFixture class?
My idea about new unit test is something like this.
BOOST_AUTO_TEST_CASE(test_create_link_error)
{
    // Code here to set error condition
    EXPECT_CALL(...); // This check for error when create_link() is called.
    create_link(Arg1);
}

The above code does not work since TestHandlerFixture() constructor gets called first and hence it calls create_link().
Thanks.

redpajama_set_name: RedPajamaStackExchange


text:
Q: pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH Я пытался решить эту проблему, попробовав все способы, пытался указать путь, перезагружал Пк, переустанавливал библиотеку - ничего не работает...
Вывод при любом коде связанным с этой библиотекой:
      File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py", line 238, in run_tesseract
    proc = subprocess.Popen(cmd_args, **subprocess_args())
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] Не удается найти указанный файл

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:\WorkAI\WA.py", line 4, in <module>
    print(pytesseract.image_to_string('images.txt'))
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py", line 360, in image_to_string
    }[output_type]()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py", line 359, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py", line 270, in run_and_get_output
    run_tesseract(**kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py", line 242, in run_tesseract
    raise TesseractNotFoundError()
pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH

Есть ли другие библиотеки для распознавания текста?


text:
Q: Dependency errors when installing Cinelerra from a PPA I am trying to install cinelerra,
I have followed the instructions in https://launchpad.net/~cinelerra-ppa/+archive/ppa
basically
open the terminal and
sudo add-apt-repository ppa:cinelerra-ppa/ppa
sudo apt-get update
sudo apt-get install cinelerra

but after the last line, in the terminal appears this...

Some packages could not be installed. This may mean that you have
  requested an impossible situation or if you are using the unstable
  distribution that some required packages have not yet been created
  or been moved out of Incoming.
  The following information may help to resolve the situation:
The following packages have unmet dependencies:
   cinelerra : Depends: libguicast1 (= 1:2.2-0.3~ppa1~oneiric1) but 1:2.2-0.6~ppa1~oneiric1 is to be installed
               Depends: libmpeg3cine (= 1:2.2-0.3~ppa1~oneiric1) but 1:2.2-0.6~ppa1~oneiric1 is to be installed
               Depends: libquicktimecine (= 1:2.2-0.3~ppa1~oneiric1) but 1:2.2-0.6~ppa1~oneiric1 is to be installed
  E: Unable to correct problems, you have held broken packages.

I am using ubuntu 11.10 32bits

A: You have broken packages, try running apt-get with -f to fix broken packages:
sudo apt-get -f

Then update:
sudo apt-get update

Then install again.


text:
Q: cron job failure notification via cloud watch and SNS I have set some cron jobs in an ec2 instance. I want to be notified whenever a cron job fails in an ec2. In my cron.log, I don't see any error or alert even if the cron fails to execute. How can I capture the failed crons and send cloud watch alarm which can be picked up by SNS.
Thank you.


text:
Q: Many Spring-Boot Microservices to be run in one IntelliJ I have 5 repositories, each one containing a spring-boot microservice. I don't want to open 5x IntelliJ, so I am happy using File->New->Module. The Services window offers me the option to bulk start/stop the services. I am happy with this almost. But every new fictive developer would need to import every module, and I want to tweak this little detail.
I tought of multi-module maven. So right now I have 1 repository with 5 subfolders, each one representing a spring-boot microservice. On the command-line it's easy to build everything with one maven call. But the IDE support is not that good. There are no run-configuration suggested, so I need to fill in everything myself (5 times). Thinking of fictive other developers this solution is not that ideal.
I am still in search of a practical solution. What do you suggest?


text:
Q: Installing and maintaining an email server I need to move hosting providers for four or five domains and for several reasons I'm considering a Linux VPS rather than staying with my current shared, managed hosting provider. The only thing that's stopping me is email. I have lots of experience running and maintaining Apache, but none with email servers. Based on some research, if I want to keep what I've using now, it looks like I'd be going with Postfix and Dovecot, and probably Exim and SpamAssassin. I have no problem performing regular maintenance and watching for security updates, but I don't want to bite off more than I can chew.
For someone new to email services, how hard is it to set up an email server that is externally accessible (via SMTP and POP3, not IMAP), available over SSL/TLS and reasonably reliable for multiple domains? How much of a time commitment is it to maintain one?

A: I'll cut to the chase: email is a PITA to deal with. Nearly every experienced sysadmin holds this same opinion. There are many, many intricacies to deal with, from quotas, to authentication, from RBLs, to greylisting, to spam feedback loops, to getting your entire netblock blacklisted (and having to jump through all sorts of hoops to get off the blacklist.
Unless you have a very specific and well-thought-out reason for wanting to host email yourself, don't do it. There are many email providers that will let host your email for you, while letting you use your own domain. Zoho, Microsoft, Yahoo, and Google to name a few.
Costs for hosting email elsewhere are quite low all things considered, and your users will have a much better experience.
To conclude - you admit to having zero experience with email administration. Unless your users are okay with shoddy service, you really ought to think twice about self-hosting, because if you choose to do so, you will have many, many bad days.


text:
Q: Pathfinding Algorithm with Moveable Obstacles Research
I have done some research on path-finding algorithms.
I have come across some; such as A* & Dijkstra.
In most of these algorithms they allow for weights for moving through certain paths.
Some even allow for negative weights.
Walls have infinite weight, since you can never move through them.
I have also read a little about path-finding algorithms where the obstacles are moving.
However, my application is a little different.
Instead of obstacles that move on their own, there are obstacles that can be moved by the algorithm.
Question
Is there a path-finding algorithm that accounts for moveable (weighted) objects?
Constraints
The algorithm needs to find the shortest path from A-to-B.
It does not need to be efficient, as the maze is relatively small.
Moveable obstacles must be weighted


text:
Q: SharePoint Default SearchBox Seach always place # in front of search term Using the default search box webpart, if you ran another search keyword for the second time, It would append the newer keyword with anchor (#) and will keep the old search keyword in the query string with key "k".
If search for first time, it appends "#" instead of "?" at the beginning of the search term.
e.g. searchresults/Pages/results.aspx?k=blash&#k=blash2
e.g. searchresults/Pages/results.aspx#k=blash2
But if search using the site search box, it actually reload the page, with "?" before the new search term.
How can I get the same behaviour when I using default search webpart, so I am not going to get something like '#'?


text:
Q: An "Easy" Truncation Procedure Let $X$ be a real random variable on a probability space $(\Omega,F,P)$ of mean $0$ and variance $1$. I am asked to prove that that for every $\epsilon>0$ there is a function $\phi: \mathbb{R} \to \mathbb{R}$ that satisfies all of the following:

*

*$\phi$ is bounded and continuous in $\mathbb{R}$.

*If $Y=\phi \circ X$, then $Y$ still has mean $0$ and variance $1$.

*The random variable $Z=X-Y$ has variance at most $\epsilon^2$.

Here is my attempt:
Although I am asked to prove the result, it seems to me that this is not doable. Let $\mu$ be the law of $X$. If such a $\phi$ exists, then we have:
\begin{equation*}
0=\mathbb{E}[X]=\int_{\mathbb{R}}xd\mu(x) = \int_{\mathbb{R}}\phi(x)d\mu(x)=\mathbb{E}[\phi \circ X]
\end{equation*}
Then $\phi(x)=x$ almost everywhere with respect to $\mu$. But $x$ is obviously not bounded so I am stuck here. Hints would be really appreciated and a specific example of $\phi$ is even better. I think whoever designs the question has a specific example of $\phi$ in mind but I was not able to find it.
Edit: as it is pointed out in comments, I somehow thought that $\int_{\mathbb{R}}|x-\phi(x)|d\mu(x)=0$ and concluded $\phi=x$ in my attempt, which is simply not right. So the problem is more likely to be solvable. However, I am still stuck on approaching the problem.

A: The following two lemmas do the trick. I wrote a lot of details, because I haven't used rigorously the dominated convergence theorem in a long time!
Lemma: Let $X$ be a random variable with finite second moment. For every $\epsilon>0$, one can find a continuous, bounded $\phi$ such that
$\mathbb{E}[\left(X-\phi \circ X\right)^2] < \epsilon$.
Proof:
Let $n \in \mathbb{N}$ and let $\phi_n : x \mapsto \max \{-n,\min\{x,n\}\}$.
Now, define $Y_n := \phi_n\circ X$.
We have $X-Y_n = \textbf{1}_{n < X} \left(X-n\right) + \textbf{1}_{-n > X} \left(X+n\right)$.
Therefore, we have the pointwise convergence $\lim_{n \to \infty} X - Y_n = 0$.
Moreover, we have $(X-Y_n)^2 \leq (X-n)^2+(X+n)^2 \in L^1(\Omega)$, so, by the dominated convergence theorem, $\lim_{n \to \infty} \mathbb{E}[(X-Y_n)^2] = 0$.
Lemma:
Let $X$ be a random variable such that $\mathbb{E}[X^2]= 1$ and $\mathbb{E}[X] = 0$. Let $(Y_n)_{n \in \mathbb{N}}$ be a sequence of random variables such that $\Vert \cdot \Vert_1-\lim_{n \to \infty} (X-Y_n)^2 = 0$.
Then $\Vert \cdot \Vert_1-\lim_{n \to \infty} \left(X - \frac{Y_n - \mathbb{E}[Y_n]}{\sqrt{\mathbb{E}[\left(Y_n-\mathbb{E}[Y_n]\right)^2]}}\right)^2 = 0$.
Proof:
Let $m_n := \mathbb{E}[Y_n]$ and $\lambda_n := \sqrt{\mathbb{E}[\left(Y_n-m_n\right)^2]}$.
From Cauchy-Schwarz' inequality, $\mathbb{E}[\vert X - Y_n\vert] \leq \sqrt{\mathbb{E}[(X-Y_n)^2]} \to 0$, so $\vert m_n \vert = \vert \mathbb{E}[X - Y_n] \vert \leq \mathbb{E}[\vert X - Y_n \vert] \to 0$.
Moreover, since $Y_n$ converges to $X$ in $L^2$, $Y_n - m_n$ converges to $X$ in $L^2$ as well, so $\lambda_n$ converges to $1$, and therefore, we have the pointwise limit $\lim_{n \to \infty} \left(X - \frac{Y_n - \mathbb{E}[Y_n]}{\sqrt{\mathbb{E}[\left(Y_n-\mathbb{E}[Y_n]\right)^2]}}\right)^2 = 0$.
Let $n_0$ such that for all $n \geq n_0$, $\frac{1}{2} \leq \lambda_n \leq 2$ and $m_n \leq 1$.
We have
$\begin{array}{rcl}
\left(X-\frac{Y_n - \mathbb{E}[Y_n]}{\sqrt{\mathbb{E}[\left(Y_n-\mathbb{E}[Y_n]\right)^2]}}\right)^2 &= &\left(\frac{\lambda_n X-Y_n}{\lambda_n} + \frac{ m_n}{\lambda_n}\right)^2\\
&\leq &2\left(\frac{\lambda_n X-Y_n}{\lambda_n}\right)^2 + 2\left(\frac{ m_n}{\lambda_n}\right)^2\\
&\leq &8(\lambda_n X - Y_n)^2 + 8m^2_n\\
&\leq &64X^2 + 16Y^2_n + 8\\
\end{array}$
and since $\left(\mathbb{E}[Y^2_n]\right)_n$ is bounded, then the sequence $\left(\left(X - \frac{Y_n - \mathbb{E}[Y_n]}{\sqrt{\mathbb{E}[\left(Y_n-\mathbb{E}[Y_n]\right)^2]}}\right)^2\right)_n$ is bounded in $L^1$, so we can apply the dominated convergence theorem and we are done.


text:
Q: Logarithm function on the Robba ring $\mathcal{R}_L$ and some properties of $\mathcal{R}_L$ I am reading some of Colmez papers  about $(\varphi,\Gamma)$-modules over the Robba ring $\mathcal{R}_L$, where $L$ is a finite extension of $\mathbb{Q}_p$. Now I would like to understand this ring better.
In some proofs he uses the logarithm of an element of $\mathcal{R}_L$. I could not yet find a source where a definition of the logarithm on this ring is given. My guess is that you define it with the usual power series.
My first question is whether this is the right way to do so. Furthermore on what elements is this logarithm defined and how does it change the annulus of convergence of a series.
The second question is more general about the Robba ring. If we only observe the bounded elements $x\in (\mathcal{E}^t)^*$ we apparently have a unique decomposition $x=\alpha T^k x^+x^-$ with $\alpha \in L^*$, $k\in \mathbb{Z}$, $x^+\in 1+T\mathcal{O}_L\left[\!\left[ T \right]\!\right]$ and $x^-\in 1+\mathfrak{m}_L[\![ T^{-1} ]\!]\cap \mathcal{E}^t$. Does someone know where I can find a proof for this?
I would also be really happy about a source, where I can read about some basic properties of the Robba ring in general and especially about the two things I just named.

A: I don't think that Colmez uses the log of a general element of $\mathcal{R}_L$. The ring $\mathcal{R}_L$ is some localization/completion of the ring of coordinates on a Lubin-Tate formal group, and the log that appears in Colmez' papers is the formal group log, ie $\log_{LT}(X)$ if you choose a coordinate $X$ on your formal group (ie if you choose a variable for $\mathcal{R}_L$). If your group is $\mathbf{G}_m$ and $X$ is the usual variable, then $\log_{\mathbf{G}_m}(X) = \log(1+X)$.
As for the factorisation property, see for example Kedlaya's "A p-adic local monodromy theorem", section 6.2 (in particular prop 6.5), where a corresponding statement for matrices, not just elements, is proved.


text:
Q: Difference between PC SAS and Server SAS Actually my project is integrated with Java. From Java SAS code is calling by using  drop downs. Currently, we are using server SAS. Now my client wants to move to PC SAS instead of the server SAS. What difference does it make in my application?

A: PC SAS - It is a single machine installation of SAS software. It generally consists of SAS Foundation tools such as Base SAS, SAS/STAT & SAS/GRAPH software components (product - SAS Analytics Pro). It provides the benefits of data integration, data manipulation, data analysis and data presentation (reporting and visualization) at small scale. It is used within smaller teams within departments focusing on particular business process or part of business process.
Server SAS - It is an enterprisewide version of SAS software. It is installed on multiple machines (two or more) based on customer requirements. It can be used by multiple users at the same time. It requires higher hardware configuration than PC SAS. It contains four tiers - Web Tier (mainly presentation layer), middle tier(where java applications execute), server tier and data tier (enterprise data sources). It is highly customizable in terms of number of add-on components required by customer based on their requirements.
Client tools for development - SAS DI Studio (ETL development), SAS Infomap Studio (to create business metadata layer for reporting), SAS WRS (SAS report authoring tool), SAS OLAP Cube Studio (SAS cube development and maintenance tool)
End user tool - SAS Information Delivery Portal (SAS Portal for users to view reports)

A: Well, the REALLY STRONG difference is: horsepower.
Usually the "Server SAS" comes in a huge server, so its constraints are smaller (think fast hard drives, lots of RAM, several processors...). I am talking something like 300GB of RAM, not to mention the terabytes of hard drive space available.
The "Computer SAS" won't have any of that. So, there.
I do not know if there are differences about the language used in both. I really don't think so.

A: In broad terms, the differences come down to Horsepower (as just_testing commented on) vs. Cost.
SAS's server products are very powerful.  I have been able to use SAS's BI and Grid products running about 25 TB a day in an enterprise application without much of an issue.  PC licenses do a good for small custom jobs/business intelligence applications.
In terms of cost, SAS licenses its software based on the processor speed.  In cases, where you are operating a Larger server application, this can reach into the six figures pretty easily.  A PC SAS license is closer to a couple thousand.  This licensing structure will probably change as more users adopt Hadoop platforms.  ****NOTE: contact your SAS Sales professional for specific pricing... this is based on my own personal experience. ****

A: The most important difference in terms of compatibility are to note if there are any shell commands used in the existing programs (copying files, executing shell scripts, using the "x" command in SAS, typically). Otherwise look out for absolute file paths that refer to local files saved on the server, otherwise it's mainly a performance difference. However there are some advantages that most people overlook with PC SAS... for instance the ability to use DDE which allows you to control other Windows programs is completely non-existent on non-windows servers.
Also, it's usually wrong to assume you can't process large amounts of data with PC SAS, you just have to be a little more disciplined about it by using the SQL pass-through method for your proc sql and having the database do the heavy lifting for you. With PC SAS you will want to work mainly with data that has already been reduced/summarized a bit by the database when the data gets big.

A: suppose we take sas 9.2 .
Requirments for sas9.2 is minimum 2 GB RAM and  some processor. this tool is running on less PC requirments
In my orgonization 10 pcs are there . so 10 pcs require a small RAM like 2 GB
We take SASBI package . these tools requirments are very high .
Orgonization unable to invest that huge amount of money for pcs.
so  install SASBI on SERVER and Install client editons on pcs then give connection from pc to server for acessing.

A: I think the difference is whether SAS code hardcode the directories or libname explicitly.
That requires changes to SAS code.
But if your JAVA code also hardcode about where to submit the SAS code. that is the thing  you should address from yourside.


text:
Q: Simulating a VHDL design using custom libraries I am trying to make a simple VHDL project to brush up my memory. I am using a file half_adder.vhd to create another file full_adder.vhd, which I wish to simulate. These files are not in the same project. I am using the Xilinx ISE version 14.7.
My code synthesizes perfectly fine, and passes the syntax check. I can also create RTL schematics. However, whenever I try to create a test bench for the full adder, I get the following error messages:

ERROR:HDLParsers:3317 - "E:/workspaceXilinx/FullAdder/full_adder.vhd" Line 23.
      Library half_adder cannot be found.
ERROR:HDLParsers:3513 - "E:/workspaceXilinx/FullAdder/full_adder.vhd" Line 24.
      Declaration all can not be made visible in this scope since design unit
     half_adder is not a package.

I have added half_adder.vhd to the work library, so I'm not sure why the library cannot be found. Here are the two files I am using:
half_adder.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity half_adder is
    port(a, b: in STD_LOGIC;
            s, c: out STD_LOGIC);
end half_adder;

architecture Behavioral of half_adder is
begin
    s <= a xor b;
    c <= a and b;
end Behavioral;

full_adder.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

library half_adder;
use half_adder.all;

entity full_adder is
    port (a, b, cin: in STD_LOGIC;
            s, cout: out STD_LOGIC);
end full_adder;

architecture Behavioral of full_adder is
signal s1, c1, c2: STD_LOGIC:='0';
begin

    HA1: entity work.half_adder port map(a, b, s1, c1);
    HA2: entity work.half_adder port map(s1, cin, s, c2);
    cout <= c1 or c2;

end Behavioral;

A: The work library refers to the library currently being compiled. If you have not explicitly created a half_adder library in the design tool, it will not exist. All you need to do is remove this library and use clause relating to half_adder; it is not required.


text:
Q: How should I refactor this code to prevent function was used before it was defined I'm getting this error
'subscribe' was used before it was defined.eslint(no-use-before-define) here:
    const { values, handleChange, handleSubmit } = useForm(subscribe);

    function subscribe() {
        axios.post(fAction, values, {headers: {'Accept': 'application/json'}} )
        .then((response) => {
            document.querySelector('#js-response-newsletter-message > p').innerText = response.data.message;
        });
    }

What should be the approach to follow here?
I tried to switch function with const however, I'll have the same problem since I'm using value inside subscribe().
useForm() is being used from another file and it's called after submitting a form (callback() -> subscribe()):
  const handleSubmit = (event) => {
    if (event) event.preventDefault();
    if (values.email !== undefined && values.email !== '') {
      callback(event);
    }
  };

A: What you can do, if you don't want to disable any rules, is declare function up front. Something like this:
var subscribe;

const { values, handleChange, handleSubmit } = useForm(subscribe);

function subscribe() {
  axios.post(fAction, values, {headers: {'Accept': 'application/json'}} )
        then((response) => {
    document.querySelector('#js-response-newsletter-message > p').innerText =
        response.data.message;
    });
 }

example in ESLint editor


text:
Q: Nuxt.js - get cookie inside plugin I had a Vue.JS application and use axios as a HTTP client by just importing its instance into the components (like this):
import axios from 'axios'
import cookies from '~/components/cookies.js';
var api = axios.create({
  baseURL: 'http://localhost.api/',
  timeout: 10000,
  headers: {
  'Authorization': cookies.get('token',''),
  'X-Refresh-Token': cookies.get('refreshtoken'),
  'Content-Type': 'application/json'
}
})

export default api;

...
import api from '~components/api.js'

Cookies were obtained from document.cookie.
But now I moved to Nuxt and document is not defined during server rendering. So, how can I get cookies from the server request? (or even dynamically change token in the process)


text:
Q: What is the model number for product MP2F2LL/A I'd like to purchase a case at the same time as purchasing this iPad from Apple's website, but I can't seem to figure out what the actual model number is.  I can't find any reference to iPad's with A9/M9 processors.  First image is from their store page, second image is the relevant 'technical specifications' from the link at the bottom of the first image.
Thanks!

A: iPad (5th generation)
Year: 2017
Capacity: 32, 128 GB
Model number (on the back cover):
A1822 on the iPad (5th generation) Wi-Fi
A1823 on the iPad (5th generation) Wi-Fi + Cellular

A: Apparently this is the model that is coming out 3/24.  Nothing on the business purchasing site indicated this.  Sorry about the confusion.


text:
Q: How can I run Terminal and Disk Utility at the same time when booted in Recovery Mode / off Recovery Partition in (Mac) OS X In other words how can I run Disk Utility from Terminal when booted in Recovery Mode / off Recovery Partition in recent versions of (Mac) OS X  ?
This was once easy; I've remember I figured it out myself in an old version. (Lion?). There's a solution at How to open Disk Utility.app through Terminal? that fails since around 10.8.
Perhaps it's easier to tell Terminal to reopen after a delay and then open Disk Utility?
The executable open can be found on a bootable partition, so
ls -al /Vol*/*/usr/bin/open

should show copies.
Why do this?  It's handy to run other things, like iostat, top, cp, find, df, etc.


text:
Q: Python subclass function changes subclass's instance to parent class's instance I have written 3 classes. One is the parent class "Single_Ket", one is the subclass "J_Eig", and the last one is "J_Op" which defines some action on the subclass "J_Eig".
from sympy import Rational, sqrt, I
import sympy as sp

class Single_Ket:

    def __init__(self, label: tuple, ket_coefficient = 1):

        self.label = label
        self.coeff = ket_coefficient

    # Elementary Computations
    def __mul__(self, Scalar_Const):
        return Single_Ket(self.label, self.coeff * Scalar_Const)

    def __rmul__(self, Scalar_Const):
        return Single_Ket(self.label, self.coeff * Scalar_Const)

    def __truediv__(self, Scalar_Const):
        if type(Scalar_Const) == int:

            return Single_Ket(self.label, Rational(self.coeff, Scalar_Const))
        else:
            return Single_Ket(self.label, self.coeff/Scalar_Const)

    def __neg__(self):
        return Single_Ket(self.label, -self.coeff)

class J_Eig(Single_Ket):

    def __init__(self, j, m, Coeff = 1):

        super().__init__((j, m), Coeff)
        self.j = j
        self.m = m
        self.State_Coeff = Coeff

    def __rmatmul__(self, X):
        if str(X) in dir(J_Op)[0: 3]:
            return eval('J_Op.{}(self)'.format(X))

class J_Op:

    @staticmethod
    def J_Plus(J_State):

        return sqrt(J_State.j*(J_State.j + 1) - J_State.m*(J_State.m + 1)) * J_Eig(J_State.j, J_State.m + 1, J_State.State_Coeff)
#############################################################

psi = J_Eig(1, 0, 1)
psi_2 = 'J_Plus' @ psi
print('J_Plus' @ psi)
# This gives me correct result

print('J_Plus' @ psi_2)
# This gives me error message:
# TypeError: unsupported operand type(s) for @: 'str' and 'Single_Ket'

When I tried doing the action 'J_Plus' once, there is no problem with the output result. However, doing this makes "psi_2" an instance of the parent class "Single_Ket", which I actually need it to be an instance of the subclass "J_Eig" for me to act "J_Plus" on it again.
I know that I can simply just define "mul" and all that again in my base class "J_Eig", but those operation will be basically small modifications of the same methods in the parent class. Is there a way to avoid such repitition?

A: Assuming the constructors are compatible (which is a big assumption), you can. type returns the type of the current object, and you can use typenames as constructors. Consider
def __mul__(self, Scalar_Const):
    return type(self)(self.label, self.coeff * Scalar_Const)

If you give it a Single_Ket, then type(self) will be Single_Ket. If you give it a J_Eig, then likewise it'll be J_Eig. As I mentioned, it'll be your job to ensure that all of the subclasses have compatible constructors.


text:
Q: Wilsonian vs 1PI As a follow up to Difference between 1PI effective action and Wilsonian effective action, where can I find pedagogical material that highlights the similarities and differences between the 1PI and Wilsonian effective action?
Are there any good articles that that have a good exposition on implications to non-renormalization theorems in SUSY and to anomalies/instantons in Yang-Mills theories, as well as implications to gauge-invariance of renormalization group equations for the parameters in the two effective actions?

A: These two actions have very few things in common. The 1PI effective action gives an exact description of the physics of your field theory, whereas the Wilsonian effective action is a formal object that is not physical (in the sense that you cannot get much physics out of it, even though the presence of fixed points in the RG flow is, of course, a very important thing).
In fact, there is an object that can be seen as the interpolation between the 1PI effective action, and the Wilsonian, sometimes called the average effective action. You should have a look at the non-perturbative RG, or functional RG. Some people have used it to study SUSY, you may want to read that too.


text:
Q: How to deinterlace and concatenate with filter complexe I'm trying to deinterlace and concatenate. The concat part is functioning, but I can't find how to insert the yadif filter in the sequence. With the command bellow, I'm breaking the concatenation...
ffmpeg ^
-y ^
-i video1.mpg ^
-i video2.mpg ^
-itsoffset 20 ^
-i logoSE.png ^
-filter_complex "[1:v]yadif; [0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[vv][a]; [vv][2:v]overlay=W-w-10:10[v]" ^
-map "[v]" ^
-map "[a]" ^
-c:s "copy" ^
-pix_fmt yuv420p ^
-c:v libx264 ^
-crf 21 ^
-x264opts keyint=30:min-keyint=1:bframes=3:ref=4:scenecut=-1:colorprim=bt709:transfer=bt709:colormatrix=bt709:force-cfr ^
-b:v 16M ^
-minrate 6.6M ^
-maxrate 18.5M ^
-bufsize 8M ^
-f mpegts ^
-streamid 0:481 ^
-streamid 1:129 ^
-mpegts_start_pid 481 ^
-mpegts_pmt_start_pid 27 ^
-muxrate 20M ^
-preset medium ^
-tune film ^
-profile:v high ^
-level:v 4.1 ^
-metadata:s:a:0 language=fre ^
-s 1920x1080 ^
-r 30000/1001 ^
-vsync 1 ^
-c:a ac3 ^
-b:a 448K ^
-ar 48000 ^
-ac 6 ^
output_video.ts

A: The filter_complex will change to
"[1:v]yadif[1v]; [0:v][0:a][1v][1:a]concat=n=2:v=1:a=1[vv][a]; [vv][2:v]overlay=W-w-10:10[v]"

When you wish to send the output of a filter to another filter, you should label the output pad of the first filter (assigned 1v here) and then ingest that in the destination filter.


text:
Q: Progress Bar with 5% steps I have the following simple code:
import sys
num_tasks = 1000000
for i in range(num_tasks):
    if ((i/(num_tasks-1)) % 5):
        sys.stderr.write('\rdone {0:.0%}'.format(i/(num_tasks-1)))

My problem is that i just want to show the 5% steps like:
done 5%, done 10%, done 15%,...

What am i doing wrong?

A: This line:
if ((i/(num_tasks-1)) % 5):
Will be interpreted as True in every iteration in which (i/(num_tasks-1)) is not divisible by 5, since (i/(num_tasks-1)) % 5 will be equal to values different than 0. You should instead do:
if ((i/(num_tasks-1)) % 5 == 0):

A: The error is on this line:
if ((i/(num_tasks-1)) % 5):
Because ((i/(num_tasks-1)) % 5) is not a boolean value, your if statement will not behave properly. Here is some more information about the truth values of different primitive types in Python. Try this instead:
if i/(num_tasks-1) % 5 == 0:


text:
Q: Gradle & SpringBoot - Error cant resolved I am trying to run my first application with SpringBoot & Gradle. I am using git as version manager.
I create my project via this online tool : https://start.spring.io/
gradle setup
Then, I push my project via Git on my Bitbucket Repository :
my bitbucket architecture
Next, I import my project from Git via eclipse eGit plugin. That's my basic project in eclipse IDE :
project eclipse explorer
My problem is concerning Gradle. I have a depencies problem (I believe) and my project doesn't compile correctly.
my gradle
I tried different way :

*

*Add in build.gradle : compile('org.springframework.boot:spring-boot-starter-web') AND/OR compile('org.springframework.boot:spring-boot')

*I run : ./gradlew build --refresh-dependencies

Nothing works. I need some advices to start with these news technos' =) Thank you very much mates!


text:
Q: how to get running processes I'm trying to get running processes from a linux server but I having some doubts. If I get top exit I have:
# top -b -n1 | head -n5
top - 16:18:19 up 60 days, 21:22,  8 users,  load average: 0.03, 0.13, 0.15
Tasks: 1274 total,   7 running, 1267 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.6% us,  2.4% sy,  0.0% ni, 95.8% id,  0.1% wa,  0.0% hi,  0.0% si
Mem:   6291556k total,  5269044k used,  1022512k free,    29976k buffers
Swap:  6291448k total,    82508k used,  6208940k free,   649292k cached

What I want to know is which processed are the "7" that top says that are "running" in the second line.
I've try "ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm" and filter by "stat" status equal to "R" but I'm not able to get this 4 processes. I've always get the "ps and grep" and sometimes I get another one, but not not the seven tha ttop shows.
Is there any way to obtain that?
Thanks & regards.

A: I typed man top and read about top -i which displays non-idle, non-zombie processes.


text:
Q: Why model validation is not working I have following Model class that is used during the Web API Post. As you can see Id field is annotated as Required.
public class Model
{
    [Required]
    public Guid Id { get; set; }
}

The Post for API is as follows
[HttpPost]
public IActionResult Post([FromBody]Model value)
{
    if (!ModelState.IsValid)
        return BadRequest();

    Model newModel = new Model() { Id = value.Id };
    return Ok(newModel);
}

On a sunny day, this is what I see. All good
enter image description here
On a rainy day, when Id is not provided, I get following.
enter image description here
Given that in the second example, a Required field is not provided, shouldn't a BadRequest is returned rather than a 200 with invalid id guid with 00000000-0000-0000-0000-000000000000?

A: Using the Required annotation
In the Web API Docs, your issue is known as 'under-posting'.
The issue is that Guid has a default value, so when no value is provided, it is initialized with the default value... which then satisfies the Required constraint.
To prevent this, counter-intuitively you make the Guid nullable using Guid?.
Then if the value is not provided, the deserializer will set the value to null, which will cause the Required constraint to be violated.
If the value is provided, it will be set, and all will be well.
See https://www.asp.net/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api for more details, there is an example of a similar issue for a decimal property.
The key distinction to understand is that Guid.Empty is really a valid Guid.  The only way to distinguish between the user providing a Guid (which is empty) and not providing one at all is to make it nullable, so null = not provided, and Empty = the user provided the empty Guid.
Using a Custom Annotation
If you really don't want to make your Guid nullable, you need to consider what would you do for a 'normal' value type, e.g. an integer.  Rather than making it required, you'd use a Range attribute and specify that it must be > 0.
Similarly for Guids, you'd ideally have an attribute that would simply test that it is != Guid.Empty
See https://learn.microsoft.com/en-us/aspnet/core/mvc/models/validation#custom-validation for guidance on creating a custom validation atribute.


text:
Q: How to make SSH tunnel as daemon? Actually, I need a secured VPN, but configuring it was too hard for me. So I decided to use SSH tunnel. The tunnel could be established when I logged in. :(
(1) How can I make a SSH tunnel without login? Like daemons. And (2) how can I keep the tunnel connections reliably?
I'm using Ubuntu Server 10.04 LTS.

A: *

*If the server allows public key authentication, put the public key of the connecting client to the server's ~/.ssh/authorized_keys file. Use ssh-keygen on the client, the create a key pair. You may also use the ssh-copy-id script to copy the public key to the server. On key generation, you may omit the passphrase, so you won't be asked for it. Be sure to keep the private key (~/.ssh/id_rsa) safe.

*Use autossh to keep the tunnel alive.


text:
Q: Shell_NotifyIconA does not display the HICON provided I am trying to create a simple tray icon using the windows-rs rust crate.
When calling Shell_NotifyIconA(NIM_ADD, &data); one is created, however, by default it has a blank image. I have loaded an .ico via LoadImageW, however, still nothing.
What am I missing?
Full code:
use std::ffi::OsString;

use windows::Win32::Foundation::{HINSTANCE, GetLastError};
use windows::Win32::UI::Shell::{Shell_NotifyIconA, NOTIFY_ICON_MESSAGE, NIM_ADD, NOTIFYICON_VERSION_4, NOTIFYICONDATAA};
use windows::Win32::UI::WindowsAndMessaging::{LoadImageW, IMAGE_ICON, LR_DEFAULTSIZE, LR_LOADFROMFILE, DestroyIcon, HICON};

fn main() -> anyhow::Result<()> {
    unsafe {
        let mut data = NOTIFYICONDATAA::default();
        let icon_handle = LoadImageW(HINSTANCE::default(), &OsString::from("icon.ico").into(), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE)?;

        println!("icon handle {:#?}", icon_handle); // icon handle 363530555
        data.hIcon = HICON(icon_handle.0);
        println!("error? {:#?}", GetLastError()); // 0

        Shell_NotifyIconA(NIM_ADD, &data);
    }

    Ok(())
}


text:
Q: Bash regex extract value inside a quotes after a specific string I'd like to extract the value of "job" inside a console text taken from curl, it's : ix90CvhtaWfMhNiIy3RDbr2lJ2pRzGxBqHSiDq5OcI
95 28.2M     0     0   95 27.0M      0  1091k  0:00:26  0:00:25  0:00:01 2910k
100 28.2M    0    52  100 28.2M      1  1108k  0:00:26  0:00:26 --:--:-- 2887k
100 28.2M    0    52  100 28.2M      1  1108k  0:00:26  0:00:26 --:--:-- 2965k
{"job":"ix90CvhtaWfMhNiIy3RDbr2lJ2pRzGxBqHSiDq5OcI"}
[Pipeline] }
[Pipeline] // dir
[Pipeline] }

I am using this command to extract the value :
curl -v --silent 'link-to-consoleText' 2>/dev/null | grep -Eo '("job":\"[^"]*\")' | head -n1 | awk -F' = ' '{ print $1 }'

Current regex use : ("job":\"[^"]*\"), but it extracted: "job":"ix90CvhtaWfMhNiIy3RDbr2lJ2pRzGxBqHSiDq5OcI".
How to extract only the value? Thanks.

A: No need for grep if you are using awk, try this:
curl -v --silent 'link-to-consoleText' 2>/dev/null | awk -F'"' '/job/ {print $4}'

A: If supported, using grep -P you can use \K to clear the match buffer and assert the " at the end.
Note that you don't need the capture group and you don't have to escape the double quotes.
curl -v --silent 'link-to-consoleText' 2>/dev/null | grep -Po '"job":"\K[^"]*(?=")'


text:
Q: Stop the message 'A software update is required to connect to your iPad' without doing a software update I'm not interested in updating any software at this point. I would like this message to stop being displayed. Is there way to stop it from being displayed? I would prefer a System Preferences solution, but I'm also comfortable at the command line.
I'm currently running MacOS 10.15.5 and IPadOS 14.4.

A: You can't. Usually this is a very small update which allows your more recent iPad running iOS 14, to connect to your Mac running a macOS version pre-Big Sur.


text:
Q: use ngFor loop in Angular 6 to dynamically create array of input elements and add dynamical validation based on template reference variables I would like to create dynamically 3 input tags in Angular 6 to not copy/paste html code because that input elements have similar html and functionality.
For this purpose I created an array "reusableItems" inside component and initialize it :
    let numberOfInputElements = 3;
    for (let i = 0; i < numberOfInputElements; i++) {
      this.reusableItems.push({
        answer: 'Answer ' + (i +1),
        passwordRecoveryAnswer: this.user['passwordRecoveryAnswer' + (i + 1)]
      });
    }

Then I put code inside my html :

 {{item.answerTitle}}

      <input type="text" name={{item.answer}} ref-{{item.answer}}="ngModel" class="col-sm-12 k-textbox ph0"
             [(ngModel)]=item.passwordRecoveryAnswer
             [pattern]="[a-z]"
             required autocomplete="off"/>

It seems works fine but then I need to add error messages when these fields will be empty and not match to pattern. Something like :

  {{'Please provide an answer' | translate}}

  {{'Pattern is not match'}}

I don't know what should i put inside ngIf condition.
How can I do it if my template reference variables are comes from array?
Is anyone have ideas?
Thanks

A: Angular creates unique template reference variable for each embedded template so that  you can use the same template reference variable name inside ngFor loop:

 {{item.answerTitle}}

            <input type="text" name={{item.answer}} ref-answer="ngModel" class="col-sm-12 k-textbox ph0" [(ngModel)]="item.passwordRecoveryAnswer"
             [pattern]="'[a-z]'" required autocomplete="off" />

                {{'Please provide an answer'}}

                {{'Pattern is not match'}}

In the code above I use the same name for each input in array
ref-answer="ngModel" // or you can also use #answer="ngModel


text:
Q: Track users position for a longer period of time I am building an app, that works as an alarm-service. The app is sending data about the users location to our server every 10-minutes.
The problem is that the app will stop sending the data after a few hours or days. I have tried to find more info about this and have compared our app with the performance of the app "Moves" that keeps on tracking for weeks. In their help section you can read about the most common reasons why the tracking goes down (http://www.moves-app.com/help), but that doesn't help.
They must be using some trick that we don't. I guess they use several methods to accomplish this.

*

*Anyone what has successfully build an iOS app with similar functionality that can lead me in the right direction?

My code looks like this:
AppDelegate:
- (id)init
{
    self = [super init];
    if (self) {
        _locManager = [[MYLocationManager alloc] init];
    }

    return self;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [self._locManager start];
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [self._locManager restart];
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    [self._locManager restart];
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    [self._locManager stop];
}

MYLocationManager:
- (void)start
{
    [self _invokeLocationUpdates];
}

- (void)stop
{
    [self _killLocationUpdates];
}

- (void)restart
{
    [self _killLocationUpdates];
    [self _invokeLocationUpdates];
}

- (void)_killLocationUpdates
{
    if (self._locationManager != nil) {
        [self._locationManager stopUpdatingLocation];
        self._locationManager = nil;
    }
}

- (void)_invokeLocationUpdates
{
    if (self._locationManager == nil) {
        self._locationManager = [[CLLocationManager alloc] init];
        self._locationManager.delegate = self;

        self._locationManager.pausesLocationUpdatesAutomatically = NO;

        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            self._locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
            self._locationManager.distanceFilter = 10;
        }
        else {
            self._locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
            self._locationManager.distanceFilter = 100;
        }

        [self._locationManager startUpdatingLocation];
    }
}

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    // sending location info to server
    [[NSNotificationCenter defaultCenter] postNotificationName:MYSEC_NOTIFICATION_POSITION_UPDATE object:self];
}

In info.plist file we have:
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>

A: You can use the Significant-Change Location Service. Basically if your app is suspended or terminated, when the significant-change location service receives data it wakes up your app and gives it some time to process the data. You can read more info at Location and Maps Programming Guide.


text:
Q: How to post record in SQL using Ajax no page refreshing in Laravel 5.2 I want to post a record in SQL using Ajax without using a form but I have trouble:

method not allowed

<input type="text" name="name" value="  2" />
<input type="text" value="detail" />
<input type="hidden" name="_Token" value="{{ csrf_token() }}">
<input type="button" onclick="add()" value="Submit Comment" />

Here is my controller:
class Cdesigination extends Controller
{
    public function index()
    {
        $insertData = array(
            "name"      =>  Input::get("name"),
            "detail"    =>  Input::get("detail"),
            "token_key" =>  Input::get("_token")
        );

        return view('company');
    }

    public function product()
    {
        $record = array(
            "p_name"      =>  Input::get("name"),
            "p_price" =>  Input::get("price"),
            "p_detail"  =>  Input::get("detail")
        );

        return view('product');
    }
}

The route is:
Route::post('add', ['as' => 'addrecord', 'uses' => 'Cdesigination@index']);

Ajax Function:
function add()
{
    var name = $('#name').val();
    var detail = $('#detail').val();
    var token = $('#_token').val();

    $.ajax({
        type: 'POST',
        url: '{{url("/posts")}}',
        data: "name=" + name + "&detail=" + detail + "&_token=" + token,
        success: function(data){ }
    });
}

Where is my mistake? Please guide me and explain how to post record in Laravel without using a form.

A: your url is: {url("/posts")} and you haven't this route defined


text:
Q: Permanent gaierror 'Temporary failure in name resolution' after running for a few hours I have a long running python script, launched with upstart. This script makes quite a lot of requests. Everything works well at first, however after a few hours I start permanently getting the following error for each request:
  File "/opt/a/a-env/local/lib/python2.7/site-packages/atom/client.py", line 119, in request
  File "/opt/a/a-env/local/lib/python2.7/site-packages/atom/http_core.py", line 420, in request
  File "/opt/a/a-env/local/lib/python2.7/site-packages/atom/http_core.py", line 489, in _http_request
  File "/usr/lib/python2.7/httplib.py", line 931, in endheaders
  File "/usr/lib/python2.7/httplib.py", line 794, in _send_output
  File "/usr/lib/python2.7/httplib.py", line 756, in send
  File "/usr/lib/python2.7/httplib.py", line 1134, in connect
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
gaierror: [Errno -3] Temporary failure in name resolution

This is not a problem with name resolution or DNS, because a simple restart of the application fixes this problem.
I've tried both Python 2.6 a 2.7 and the same situation occurs.
I'm running Linux 2.6.35-30-virtual #61-Ubuntu SMP Tue Oct 11 18:26:36 UTC 2011 x86_64 GNU/Linux
There have been a few posts with this problem, but none with a straightforward explanation or solution:

*

*https://github.com/ggstuart/greenview/issues/4

*Permanent 'Temporary failure in name resolution' after running for a number of hours

A: I think this happens when you get in a "too many open files" condition. Next time this happens, try to see how many file descriptors your script has open.

A: The root cause is that /etc/resolv.conf is only read at python startup. To force a refresh of the resolve table, you can run this (on Linux):
import ctypes
libc = ctypes.cdll.LoadLibrary('libc.so.6')
res_init = libc.__res_init
res_init()


text:
Q: append and prepend text to a string I want to be able to search for a certain word in a string, and append and prepend characters to every instance of that word.
example:
I like cats, cats are awesome! I wish I had cats!

becomes:
I like (cats), (cats) are awesome! I wish I had (cats)!

I know I could use
str_replace( 'cats', '(cats)', $string );

but I would have to write "cats" twice.
I want a method that only requires me to write it once.

A: $search = 'cats';
preg_replace('/' . preg_quote($search, '/') . '/', '($0)', $string);

Paraphrased from the preg_replace documentation:

The replacement string may contain references of the form $n. Every such reference will be replaced by the text captured by the n'th parenthesized pattern. $0 refers to the text matched by the whole pattern.

A: use a preg_replace() with back references: http://php.net/manual/en/function.preg-replace.php
preg_replace("/cats/smi","($0)",$string);

A: You commented:

I have a huge plain text list of values I need to parenthesize, and I
  wanted to make it easier to write the code.

Since you're going to be doing many replacements (expensive cpu-wise), and you're wanting to simply shorten your coding time, why not also save CPU by wrapping str_replace()?
function str_wrap($needle,$prefix,$suffix,$haystack) {
    return str_replace($needle, $prefix . $needle . $suffix, $haystack);
}

Per the PHP manual:

If you don't need fancy replacing rules (like regular expressions),
  you should always use [str_replace()] instead of preg_replace().


text:
Q: How do I save all the buffers in vimscript? I am writing a function in vimscript that needs to save all changed, listed buffers that start with current working directory. This operation needs to happen in the background, without changing the current active buffer or a cursor position, if possible.
function! SaveChangedBuffers()
    for buf in getbufinfo({'buflisted':1})
        if but.changed && buf.name =~ getcwd()
           echo buf.name
           "write buf.name <-- how to do this correctly?
        endif
    endfor
endfunction

I wasn't able to find a function in vimscript that actually saves the buffer. I know I can supply a filename to :write or use a few other options. But I want to make sure I am actually writing all the buffers in a "vim native way" so I don't overwrite or disrupt any other operations or files.
What is the "vim native" way to write a list of buffers to disk from vimscript?

A: Looks like I was able to achieve my stated goal with the following:
function! SaveChangedBuffers()
    set lazyredraw
    let cur_buffer = bufnr('%')
    for buf in getbufinfo({'buflisted':1})
        if buf.changed && buf.name =~ getcwd()
           execute 'buffer' . buf.bufnr
           update
           " echo buf.name
        endif
    endfor
    execute 'buffer' . cur_buffer
    set nolazyredraw
endfunction

lazyredraw turns off screen changes while script is running. On slower terminal connections you might not even need that. I then remember the current buffer with bufnr('%') and restore it at the end of the script from the variable.
The loop just changes into each buffer that fits the criteria and performs :update (which could also be :write, because I know my buffer has been changed).
And to complete the full vim experience one can map it to an Ex command (Wc stands for "write changed"):
command! Wc execute SaveChangedBuffers()


text:
Q: How to init a NSMapTable with a value of block by swift When i use NSMapTable, a trouble make me unhappy,I do
[self.map setObject:block forKey:key]
in obj-c is OK,But when I do
map.setObject(block as! AnyObject, forKey: key)
in Swift, I get an error

Could not cast value of type '() -> ()' (0x15d9a604) to
  'Swift.AnyObject' (0x15d7335c)

How can i fix it when used NSMapTable? I don't want to use Dictionay , because the key is complex.

A: A block is not an object. Wrap your block in a class, then assign your block to the class as a property.
class MyClass {
   let block: Void -> Void
}

[self.map setObject:myClass forKey:key]


text:
Q: Program crashes with array declaration I've got a weird problem. Here's my code:
#include <iostream>
#include "opencv2/opencv.hpp"
#include <stdint.h>

using namespace cv;

int main()
{
Mat img = imread("testbild.jpg", CV_LOAD_IMAGE_UNCHANGED);

Mat imgGray = imread("testbild.jpg", CV_LOAD_IMAGE_GRAYSCALE);

if (img.empty())
{
    std::cout << "Kein Bild gefunden!" << std::endl;
}

//This array isn't used for while but I will use it in the future
int intensity[imgGray.rows] [imgGray.cols];

int max;

for (int r = 0; r <= imgGray.rows; r++)
{
    for (int c = 0; c <= imgGray.cols; c++)
    {

        if (max < (int)imgGray.at<uint8_t> (r,c))
        {
            max = (int)imgGray.at<uint8_t> (r,c);
        }

    }
}

std::cout << max << std::endl;

return 0;
}

The thing is, cout is not working. I don't know why. But whenever I comment out the line
int intensity[imgGray.rows] [imgGray.cols];

It works again.
I know that this line isn't used yet, but I'll use it later.
Why does this happen? I'm new to programming so please don't be mad, if it's a really simple answer. I also already used Google to find a solution, but all I got is to flush the output, and that doesn't work.
The console opens by the way, but all it says is "Press  to close this window...".

A: The reason is you can't declare your array like this when the size is not constant. You need to assign it dynamically.
One way to do it is:
int** intensity; //double pointer used to make 2D array
intensity = new int*[imgGray.rows]; //The double pointer now points to an array of single pointer.
for (int i = 0; i < imgGray.rows; ++i) //for each pointer in the array, create an array of integer, effectively a 2D array.
    intensity[i] = new int[imgGray.cols];

After that, you can access individual value in the 2D array by intensity[i][j] but it is your job to make sure it never goes out of bound and you need to free the memory yourself after finish with it. (Unless you are closing the program immediately after that then it is fine)


text:
Q: Unable to execute grunt file I am new bee to gruntjs , i am facing small issues. pls dont mark as -ve .Thanks people
I have the following code in Gruntfile.js
    module.export = funtion(grunt){
    grunt.registerTask('default',"", function(){
    grunt.log.write("Tis a  a task ");
    });
    };

i am trying to execute the above js file from cmd prompt as follows and it throws the following error.
D:\vkishore\Demo\Condo_gruntjsDemo>grunt
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected token {
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.


text:
Q: Practical physics problem about distance between lines. I am a software engineer and I'm developing a soccer game. I have a solution for this problem based on Newton law and I'm using Newton method to solve the equation I got. I'm here because I think there may be a better solution for this problem, but I'm not sure how to start. I need guidance more than a solution. I believe can study anything that could lead to a solution. I took a very basic Physics approach, so I'm posting this question in Mathematics to see if I get ideas far from what I thought.
So here is the problem: imagine one soccer player passing the ball to another. This one player will kick the ball and it will make a parabolic trajectory.  He will kick the ball to a determined point where the second player (receiver) is not; the second player will run to it, with a constant speed.
For simplicity, I'm taking the ball as a particle, no air resistance, and infinite acceleration for the player. You can make other simplifications for the things I don't see.
The ball trajectory can be split in two movements, one horizontal uniform motion and one vertical simple harmonic motion.
The question is: what is the velocity that should be applied to the ball so the player and the ball will get to the same point at the same time? That is, how should the player kick the ball so the other player can perfectly intercept the ball?
I made an equation D that is the difference of distance between the receiver and ball when the receiver got to the interception point, and solved for D = 0.
The kick has minimum and maximum angulations, so depending where the receiver is, there may not be a solution for the equation. I had to plot the equation to see the limits and adjust the Newton algorithm to converge and to converge fast, since it'll have to find a solution in runtime. It did not end up very well. I need another approach.
I used basic Newton equations, but I thought I could use linear algebra, Closest Point of Approach, to end up with a simpler, literal solution.  Or that I could model the ball and player motion in a set of differential equations that could be numerically solved without the ugly manipulations I had to make, and could be used to solve other problems of the game (more generic solution).

A: If the second play has velocity $v_2$ metres/second and has to run a distance $d_2$ metres then this will take time $t=d_2/v_2$ seconds.
So if the ball has to travel a horizontal distance $d_1$ metres, it needs a horizontal velocity $v_{horiz}=d_1/t$ metres/second.  Meanwhile it needs a vertical velocity which means it is at ground level after $t$ seconds and at that stage its vertical velocity has reversed.  So $-v_{vert}=v_{vert}-gt$ where $g$ is the gravitational acceleration (about $9.8$ metres/second$^2$), so $v_{vert}=gt/2$ metres/second.
So the initial speed of the ball combines the horizontal velocity and vertical velocities and is $$\sqrt{v_{horiz}^2+v_{vert}^2} =  \sqrt{\left(\frac{d_1}{t}\right)^2+\left(\frac{g\, t}{2}\right)^2} = \sqrt{\left(\frac{d_1 v_2}{d_2}\right)^2+\left(\frac{g \, d_2}{2v_2}\right)^2} \text{ metres/second}.$$
The tangent of the angle at which the ball has to be kicked is $v_{vert}/v_{horiz}$ so the angle is $$\tan^{-1}\left(\frac{g \, d_2^2}{2 d_1 v_2^2}\right).$$

A: At time $t=0$ the shooter is at the origin $O$, and the second player is at the point $A:=(a,0)$, $a>0$. The shooter chooses a horizontal direction ${\bf u}:=(\cos\phi,\sin\phi)$, an inclination angle $\theta$ with respect to the horizontal, and an initial velocity $v_0>0$. If $\phi=0$ then the trajectory of the ball can be written as
$$t\mapsto\bigl(v_0\cos\theta\ \ t\ , 0\ , v_0\sin\theta\ \ t -{g\over2}t^2\bigr)\qquad(t\geq 0) .$$ Therefore the flying time $t$ of the ball is  given by $$t={2v_0\sin\theta\over g}\ ,$$
and the ball will land at the point $B:=r{\bf u}$ at distance
$$r={v_0^2\sin(2\theta)\over g}$$
from the origin.
The second player has his own velocity $v_2$, and in the available time interval of length $t$ he can run the distance $d=v_2 t$. If he is required to arrive at $B$ at the same time as the ball the law of cosines, applied to the triangle $AOB$, gives the equation $d^2=a^2+r^2-2 a r\cos\phi$, or
$$\sin^2(2\theta) v_0^4 - 2\bigl(a g\sin(2\theta)\cos\phi+2v_2^2\sin^2\theta\bigr)v_0^2 + a^2g^2=0\ .$$
This is the only condition I can see. Given $a$, $g$ and $v_2$, the parameters available to the shooter are $v_0$, $\theta$ and $\phi$, and he has to choose them in such a way that this condition is met.


text:
Q: Relationship between special RSA modulus and quadratic residue in CL (Camenisch-Lysyanskaya) signature I'm studying the CL(Camenisch-Lysyanskaya) signature ("A signature scheme with efficient protocol proposed by Camenisch-Lysyanskaya").
However, I cannot understand the relationship between special RSA modulus and quadratic residue.

What is relationship between Special RSA modulus and quadratic residue?
and please recommend the references about special rsa modulus.
Thank you for your help.


text:
Q: Difference between instantons and sphalerons What is the difference between instantons and sphalerons? If they are different, how do they violate baryon and lepton number in the standard electroweak theory?

A: The sphaleron is kind of the opposite of the instanton, and kind of the same. Let's make that statement precise:
An instanton is a local minimum of the action that mediates vacuum tunneling (link to an answer of mine how and why instantons do that). The sphaleron sits in-between the vacua, in a certain sense, it is the instanton "in the middle of tunneling":
Given an instanton configuration $A_\text{inst}$ on a 4-cylinder $(-\infty,\infty) \times S^3$, representing tunneling between two vacua at the spatial slices at $t = \pm \infty$ with Chern-Simons winding numbers differing by 1, the sphaleron is vaguely the field configuration $A(t = 0)$, and precisely the field configuration for which, at some time $t_0$, the winding number as the integral of the Chern-Simons form
$$ \int_{{t_0} \times S^3}\omega \equiv \int_{{t_0} \times S^3} \mathrm{tr}(F\wedge A - \frac{1}{3}A \wedge A \wedge A) $$
is exactly the mean of the winding numbers of the vacua at the ends.
The idea is that an instanton of winding number 1 mediates between vacua of winding numbers $k$ and $k+1$, and that the sphaleron is the field configuration "in the middle", with winding number $\frac{2k+1}{2}$. The reason this is interesting is because, for example, in the electroweak theory, the bosonic potential part of the action is (of course) minimal for the vacuum/instanton configurations, and maximal for the sphaleron configuration. That's why the sphaleron is called that (it's Greek for slippery thing) - it may slip down into either vacuum configuration because it is sitting in a metastable extremum of the potential.


text:
Q: Java sockets: multiple client threads on same port on same machine? I am new to Socket programming in Java and was trying to understand if the below code is not a wrong thing to do. My question is:
Can I have multiple clients on each thread trying to connect to a server instance in the same program and expect the server to read and write data with isolation between clients"
public class Client extends Thread
{
    ...
    void run()
    {
        Socket socket = new Socket("localhost", 1234);
        doIO(socket);
    }
}

public class Server extends Thread
{
    ...
    void run()
    {
        // serverSocket on "localhost", 1234
        Socket clientSock = serverSocket.accept();
        executor.execute(new ClientWorker(clientSock));
    }
}

Now can I have multiple Client instances on different threads trying to connect on the same port of the current machine?
For example,
   Server s = new Server("localhost", 1234);
   s.start();
   Client[] c = new Client[10];
   for (int i = 0; i < c.length; ++i)
   {
        c.start();
   }

A: As long as you only have one object trying to bind the port for listening, then there's no problem with multiple clients connecting.

A: Yes, however only one client will be able to connect per thread execution as written.
You can just put your server run() inside a while true loop to let multiple clients connect.
Depending on the executor, they will execute either in series or parallel.
   public class Server extends Thread
   {
       ...
       void run()
       {
           while(true){
              // serverSocket on "localhost", 1234
              Socket clientSock = serverSocket.accept();
              executor.execute(new ClientWorker(clientSock));
           }
       }
   }

A: In this example, your Server accepts and handles one client connection at a time.  You can have as many Clients as you want attempting to connect, but only one at a time will be handled.
It is not apparent whether your executor logic is multithreaded, since you didn't provide the implementation.  If the executor delegates to a threadpool or something like that, you would need to make sure that your ClientWorker is thread-safe, as you will have multiple instances executing in parallel.
I am of course assuming that your Client is thread-safe as well, since your question is only concerning the Server.

A: Yes, it doesn't matter whether your clients are local or remote. The important thing in your example is that ClientWorker is thread-safe, as your server will have multiple instances of that class (one for each client connection).

A: So. To begin:
You can accept more clients with one serversocket, because you accept only one in the run-method. You have just to call accept() a second time.
Then, you in your for loop: first you have to create each time a new Client object. Then you can call c[i].start(); and not c.start().

Now can I have multiple Client
  instances on different threads trying
  to connect on the same port of the
  current machine?

Yes you can. Just create new Threads and run them. This should work perfectly.

expect the server to read and write
  data with isolation between clients

You can use your experience of the basic IO techniques like with file-io:
OutputStream os = socket.getOutputStream();
PrintStream pw = new PrintStream(os, true); // Or PrintWriter, I don't know what the best one is.
pw.println("Hello, other side of the connection!");

And for reading use a BufferedReader.

A: You can try something on these lines
public class MultiThreadServer extends Application {
  // Text area for displaying contents
  private TextArea ta = new TextArea();

  // Number a client
  private int clientNo = 0;

  @Override // Override the start method in the Application class
  public void start(Stage primaryStage) {
    // Create a scene and place it in the stage
    Scene scene = new Scene(new ScrollPane(ta), 450, 200);
    primaryStage.setTitle("MultiThreadServer"); // Set the stage title
    primaryStage.setScene(scene); // Place the scene in the stage
    primaryStage.show(); // Display the stage

    new Thread( () -> {
      try {
        // Create a server socket
        ServerSocket serverSocket = new ServerSocket(8000);
        ta.appendText("MultiThreadServer started at "
          + new Date() + '\n');

        while (true) {
          // Listen for a new connection request
          Socket socket = serverSocket.accept();

          // Increment clientNo
          clientNo++;

          Platform.runLater( () -> {
            // Display the client number
            ta.appendText("Starting thread for client " + clientNo +
              " at " + new Date() + '\n');

            // Find the client's host name, and IP address
            InetAddress inetAddress = socket.getInetAddress();
            ta.appendText("Client " + clientNo + "'s host name is "
              + inetAddress.getHostName() + "\n");
            ta.appendText("Client " + clientNo + "'s IP Address is "
              + inetAddress.getHostAddress() + "\n");
          });

          // Create and start a new thread for the connection
          new Thread(new HandleAClient(socket)).start();
        }
      }
      catch(IOException ex) {
        System.err.println(ex);
      }
    }).start();
  }

  // Define the thread class for handling new connection
  class HandleAClient implements Runnable {
    private Socket socket; // A connected socket

    /** Construct a thread */
    public HandleAClient(Socket socket) {
      this.socket = socket;
    }

    /** Run a thread */
    public void run() {
      try {
        // Create data input and output streams
        DataInputStream inputFromClient = new DataInputStream(
          socket.getInputStream());
        DataOutputStream outputToClient = new DataOutputStream(
          socket.getOutputStream());

        // Continuously serve the client
        while (true) {
          // Receive radius from the client
          double radius = inputFromClient.readDouble();

          // Compute area
          double area = radius * radius * Math.PI;

          // Send area back to the client
          outputToClient.writeDouble(area);

          Platform.runLater(() -> {
            ta.appendText("radius received from client: " +
              radius + '\n');
            ta.appendText("Area found: " + area + '\n');
          });
        }
      }
      catch(IOException e) {
        ex.printStackTrace();
      }
    }
  }

  /**
   * The main method is only needed for the IDE with limited
   * JavaFX support. Not needed for running from the command line.
   */
  public static void main(String[] args) {
    launch(args);
  }
}


text:
Q: read txt file with javascript in sharepoint i'm trying to read text file that content this :
<p> copyright 2016 ..... </p>

from a file text in sharepoint library:URL
https://mydomaine.sharepoint.com/sites/sitecollection/mysite/assets/footer.txt
using javascript and inject it in my html master page in  the footer <footer></footer>
any solution?

A: Accessing the contents of a text file is relatively straightforward using an XMLHttpRequest object.
(function(){
    var serverRelativeUrlOfMyFile = "/sites/sitecollection/mysite/assets/footer.txt";
    var req = new XMLHttpRequest();
    req.onreadystatechange=handler;
    req.open("GET", serverRelativeUrlOfMyFile, true); // params: (method, url, async)
    req.send();
    function handler(){
        if(req.readyState == 4 && req.status == 200){
            // you can now access the file content via the responseText property
            document.querySelector("footer").innerHTML = req.responseText;
        }
    }
})();

The above code is roughly equivalent to the following jQuery:
var serverRelativeUrlOfMyFile = "/sites/sitecollection/mysite/assets/footer.txt";
$.ajax({
    url: serverRelativeUrlOfMyFile,
    type: "GET"
}).done(handler);
function handler(data){
    $("footer").html(data);
}


text:
Q: Multiple Prop Checks in Styled Components I know that in styled-components, I can do a check for a prop like this:
${props => { if (props.size)...return...
However, from what I can tell if I want to do a second prop check, then I need to start all over again:
${props => { if (props.color)...return...
What I am wondering is if there is a way to do just one ${props... with different returns for different cases?
If so, any idea how?
Thanks.

A: You can simplify a little by accessing the props object up front. There's a little less repetition this way.
const StyledComponent = styled.div(
  (props) => `
    background-color: green;

    ${props.warn && `
      background-color: yellow;
    `}

    ${props.alert && `
      background-color: red;
    `}

  `
);

A: I prefer to keep my css separate, like in a styles.js file. Take the following code for example. It keeps the css organized, and makes implementing the different options pretty clean. Of course, add your css into the appropriate definitions
//styles.js
import { css } from 'styled-components';

export const buttonbase = css`/*base styles for all buttons*/`;
export const small = css`/*small size styles*/`;
export const medium = css`/*default size styles*/`;
export const large = css`/*large size styles*/`;
export const floating = css`/*float styles*/`;

And in your component file:
//Button.js
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import * as Styles from './styles';

const propTypes = {
  floating: PropTypes.bool,
  size: PropTypes.oneOf(['small', 'medium', 'large']),
  children: PropTypes.node,
};

const defaultProps = {
  floating: false,
  size: 'medium',
};

const ButtonBase = styled.button`
  ${Styles.buttonbase};
  ${props => (props.floating ? Styles.floating : '')};
  ${props => Styles[props.size]};
`;

const Button = ({ floating, size, children, ...rest }) => (
  <ButtonBase
    size={size}
    floating={floating}
    {...rest}
  >
    {children}
  </ButtonBase>
);

Button.propTypes = propTypes;
Button.defaultProps = defaultProps;

export default Button;

A: Theres a package called styled-is that can help you do this in a clean and nice way.


text:
Q: Strange Text Placement on Android 5.0 Lollipop due to android.graphics.Paint.getTextSize() Here are a few images I will reference in my post: http://imgur.com/a/rSD57.
Right now, I am following the "Android Game Programming for Dummies" book to develop a simple 'Whack A Mole' android app, and I encountered a strange error. When I run the app on an emulator running Android 2.1, the text that indicates the number of moles "whacked" and the number of moles "missed" is placed correctly (first image).
However, when I run the app on my phone (a Samsung Galaxy S5 Active running Android 5.0), only the bottommost pixel of the text appears at the top of the screen (second image).
I think the root of the problem is here:
    private void draw (Canvas canvas) {
        try {
            canvas.drawBitmap(backgroundImg, 0, 0, null);
            if(!onTitle) {
                canvas.drawText("Whacked: " + Integer.toString(molesWhacked), 10, blackPaint.getTextSize()+10,
                        blackPaint);
                canvas.drawText("Missed: " + Integer.toString(molesMissed), screenW - (int)(200*drawScaleW),
                        blackPaint.getTextSize()+10, blackPaint);

Here is a link to my source code:
WhackAMoleView.java: http://pastebin.com/ymMW2CUb
I have tried debugging the y position of the text with system.out.println statements, and what I have found is that adding "getTextSize()" to "10" returns "NaN." Since getTextSize() returns a float, I have tried converting 10 into a float by typing "10.0f," but the addition still returns "NaN." Strangely, if I change the y position of the "whack" text to:
canvas.drawText("Whacked: " + Integer.toString(molesWhacked), 10, (float)(blackPaint.getTextSize()+10.0),
                        blackPaint);

The "whack" text starts displaying properly (third image), but if I change it for both the "whack" and the "miss" texts:
canvas.drawText("Whacked: " + Integer.toString(molesWhacked), 10, (float)(blackPaint.getTextSize()+10.0),
                        blackPaint);

canvas.drawText("Missed: " + Integer.toString(molesMissed), screenW - (int)(200*drawScaleW),
                        (float)(blackPaint.getTextSize()+10.0), blackPaint);

Both texts disappear once again (fourth image).
My question is: What is going on, and how can I fix it?
I know this is a lot of code, but I will highly appreciate any suggestions!
EDIT:
I just ran it on an emulator running Android 5.1.1, and the text placement was correct. I am beginning to think this is the result of hardware acceleration optimizations...


text:
Q: What is a good back-end to use with AngularJS I want to know your suggestions about a good back-end to use with AngularJS as a front-end.
Why is your suggested back-end good and is it easy to use, or easy to learn?

A: The back-end is up to you to choose, all back-ends should interact the same with Angular JS its more about what you are comfortable or more experienced with.
You have plenty of choices to look into:
Python: Flask and Django
Javascript: Node JS
Ruby: Ruby on Rails
PHP
Each will have their learning curves and pitfalls.

A: I'm biased and I recommend Go because it is able to handle huge amounts of concurrent requests and fast (5000 and up) without consuming too many resources.
However jumping between 2 languages can be painful but in the end will give you a broader understanding of programming. So if you'd like not to switch languages remain with the express framework and node.js since that's where also all the tutorials are, MEAN stack for instance (mean.io)

A: There is considerable risk in this question for opinion-based answers, so I suggest a more critical evaluation:
Restful server-side implemenations
... Will make working with angular considerably easier and less painful as well as being true to the HTTP spec with all the good things that entails. In any language that you choose ensure that the framework allows for the minimum of effort in doing this.
In my experience:
PHP:
Vanilla PHP and Codeigniter are capable but poor at doing this, I suggest avoiding them. I cannot speak for Symfony and the larger ORM-based frameworks, but I understand the learning-curve to be non-trivial. I strongly suggest staying away from CMS applications like wordpress and drupal as this kind of thing is not their purpose.
I understand that Laravel may offer a reasonably low learning curve and is has the understanding of RESTFul interfaces baked in.
NodeJS
NodeJS offers a very large number of frameworks for the server-side with Express and its variants being the apparent base for many of them. Express offers the flexibility to create RESTful interfaces, but does not do this by default. For more syntactic sugar it is usually necessary to wire up your own middleware.
Ruby on Rails
From what I understand there is considerable support for RESTful apis with rails.
Database support
PHP
Vanilla PHP mysqli Support for databases works, but is too low-level for use. CodeIgnighter, Symfony, Lavel and other frameworks all offer the necessary abstraction and security for working with the database to varying degrees. Differentiating between them on this is largely a matter of taste. PHP frameworks may struggle for support for NoSQL type newer databases.
NodeJS
Express Supports all major forms of databases with appropriate middleware with literally thousands of options from the NPM repositories. As usual, you will have to wire them up to express yourself with varying degrees of difficulty.
Ruby on Rails
Rails supports the active-record pattern which offers both security and ease of use out of the box. This supports the majority of popular standard relational databases. I cannot speak for its integration for NoSQL databases however.
Learning curve
This is too subjective for me to say much other than a few pitfalls: the NodeJS community expects a fairly high degree of skill to get started and the callback hell problem is sufficiently large to be a serious barrier to learner server-side development.
Security
PHP
Vanilla PHP offers little security and is not recommended. Codeigniter, Laravel and the other frameworks offer some protection with string-escaping and protection against SQL injection attacks at least.
NodeJS
Express doesn't offer too many security features out-of the box but can be hardened with modules like helmet. This is not a deficiency so much as a reflection of the unopinionated nature of the application.
Rails
I understand Rails offers basic SQL injection protection through Active Record and CSRF protection among other features out of the box.
Personally: I use Koa (an application to supersede express) for my own server-side dev in working with angular. My legacy projects use CodeIgnighter.

A: (disclaimer: I'm Ruby on Rails developer)
I believe Ruby on Rails is pretty good to use as json backend.
You can easily found a lot of materials and screencast about integrating it with angular, like:

*

*http://railscasts.com/episodes/405-angularjs

*http://angular-rails.com/bootstrap.html
And building proper JSON api with Rails can be helpful for creating mobile app etc, there also very good material about crafting good Rails RESTful Api, f.e.:

*

*https://www.codeschool.com/courses/surviving-apis-with-rails


text:
Q: How can I upload or delete files to multi-ftp servers Is there a program for upload or delete files to multi-ftp servers.
eg.

Ftp sites:
  ftp.a-site.com
  ftp.another-site.com

Command:
  DELETE a-file From All FTP SITES
Or:
  DELETE a-file or selected-file From all-selected-sites

A: You can use a scriptable FTP client such as ncftp
e.g. WIndows
for %s in (example.com example.org example.net) do ncftpput %s docroot misima.jpg

Similar for Linux bash


text:
Q: HTML5 Canvas ImageData incorrect rgb values I'm working on a paint bucket tool for a drawing application.
I'm using context.getImageData to find out the color values for all the pixels in the canvas.
However, it seems that by default all the rgba values are 0, even though the canvas is white by default. Now my paint bucket tool doesn't work on shapes outlined with black because black has the rgb 0,0,0 and the default canvas image data does as well, even though the canvas is white.
So my question is whether or not I can change the default image data so that it is reflective of the canvas' actual default color (white, or, 255,255,255), or how to quickly clear the canvas to that color. A solution I see being possible but incredibly inefficient is, when clearing the canvas, to set every single pixel's values to 255. This causes a couple seconds of lag when performed, though, because of the size of the canvas.
Are there any other alternatives that I am overlooking? Thanks.

A: An empty canvas is initialized to rgba(0,0,0,0) (i.e. transparent)
If you want everything to be initialized to white, run something like this.
ctx.fillStyle = '#FFFFFF'; // or 'rgba(255,255,255,1)'
ctx.fillRect(0,0,canvas.width, canvas.height);

For reference in the spec it says:

When the canvas is initialized, its bitmap must be cleared to transparent black.


text:
Q: Port 8080 required by Tomcat v8.0 Server at localhost is already in use I download tomcat on eclipse and it was working fine. but 1 month later I tryed to run it again and I got an error for some reason
ERROR:
Port 8080 required by Tomcat v8.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
What I have tried:
Seem to be tomcat is already running...
#1: I tried going on http://localhost:8080/ but I dont got a welcome screen but I get a login in popup... I didn't have a username or password

#2:  I click on startup.bat -> shutdown.bat -> run tomcat in eclipse. but no luck
#3: I check the 'Task Manager' but didn't see Tomcat.exe running.
#4: I tried the netstat command and I got the following results. than I use the taskkill... maybe I use the wrong taskkill id. can some one double check it?
C:\Users\dave>netstat -aon

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       1320
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:1521           0.0.0.0:0              LISTENING       3100
  TCP    0.0.0.0:1522           0.0.0.0:0              LISTENING       4024
  TCP    0.0.0.0:5500           0.0.0.0:0              LISTENING       4024
  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       3100
  TCP    0.0.0.0:49664          0.0.0.0:0              LISTENING       1044
  TCP    0.0.0.0:49665          0.0.0.0:0              LISTENING       1676
  TCP    0.0.0.0:49666          0.0.0.0:0              LISTENING       688
  TCP    0.0.0.0:49667          0.0.0.0:0              LISTENING       2380
  TCP    0.0.0.0:49671          0.0.0.0:0              LISTENING       1116
  TCP    0.0.0.0:49687          0.0.0.0:0              LISTENING       1148
  TCP    0.0.0.0:49697          0.0.0.0:0              LISTENING       3220
  TCP    0.0.0.0:49705          0.0.0.0:0              LISTENING       4208
  TCP    127.0.0.1:1522         0.0.0.0:0              LISTENING       4024
  TCP    127.0.0.1:1522         127.0.0.1:49706        ESTABLISHED     4024
  TCP    127.0.0.1:2031         0.0.0.0:0              LISTENING       4040
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11028
  TCP    127.0.0.1:5354         0.0.0.0:0              LISTENING       2976
  TCP    127.0.0.1:49668        0.0.0.0:0              LISTENING       2868
  TCP    127.0.0.1:49674        0.0.0.0:0              LISTENING       3100
  TCP    127.0.0.1:49706        127.0.0.1:1522         ESTABLISHED     4208
  TCP    192.168.2.10:139       0.0.0.0:0              LISTENING       4
  TCP    192.168.2.10:11316     0.0.0.0:0              LISTENING       6600
  TCP    192.168.2.10:49787     209.10.120.24:80       CLOSE_WAIT      2672
  TCP    192.168.2.10:49917     216.58.219.234:443     ESTABLISHED     9884
  TCP    192.168.2.10:52540     193.85.216.236:80      ESTABLISHED     2672
  TCP    192.168.2.10:52600     65.52.108.205:443      ESTABLISHED     6500
  TCP    192.168.2.10:52619     173.194.66.125:5222    ESTABLISHED     9884
  TCP    192.168.2.10:55224     216.58.219.238:443     ESTABLISHED     8520
  TCP    192.168.2.10:55262     74.125.22.95:443       ESTABLISHED     9884
  TCP    192.168.2.10:55265     74.125.29.91:443       ESTABLISHED     8520
  TCP    192.168.2.10:55266     172.217.4.206:443      ESTABLISHED     8520
  TCP    192.168.2.10:55271     216.58.219.237:443     ESTABLISHED     9884
  TCP    [::]:135               [::]:0                 LISTENING       1320
  TCP    [::]:445               [::]:0                 LISTENING       4
  TCP    [::]:1521              [::]:0                 LISTENING       3100
  TCP    [::]:1522              [::]:0                 LISTENING       4024
  TCP    [::]:5500              [::]:0                 LISTENING       4024
  TCP    [::]:8080              [::]:0                 LISTENING       3100
  TCP    [::]:49664             [::]:0                 LISTENING       1044
  TCP    [::]:49665             [::]:0                 LISTENING       1676
  TCP    [::]:49666             [::]:0                 LISTENING       688
  TCP    [::]:49667             [::]:0                 LISTENING       2380
  TCP    [::]:49671             [::]:0                 LISTENING       1116
  TCP    [::]:49687             [::]:0                 LISTENING       1148
  TCP    [::]:49697             [::]:0                 LISTENING       3220
  TCP    [::]:49705             [::]:0                 LISTENING       4208
  TCP    [::1]:2031             [::]:0                 LISTENING       4040
  TCP    [::1]:49672            [::]:0                 LISTENING       4024
  TCP    [::1]:49955            [::]:0                 LISTENING       1952
  TCP    [fe80::394e:2f21:75ae:9f92%13]:1521  [fe80::394e:2f21:75ae:9f92%13]:49691  ESTABLISHED     3100
  TCP    [fe80::394e:2f21:75ae:9f92%13]:49691  [fe80::394e:2f21:75ae:9f92%13]:1521  ESTABLISHED     3220
  TCP    [fe80::394e:2f21:75ae:9f92%13]:54211  [fe80::394e:2f21:75ae:9f92%13]:54213  ESTABLISHED     3220
  TCP    [fe80::394e:2f21:75ae:9f92%13]:54212  [fe80::394e:2f21:75ae:9f92%13]:54214  ESTABLISHED     3220
  TCP    [fe80::394e:2f21:75ae:9f92%13]:54213  [fe80::394e:2f21:75ae:9f92%13]:54211  ESTABLISHED     3100
  TCP    [fe80::394e:2f21:75ae:9f92%13]:54214  [fe80::394e:2f21:75ae:9f92%13]:54212  ESTABLISHED     3100
  UDP    0.0.0.0:3702           *:*                                    988
  UDP    0.0.0.0:3702           *:*                                    988
  UDP    0.0.0.0:5353           *:*                                    2248
  UDP    0.0.0.0:5355           *:*                                    2248
  UDP    0.0.0.0:49664          *:*                                    2976
  UDP    0.0.0.0:58538          *:*                                    988
  UDP    127.0.0.1:1900         *:*                                    1704
  UDP    127.0.0.1:56478        *:*                                    1704
  UDP    192.168.2.10:137       *:*                                    4
  UDP    192.168.2.10:138       *:*                                    4
  UDP    192.168.2.10:1900      *:*                                    1704
  UDP    192.168.2.10:5353      *:*                                    2976
  UDP    192.168.2.10:11316     *:*                                    6600
  UDP    192.168.2.10:56477     *:*                                    1704
  UDP    [::]:3702              *:*                                    988
  UDP    [::]:3702              *:*                                    988
  UDP    [::]:5353              *:*                                    2248
  UDP    [::]:5355              *:*                                    2248
  UDP    [::]:49665             *:*                                    2976
  UDP    [::]:58539             *:*                                    988
  UDP    [::1]:1900             *:*                                    1704
  UDP    [::1]:56476            *:*                                    1704
  UDP    [fe80::394e:2f21:75ae:9f92%13]:1900  *:*                                    1704
  UDP    [fe80::394e:2f21:75ae:9f92%13]:56475  *:*                                    1704

C:\Users\dave>taskkill /F /PID 3100
ERROR: The process with PID 3100 could not be terminated.
Reason: Access is denied.

A: I can quickly think of 2 possibilities from your question/comments -

*

*You have installed tomcat at two different locations (1 used by Eclipse and other tomcat source) Usually developers download tomcat to
  run standalone Java applications irrespective of IDEs.

*process javaw.exe (OR java.exe sometimes) running in your machine. Also, process might be added in startup programs so every time you
  start machine, it is started. Try to end this process from task
  manager and then restart Eclipse. You should get tomcat running.

If none of above works, I insist you to create another Workspace in Eclipse and add tomcat there to run your application.
Hope this helps.

A:
Step 1: (open the CMD command)

 C:\Users\username>netstat -o -n -a | findstr 0.0:8080

 TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 3116

 Now , we can see that LISTENING port is 3116 for 8080 ,

 We need to kill 3116 now

Step 2:-

 C:\Users\username>taskkill /F /PID 3116

Step 3:

Go to Eclipse and start Server , it will run

OR

you can change port number in folder  servers>Tomcat>server.xml

A: Open Command prompt with run as administrator and type taskkill /F /PID 3100
then it will terminate the process
https://i.stack.imgur.com/Co5Tg.png -- screenshot for Access is denied
https://i.stack.imgur.com/JwZTv.png -- screenshot for successfully terminated


text:
Q: how to retrieve data from DB using AJAX I want to retrieve data from DB to my user Dashboard. User Identify using Contact No.
I run AJAX query to retrieve all adds. its running well.
but I need to retrieve data under his user ID (ContactNo). here I add AJAX code.
user data avaiable in AUTH -> {{ Auth::user()->ContactNo }}

$(document).ready(function($){
  //alert("jquery running");
  getAll();

});

  //getting all rows from the database
    function getAll() {

        $.ajax({
            url: '{{ route('Myadds', app()->getLocale()) }}',
            type: 'GET',

        })
        .done(function(data) {
      alert("run")
        $.each(data, function(index, val) {
             $('#data').append('
')
             $('#data').append(''+val.id+'	')
             $('#data').append(''+val.Sdescription+'	')
             $('#data').append(''+val.created_at+'	')
             $('#data').append('<button class="btn btn-xs btn-danger" data-id="'+val.id+'">Delete</button><button class="btn btn-xs btn-info" data-id="'+val.id+'">Edit</button>	')
             $('#data').append('
')
        });
        })
        .fail(function() {
      alert("fail")
            console.log("error");
        })

    }

</script>

A: You need to pass de contactNo parameter in your query:

  function getAll() {

        $.ajax({
            url: '{{ route('Myadds', app()->getLocale()) }}',
            type: 'GET',
            data: {
              contact_no: contactNo,
            },
        })
        .done(function(data) {
        alert("run")
        $.each(data, function(index, val) {
             $('#data').append('
')
             $('#data').append(''+val.id+'	')
             $('#data').append(''+val.Sdescription+'	')
             $('#data').append(''+val.created_at+'	')
             $('#data').append('<button class="btn btn-xs btn-danger" data-id="'+val.id+'">Delete</button><button class="btn btn-xs btn-info" data-id="'+val.id+'">Edit</button>	')
             $('#data').append('
')
        });
        })
        .fail(function() {
      alert("fail")
            console.log("error");
        })

    }

So in your controller now you can filter:

public function getData(Request $request){
     $contact_no = $request->contact_no;

     $query = DB::table('my_table');

     if($contact_no){
        $query->where('contact_no',$contact_no)
     }

    return response()->json($query->get());
}

Or directly use the session of the user:

public function getData(Request $request){
     $contact_no = Auth::user()->ContactNo;

     $query = DB::table('my_table');

     $query->where('contact_no',$contact_no)

    return response()->json($query->get());
}

A:     public function Myadds(){

        try{
            return add::where('userID', Auth::user()->ContactNo)->get();

        }catch(Exception $e){
            return 'false';
        }
        }