text:
Q: Apport is preventing me from upgrading my system, how do I fix it? When I run sudo apt-get update && sudo apt-get dist-upgrade -y I get the following error
(Reading database ... 135000 files and directories currently installed.)
Preparing to unpack .../apport_2.20.1-0ubuntu2.15_all.deb ...
Failed to stop apport-forward.socket: Unit apport-forward.socket not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead ...
Failed to stop apport-forward.socket: Unit apport-forward.socket not loaded.
dpkg: error processing archive /var/cache/apt/archives/apport_2.20.1-0ubuntu2.15_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 5
/usr/bin/deb-systemd-helper: error: unable to read apport-forward.socket
Failed to get unit file state for apport-forward.socket: No such file or directory
apport-forward.socket is a disabled or a static unit, not starting it.
Errors were encountered while processing:
 /var/cache/apt/archives/apport_2.20.1-0ubuntu2.15_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

What can I do to fix this?

A: The best thing you can do is to remove the package (uninstall it) that is causing the problem, here some examples:

*

*How to remove/install a package that is not fully installed?

*How to uninstall plex from ubuntu (You're not having problems with plex, but the error message is the same, so it could be a good idea to have a look at it).

After removing the package that is causing the problem, you can update your system and finally re-install the package if required.
Hope this helps.


text:
Q: Properties of functions with $0$ second partial derivatives I have a $n$-dimensional polynomial that I am evaluating on some domain $\Omega \subset \mathbb{R^n}$
$$
f:\Omega\rightarrow \mathbb{R}
$$
where I know that all the second partials are zero
$$
\dfrac{\partial^2 f}{\partial x_k^2} \equiv0
$$
however, the mixed partials may be non-zero.
It is easy to see that this function is harmonic as $\nabla^2f = 0$. From this we get lots of results, such as the minima $m$ and maxima $M$ is on the boundary: $m,M\in \partial\Omega$.
This condition that all second derivatives seems stronger than being harmonic though, so I was wondering if there was a name / other properties relating to functions like this.
Thank you!

A: These polynomials are called multilinear. They are sometimes called polynomials of max degree $1$ (as opposed to total degree $1,$ which would mean affine.)
They come up naturally in Fourier analysis on $\{-1,1\}^n$: the Fourier transform passes between the representation of a multilinear polynomial by its values on $\{-1,1\}^n$ and the values of its coefficients.
They also come up in things like the polynomial method, Schwartz-Zippel lemma, and related results. The important property here is that if a multilinear polynomial $p$ is zero on a grid of the form $\{a_1,b_1\}\times\dots\times\{a_n,b_n\}$ with $a_i\neq b_i$ for each $i,$ then $p$ is identically zero.
Since you have an algebraic property of polynomials, the restriction to $\Omega$ is irrelevant. But it is true that any distribution on a domain $\Omega$ satisfying $\partial^2 f/\partial x_k^2=0$ must be a multilinear polynomial.
Another property, perhaps only interesting to me: they are "nonzero at one of their multi-indices". By this I mean that if $p$ is a non-zero multilinear polynomial, there exist $\alpha_1,\dots,\alpha_n\in\{0,1\}$ such that $p(\alpha_1,\dots,\alpha_n)\neq 0$ and the $x_1^{\alpha_1}\dots x_n^{\alpha_n}$ coefficient of $p$ is non-zero. Specifically, we can take $(\alpha_1,\dots,\alpha_n)$ to be minimal in the product order on $\{0,1\}^n,$ such that the coefficient $c$ of $x_1^{\alpha_1}\dots x_n^{\alpha_n}$ is non-zero. This gives $p(x_1^{\alpha_1},\dots,x_n^{\alpha_n})=c.$

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to check if compound proposition is contradiction (is always false)? I know how to check compound proposition if it is tautology with TautologyQ[]. But I have not found any function that can check if the compound proposition is contradiction (is always false). Is there any similar way (like with tautology, without generating truth tables) to check if a compound proposition is a contradiction or not?
For example, how can I check if compound proposition p && !p is a contradiction or not?

A: Resolve[Exists[p, p && ! p == True]]

(*
False
*)
You can interpret this result as:  "There does not exist any p such that the statement p && !p is True.
Background example:
Resolve[Exists[{p, q}, (p && ! p == True || q == True)]]

(*
True
*)
You can interpret this result to say:
It is true that there exists some p and q such that both p and !p are True OR q is True.  The key claus here is the OR.  Certainly there exists some q for which q is True.

A: The converse of tautology (negation of tautology) is a contradiction. More about it here:  proofwiki.org/wiki/Contradiction_is_Negation_of_Tautology
So to find out if the proposition is a contradiction we can negate the proposition and after check the result if it is the tautology. If the output is True it means that the proposition is contradiction because as we mentioned above the negation of a contradiction is a tautology. If the output is False, that means that the proposition is not contradiction and it can be tautology or contingency.
For example, if we want to check if p && ! p is a contradiction (which it is) we use code:
TautologyQ[Not[p && ! p], {p}]

Output:

True

A: I also found another way:
"In a complete logic, a formula is contradictory if and only if it is unsatisfiable". Source
In that case, we can check if the proposition is satisfiable and after negate the result. If the output is Truethat means that the original statement was unsatisfiable which also means that it was contradiction. If the output was False it means that the result was satisfiable, which means that it was tautology or contingency.

For example, lets check if p && !p is contradiction:
Not[SatisfiableQ[p && ! p, {p}]]

output:

True

It means that p && !p is contradiction.

Lets check if p || ! p is contradiction:
Not[SatisfiableQ[p || ! p, {p}]]

output:

False

It means that p || ! p is not contradiction. The output does not say that but it is tautology.

Lets check if p && q is contradiction:
Not[SatisfiableQ[p && q, {p, q}]]

output:

False

It means that p && q is not contradiction. The output does not say that but it is contingency.


text:
Q: Rellenar un formulario PDF (las celdas del formulario) a través de Windows Forms en .NET 5 (C#) automáticamente Estoy buscando alguna forma para rellenar un formulario de un documento PDF a través de una aplicación en Windows Forms, en .NET 5. He buscado alguna forma de hacerlo pero no encuentro nada para conseguirlo. Me gustaría rellenar el formulario PDF de manera automática, por ejemplo, pulsando un botón en mi aplicación, etc. ¿habría forma de hacerlo? La verdad es que no consigo encontrar nada.

A: Creo haber dado con la solución, veamos:
private void metodoLlenadoPDF()
    {
        //desde aquí, llamamos al fichero PDF que deseas rellenar
        string pdfTemplate = @"D:Datos1.pdf";
        //esta será la salida del nuevo fichero que se crea una vez rellenado
        string newFile = @"D:Datos2.pdf";

        //creamos el objeto PdfReader, te pedirá instalar la librería
        PdfReader pdfReader = new PdfReader(pdfTemplate);
        //ejecutamos el proceso
        PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(
                    newFile, FileMode.Create));

        AcroFields pdfFormFields = pdfStamper.AcroFields;

        //Rellenamos los campos del PDF, ojo, aquí necesitas saber como se llaman, los míos son "Text1", "Text2", ...
        pdfFormFields.SetField("Text1", "Menganito");
        pdfFormFields.SetField("Text2", "Fulanito");
        pdfFormFields.SetField("Text3", "12.3456789-F");
        pdfFormFields.SetField("Text4", "Su Ciudad");

        //Creamos un String con un mensaje de confirmación
        string sTmp = "Datos asignados";
        //lo lanzamos
        MessageBox.Show(sTmp, "Terminado");

        // Cambia la propiedad para que no se pueda editar el PDF
        pdfStamper.FormFlattening = false;

        // Cierra el PDF
        pdfStamper.Close();
    }


text:
Q: Can length contraction help the moving observer reach a star system 'faster'? Would an observer moving with close to the speed of light ($\sim 99\%$) towards a star system that's $20$ light years away perceive the distance as being less than $20$ light-years? If yes, how much time would elapse in their frame of reference given the aforementioned speed of $.99c$ and $20$ light-years distance?

A: Yes, you can travel to a star system 20 light years away while aging far less than 20 years. In the star's frame, that's because you're experiencing time dilation. In your frame, it's because the distance to the star is length contracted. The two are, of course, completely equivalent.
Specifically, the length is contracted by a factor of $1/\sqrt{1-v^2/c^2}$, which in your case is $7$. That means you arrive at the star system in about $20/7$ years.

A: Sort of.
In the observer's frame of reference, they observe the star system moving towards them at a speed of $v\approx$, across a contracted distance of $d^\prime={d\over\gamma}$, which takes a time of $\frac{d}{\gamma v}\approx 2.8~\rm yr$. But there is no time dilation from their point of view, since they are moving with a velocity $0$ with respect to themselves.
Meanwhile, from an outsider's point of view, the spacecraft travels over a non-contracted distance $d=20~\rm lyr$, which takes a time of $d\over v$, but with time dilation this is again $d\over \gamma v$ in the spacecraft's rest frame.
In other words, time dilation and distance contraction are just two different ways of looking at the same thing. The spacecraft sees the star arrive in $2.8~\rm yr$ due to length contraction, whereas to an outside observer it takes the spacecraft $20~\rm yr$ of their time, from which they can determine it takes the spacecraft $2.8~\rm yr$ of proper time due to time dilation.

A:
Would an observer moving with close to the speed of light (~99%)
  towards a star system that's 20 light years away perceive the distance
  as being less than 20 light years?

Yes, and you can find the formula for length contraction online in many places, pick the one you like the most.
It should be remembered, however, that only the people on the ship would believe the trip took less time. Observers back on Earth would still see it take ~20 years.
Not that you would care... I'd be happy to get to Alpha Centauri in time for cocktails, I don't mind that's is past bedtime back on Earth!


text:
Q: phpmyadmin I am trying to create a "category" table on my localhost server using PhpMyAdmin Query that I have used is:

DROP TABLE IF EXISTS `category`;
CREATE TABLE IF NOT EXISTS `category` (
  `category_id` int(11) NOT NULL AUTO_INCREMENT,
  `category_name` varchar(50) NOT NULL,
  `category_status` enum('0','1') NOT NULL,
  PRIMARY KEY (`category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `category`
--

INSERT INTO `category` (`category_id`, `category_name`, `category_status`) VALUES
(1, 'Flu & Cold', '1'),
(2, 'Vitamins & Supplements', '1'),
(3, 'Chickenpox', '0');

This query executes successfully initially but when I tend to browse the  table,
this error shows up
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS category ( category_id int(11) NOT NULL AUT...' at line 2
enter image description here
I am using xampp 8.1.4-1.
But I  can view the structure of the table
enter image description here

A: SELECT * FROM category

shows all the rows of the category table.
I figured this is not an error.[Even though I cannot access the category table inside the PHPMYADMIN. ]
Thanks.
Any suggestions are welcomed.


text:
Q: Yet Another MultiLine Group Regex Query So I'm trying to write a regex to filter text files for specific snippets (looking for speed rather than brute force).
I want to get three things from each match:

*

*a key to identify a snippet

*an optional language to format each snippet

*the value which represents all rows between the start and end tags

This is the regex (a failing test harness can be found here - https://gist.github.com/shiftkey/5236161):
(?s)code start (?<key>[A-Za-z-]*) (?<language>[A-Za-z]*).*[\n](?<value>.*?)[\n].*end code (?<key>[A-Za-z-]*)
Using these options: RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline.
So a file like this:
// code start foo csharp
var x = 1;
// end code foo

Gives me the expected values:

*

*key: foo

*language: csharp

*value: var x = 1;
But when I introduce a snippet with a second row I only get the last row:
// code start foo csharp
var x = 1;
var y = 2;
// end code foo

*

*key: foo

*language: csharp

*value: var y = 2;
Instead of

*

*value: var x = 1;\r\nvar y = 2; (or similar)

What have I missed with getting groups to cover multiple lines?
I've looked at similar scenarios raised on SO but they haven't worked for my usage.

A: This can be worked-around by changing the greediness of two .*s:
(?s)code start (?<key>[A-Za-z-]*) (?<language>[A-Za-z]*).*?[\n](?<value>.*)[\n].*?end code (?<key>[A-Za-z-]*)

The .* after reading the language must be less greedy, because we need the content after the first new-line as the snippet value. However, the .* for parsing value can be more greedy, because it's not supposed to stop upon meeting the first \n, hence the above pattern.

A: If you want you can do the catch with some lookaround stuff as well...
(?<=code\sstart\s)(?<key>\b\w+\b)\s(?<language>\b\w+\b).*\r\n(?<content>(?s).*)(?=\r\n.*end\scode\s\1\s-->)


text:
Q: Trying to do a LEFT JOIN, but ending up getting empty result I tried doing a LEFT JOIN (the one on the image second of the left). So basically I want all records from table A without the records from table B, so I want to take only the information from table B that crosses with table A. There is more info like book details in table B that I want to be able to extract, but I don't need of the rows from table B, just the extra info. I figure the best way to do this is with LEFT JOIN and this is the code I tried, but it result in a empty string/result:
SELECT WF.*, W.* FROM WalletFrom AS WF LEFT JOIN Wallet AS W ON W.BookID = WF.BookID WHERE WF.BookID = 1360 AND W.BookID IS NULL
What I am doing wrong?
Columns from Wallet:
 WalletID
UserID
BookID
OrderID
WalletStatusID
Win
WalletProductID
Columns from WalletFrom:
OrderID
BookID
Count
Win
WinTotal
Tax
WinEnd
DateTime
WalletProductID

A: According to what you say in the comments, this sounds like inner join.
SELECT *
FROM TableA
INNER JOIN TableB ON TableA.BookID = TableB.BookID
WHERE TableA.BookiD = 1360

this gives you all the records from tableA that have a corresponding row in TableB without extra rows from TableB.
Ceck if this is what you need
Update
SELECT *
FROM Students AS S
INNER JOIN Grades AS G ON s.StudentId = G.StudentId
WHERE S.ClassId = 1360

A: You get empty result, because of W.BookID IS NULL clause, which is guaranteed to be not null by left join and its condition.
If you want only recrods from WalletFrom with BookId existing in Wallet, you could use below query:
SELECT * FROM WalletFrom wf
WHERE EXISTS(SELECT 1 FROM Wallet
             WHERE BookId = wf.BookId)

A: What I end up needing to do is just add an AND cause to my JOIN cause like this
SELECT WF.*, W.* FROM WalletFrom AS WF LEFT JOIN Wallet AS W ON W.BookID = WF.BookID AND W.OrderID = WF.OrderID WHERE WF.BookID = 1360

In order to not get duplicated records/rows. Thanks for everyone who have answer my questions you helped me to figure this out


text:
Q: Asp.net MVC 2.0 TempData expiration What happens in Asp.Net MVC 2.0, when next request does not come ever to retrieve value from TempData. Is it stored permanently or expires?

A: As TempData is stored in session it will expire along with the session. Also note that TempData is not expired when it is retrieved but on the next request no matter whether you access it or no.


text:
Q: Windows batch command for multiple folders creation 0001 - 1000 I need to create folders named 0001 to 1000 using a batch command.
Folder names should be all 4 digits, ie: 0001, 0002, 0999 - 1000.
I've already tried this command line:
for /L %%g in (1,1,1000) do (md %%g)

A: You could also try the following (in a batch file):
setlocal enabledelayedexpansion
for /l %%i in (1,1,1000) do set n=0000%%i& echo !n:~-4!

This gives
0001
0002
0003
...


text:
Q: Selenium WebDriver's SendKeys too slow to fill in  input I'm having an issue that SendKeys is too slow. I need to add around 1300 lines to textarea

<textarea id="ctl00_phMainContent_KeywordForm_ControlPanel_txtKeywords" onload="CountLines(this);" onkeypress="CountLines(this);" wrap="off" cols="100" rows="6" name="ctl00$phMainContent$KeywordForm$ControlPanel$txtKeywords"></textarea>

The thing is my login to the website expires and I have to re-login and do that again infinite loop...

Can anyone help me how to appeand the text (lines) Instantly? maybe some Javascript? or Ctrl+c + Ctrl+v? Anyone have a working code?

A: You can run JavaScript code in the context of browser opened by a WebDriver.
Use JavaScript evalution to modify HTML DOM tree directly and set <textarea> value.
Evaluating JavaScript in Selenium (Python):
Getting the return value of Javascript code in Selenium
Setting <textarea> value in JavaScript:
 document.getElementById("ctl00_phMainContent_KeywordForm_ControlPanel_txtKeywords").value = "Foobar"


text:
Q: Calculate the user's age in days java Task: It is necessary to calculate the user's age, in days, hours, minutes. Enter a date of birth and today's date.
It seems like, age calculates correctly, but in days there is not the right figure. How to calculate the difference between dates in days?
import java.util.Scanner;

class Solution {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int day;
        int year;
        int month;
        int day2; //today
        int year2; //today's year
        int month2; //today's month
        do {
            System.out.print("Enter the year of birth: ");
            year = scanner.nextInt();
        } while (year < 1000 || year > 2019);

        do {
            System.out.print("Enter the month of birth: ");
            month = scanner.nextInt();
        } while (month < 1 || month > 12);

        do {
            System.out.print("Enter the day of birth: ");
            day = scanner.nextInt();
        } while (day < 1 || day > 31);

        do {
            System.out.print("Enter today's year: ");
            year2 = scanner.nextInt();
        } while (year2 < 1000 || year2 > 2019);

        do {
            System.out.print("Enter today's month: ");
            month2 = scanner.nextInt();
        } while (month2 < 1 || month2 > 12);

        do {
            System.out.print("Enter today: ");
            day2 = scanner.nextInt();
        } while (day2 < 1 || day2 > 31);

        int year_leap;
        int[] month_day = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            year_leap = 366;
            month_day[1] = 29;
        } else {
            month_day[1] = 28;
            year_leap = 365;
        }

        int userYear = 0;
        int userMonth;
        int userDay;

        if (year <= year2) {
            userYear = year2 - year;
        } else System.out.printf("Error!!! %n");

        if (month > month2) {
            userYear--;
            userMonth = month2 + 12 - month;
        } else userMonth = month2 - month;

        if (day > day2) {
            userMonth--;
            userDay = day2 + month_day[userMonth] - day;
        } else userDay = day2 - day;

        int day_year = 0;
        int day_month = 0;
        int day_age = 0;

        while (year < year2 - 1) {

            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
                year_leap = 366;
                month_day[1] = 29;
            } else {
                year_leap = 365;
                month_day[1] = 28;

            }
            year++;
            day_year = day_year + year_leap;
        }

        day_month = month_day[1] * userMonth + userDay; // 31 days in a month
        day_age = day_year + day_month;

        System.out.printf("------------------------------------ %n");
        System.out.println("Your age: " + userYear + "." + userMonth + "." + userDay);
        System.out.println("Your in days:" + day_age);

    }
}

Found the necessary algorithm on Python. Tell me how to implement it in Java?
def dateIsBefore(year1, month1, day1, year2, month2, day2):
return (year1, month1, day1) < (year2, month2, day2)

def daysBetweenDates(year1, month1, day1, year2, month2, day2):
assert not dateIsBefore(year2, month2, day2, year1, month1, day1)
days = 0
while dateIsBefore(year1, month1, day1, year2, month2, day2):
    days += 1
    year1, month1, day1 = nextDay(year1, month1, day1)
return days

A: Use the API provided by Java:
LocalDate now = LocalDate.now();
LocalDate birthDate = LocalDate.of(1975, 7, 19);

long days = ChronoUnit.DAYS.between(birthDate, now);
System.out.println("days = " + days);

A: You can calculate
eg:
Date date1 =
Date date2 =
long diff = date2.getTime() - date1.getTime();
System.out.println ("Days: " + TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS));

OR
float days = (diff / (1000*60*60*24));

A: Your year_leap = 364; for non leap years should be equal to 365 and 366 for leap years.
This line day_month = month_day[1] * userMonth + userDay; is always using 29 as month_day[1] is always referring to February.
Also if it is not mandatory to do the calculations yourself look at the suggested API`s as they give you much better functionality.


text:
Q: Open string interactions implies closed string I am currently reading Polchinski page 81, and am not 100% clear with the explanation given regarding why any open string theory necessarily contains closed strings.
It is stated, quoted from page 81:

Consider the interactions in figures 3.4(a) and (b), but time reversed: respectively two open strings joining into one, and an open to closed string transition. Near the interaction point these are the same, two endpoints coalescing. To have the first interaction without the second would require some nonlocal constraint on the dynamics of the string; this would surely be inconsistent. One can make the same argument with figures 3.4(c) and (d), where the interaction is locally the reconnection of a pair of strings. So if any open string interaction is allowed, then so is some process in which closed strings are produced from open strings.

He also gives an argument in the paragraph above which I don't quite understand. In particular, in this case, why exactly would having the first interaction without the second require a nonlocal constraint and why would this be inconsistent?
Could someone please explain in more detail the explanations from these two paragraphs?

A: You have two string ends coming together, in either case. The ends joining don't know if they are two separate open strings, or if they are joined at the other end. the only way the string would "know" would be some sort of non-locality that tells two ends, before they join, if they are already joined at the other end.
Why would this be inconsistent? That's generally how non-locality works.


text:
Q: Expand a variable with spaces for printf My script constructs variables into a given order depending on a table to be printed.  But if there are any spaces in the end string, printf treats it as a separate column.  Imagine the following:
one=1
two="2 3"
all="$one $two"
format="%5s%5s"
printf $format $all

How can the printf command understand the variables passed in $all properly?  I know they are being expanded and that printf is seeing it just as a single string, but I can't find a way to get it to work where there are spaces in a variable like there are in $four.

A: It can't, as written. You can't selectively treat some spaces as word splitting and others as not in a parameter expansion. You can, however, use an array to preserve the non-word-splitting spaces.
one=1
two="2 3"
all=( "$one" "$two" )
format="%5s%5s"
printf "$format" "${all[@]}"

A: You should store the two values in an array rather than a string.
one=1
two="2 3"
all=("$one" "$two") # array with 2 elements
format="%5s%5s"
printf "$format" "${all[@]}" # quoting the array expansion properly passes two args


text:
Q: object passed by controller not found in jsp page i'm working on a simple spring mvc web application i have :
a simple controller :
public class LoginController extends MultiActionController {
    private final static String VIEW_LOGIN = "/login";

    public ModelAndView handleLogin(HttpServletRequest request,
            HttpServletResponse response){
        ModelAndView mv = new ModelAndView(VIEW_LOGIN);
        String prova = "PROVA123";
        mv.addObject(prova);
        return mv;
    }
}

a simple jsp page:
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <title>Login - Gestione Studenti</title>

<c:out value="${prova}"/>

this is the dispatcher servlet xml file
<bean id="loginController" class="it.mediosoft.gestionestudenti.web.LoginController">
        <property name="methodNameResolver" ref="handlerResolver"/>
    </bean>

    <bean id="urlMapping"
        class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="/login.html">loginController</prop>
            </props>
        </property>
    </bean>

    <bean id="handlerResolver"
        class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
        <property name="mappings">
            <props>
                <prop key="/login.html">handleLogin</prop>
            </props>
        </property>
    </bean>
     <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
        <property name="prefix"><value>/WEB-INF/jsp/</value></property>
        <property name="suffix"><value>.jsp</value></property>
    </bean>

why in login.jsp can't i use the object that loginController return in ModelAndView ?
the "c:out" doesn't print anything....any advice ?

A: try with:
mv.addObject("prova",prova);

that should solve your issue


text:
Q: BizTalk & WCF Service: Couldn't find type for class System Diagnostics.TextWriterTraceListener? I created a simple orchestration to call a WCF service and get response from it. Web service method is very simple:
string GetSimple(int value)
BizTalk monitors a folder and receives activation message using FILE adapter from there, then constructs proper message and calls the web service. But fails with this exception:

Error Description: System.Configuration.ConfigurationErrorsException: Couldn't find type for class System Diagnostics.TextWriterTraceListener.

Server stack trace:
    at System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData)
    at System.Diagnostics.TypedElement.BaseGetRuntimeObject()
    at System.Diagnostics.ListenerElement.GetRuntimeObject()
    at System.Diagnostics.ListenerElement.GetRuntimeObject()
    at System.Diagnostics.ListenerElementsCollection.GetRuntimeObject()
    at System.Diagnostics.TraceSource.Initialize()
    at System.Net.Logging.InitializeLogging()
    at System.Net.Logging.get_On()
    at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
    at System.Net.WebRequest.Create(Uri requestUri)
    at System.ServiceModel.Channels.HttpChannelFactory.GetWebRequest(EndpointAddress to, Uri via, NetworkCredential credential, TokenImpersonationLevel impersonationLevel, AuthenticationLevel authenticationLevel, SecurityTokenProviderContainer proxyTokenProvider, SecurityTokenContainer clientCertificateToken, TimeSpan timeout)
    at System.ServiceModel.Channels.HttpChannelFactory.GetWebRequest(EndpointAddress to, Uri via, SecurityTokenProviderContainer tokenProvider, SecurityTokenProviderContainer proxyTokenProvider, SecurityTokenContainer clientCertificateToken, TimeSpan timeout)
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.GetWebRequest(EndpointAddress to, Uri via, SecurityTokenContainer clientCertificateToken, TimeoutHelper& timeoutHelper)
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.GetWebRequest(EndpointAddress to, Uri via, TimeoutHelper& timeoutHelper)
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.BeginSendRequest(Message message, TimeSpan timeout)
    at System.ServiceModel.Channels.RequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
    at System.ServiceModel.Dispatcher.RequestChannelBinder.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
    at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartSend(Boolean completedSynchronously)
    at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.Begin()
    at System.ServiceModel.Channels.ServiceChannel.BeginCall(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, TimeSpan timeout, AsyncCallback callback, Object asyncState)
    at System.ServiceModel.Channels.ServiceChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
    at System.ServiceModel.Channels.ServiceChannel.BeginRequest(Message message, AsyncCallback callback, Object state)

Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at System.ServiceModel.Channels.IRequestChannel.BeginRequest(Message message, AsyncCallback callback, Object state)
    at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendRequestMessage(IBaseMessage bizTalkMessage, IRequestChannel channel)
    at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)

Exception type: XlangSoapException
Source: Microsoft.XLANGs.BizTalk.Engine
Target Site: Void VerifyTransport(Microsoft.XLANGs.Core.Envelope, Int32, Microsoft.XLANGs.Core.Context)
The following is a stack trace that identifies the location where the exception occured

    at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.VerifyTransport(Envelope env, Int32 operationId, Context ctx)
    at Microsoft.XLANGs.Core.Subscription.Receive(Segment s, Context ctx, Envelope& env, Boolean topOnly)
    at Microsoft.XLANGs.Core.PortBase.GetMessageId(Subscription subscription, Segment currentSegment, Context cxt, Envelope& env, CachedObject location)
    at Orch.Orc.segment1(StopConditions stopOn)
    at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)

I couldn't find TextWriterTraceListener. Where is it? How to get rid of this exception?

A: It seems there's a problem with the config file of the WCF service or BTSNtSvc.exe.config. BizTalk seems to be sending the correct request.
Most likely, your config around logging messages from WCF is having issues or BTSNtSvc.exe.config having incorrect parameters around logging.
You may want to call the service from standard .net client to narrow down the problem.
HTH


text:
Q: How can I truncate the text contents of an Element while preserving HTML? I realize that there are several similar questions here but none of the answers solve my case.
I need to be able to take the innerHTML of an element and truncate it to a given character length with the text contents of any inner HTML element taken into account and all HTML tags preserved.
I have found several answers that cover this portion of the question fine as well as several plugins which all do exactly this.
However, in all cases the solution will truncate directly in the middle of any inner elements and then close the tag.
In my case I need the contents of all inner tags to remain intact, essentially allowing any "would be" truncated inner tags to exceed the given character limit.
Any help would be greatly appreciated.
EDIT:
For example:
This is an example of a link inside another element
The above is 51 characters long including spaces.  If I wanted to truncate this to 23 characters, we would have to shorten the text inside the  tag.  Which is exactly what most solutions out there do.
This would give me the following:
This is an example of a
However, for my use case I need to keep any remaining visible tags completely intact and not truncated in any way.
So given the above example, the final output I would like, when attempting to truncate to 23 characters is the following:
This is an example of a link
So essentially we are checking where the truncation takes place.  If it is outside of an element we can split the HTML string to exactly that length.  If on the other hand it is inside an element, we move to the closing tag of that element, repeating for any parent elements until we get back to the root string and split it there instead.

A: It sounds like you'd like to be able to truncate the length of your HTML string as a text string, for example consider the following HTML:
'foo bar'

In this case the HTML is 14 characters in length and the text is 7. You would like to be able to truncate it to X text characters (for example 2) so that the new HTML is now:
'fo'

Disclosure: My answer uses a library I developed.
You could use the HTMLString library - Docs : GitHub.
The library makes this task pretty simple. To truncate the HTML as we've outlined above (e.g to 2 text characters) using HTMLString you'd use the following code:
var myString = new HTMLString.String('foo bar');
var truncatedString = myString.slice(0, 2);
console.log(truncatedString.html());

EDIT: After additional information from the OP.
The following truncate function truncates to the last full tag and caters for nested tags.
function truncate(str, len) {
    // Convert the string to a HTMLString
    var htmlStr = new HTMLString.String(str);

    // Check the string needs truncating
    if (htmlStr.length() <= len) {
        return str;
    }

    // Find the closing tag for the character we are truncating to
    var tags = htmlStr.characters[len - 1].tags();
    var closingTag = tags[tags.length - 1];

    // Find the last character to contain this tag
    for (var index = len; index < htmlStr.length(); index++) {
        if (!htmlStr.characters[index].hasTags(closingTag)) {
            break;
        }
    }

    return htmlStr.slice(0, index);
}

var myString = 'This is an example ' +
    'of a link ' +
    'inside another element';

console.log(truncate(myString, 23).html());
console.log(truncate(myString, 18).html());

This will output:
This is an example of a link
This is an example of a link inside

A: Although HTML is notorious for being terribly formed and has edge cases which are impervious to regex, here is a super light way you could hackily handle HTML with nested tags in vanilla JS.
(function(s, approxNumChars) {
  var taggish = /<[^>]+>/g;
  var s = s.slice(0, approxNumChars); // ignores tag lengths for solution brevity
  s = s.replace(/<[^>]*$/, '');  // rm any trailing partial tags
  tags = s.match(taggish);

  // find out which tags are unmatched
  var openTagsSeen = [];
  for (tag_i in tags) {
    var tag = tags[tag_i];
    if (tag.match(/<[^>]+>/) !== null) {
      openTagsSeen.push(tag);
    }
    else {
      // quick version that assumes your HTML is correctly formatted (alas) -- else we would have to check the content inside for matches and loop through the opentags
      openTagsSeen.pop();
    }
  }

  // reverse and close unmatched tags
  openTagsSeen.reverse();
  for (tag_i in openTagsSeen) {
    s += ('<\\' + openTagsSeen[tag_i].match(/\w+/)[0] + '>');
  }
  return s + '...';
})

In a nutshell: truncate it (ignores that some chars will be invisible), regex match the tags, push open tags onto a stack, and pop off the stack as you encounter closing tags (again, assumes well-formed); then close any still-open tags at the end.
(If you want to actually get a certain number of visible characters, you can keep a running counter of how many non-tag chars you've seen so far, and stop the truncation when you fill your quota.)
DISCLAIMER: You shouldn't use this as a production solution, but if you want a super light, personal, hacky solution, this will get basic well-formed HTML.
Since it's blind and lexical, this solution misses a lot of edge cases, including tags that should not be closed, like , but you can hardcode those edge cases or, you know, include a lib for a real HTML parser if you want. Fortunately, since HTML is poorly formed, you won't see it ;)

A: You've tagged your question regex, but you cannot reliably do this with regular expressions. Obligatory link. So innerHTML is out.
If you're really talking characters, I don't see a way to do it other than to loop through the nodes within the element, recursing into descendant elements, totalling up the lengths of the text nodes you find as you go. When you find the point where you need to truncate, you truncate that text node and then remove all following ones — or probably better, you split that text node into two parts (using splitText) and move the second half into a display: none span (using insertBefore), and then move all subsequent text nodes into display: none spans. (This makes it much easier to undo it.)

A: Thanks to T.J. Crowder I soon came to the realization that the only way to do this with any kind of efficiency is to use the native DOM methods and iterate through the elements.
I've knocked up a quick, reasonably elegant function which does the trick.
function truncate(rootNode, max){
    //Text method for cross browser compatibility
    var text = ('innerText' in rootNode)? 'innerText' : 'textContent';

    //If total length of characters is less that the limit, short circuit
    if(rootNode[text].length <= max){ return; }

    var cloneNode = rootNode.cloneNode(true),
        currentNode = cloneNode,
        //Create DOM iterator to loop only through text nodes
        ni = document.createNodeIterator(currentNode, NodeFilter.SHOW_TEXT),
        frag = document.createDocumentFragment(),
        len = 0;

    //loop through text nodes
    while (currentNode = ni.nextNode()) {
        //if nodes parent is the rootNode, then we are okay to truncate
        if (currentNode.parentNode === cloneNode) {
            //if we are in the root textNode and the character length exceeds the maximum, truncate the text, add to the fragment and break out of the loop
            if (len + currentNode[text].length > max){
                currentNode[text] = currentNode[text].substring(0, max - len);
                frag.appendChild(currentNode);
                break;
            }
            else{
                frag.appendChild(currentNode);
            }
        }
        //If not, simply add the node to the fragment
        else{
            frag.appendChild(currentNode.parentNode);
        }
        //Track current character length
        len += currentNode[text].length;
    }

    rootNode.innerHTML = '';
    rootNode.appendChild(frag);
}

This could probably be improved, but from my initial testing it is very quick, probably due to using the native DOM methods and it appears to do the job perfectly for me.  I hope this helps anyone else with similar requirements.
DISCLAIMER:  The above code will only deal with one level deep HTML tags, it will not deal with tags inside tags.  Though it could easily be modified to do so by keeping track of the nodes parent and appending the nodes to the correct place in the fragment. As it stands, this is fine for my requirements but may not be useful to others.


text:
Q: C++, BTree Insert Hi this is a code from my SearchTree class.
Node* is a structure whith m_info type int, and m_left(smaller nodes by info) and m_right(bigger nodes by info)
void SearchTree::insert(const int &x) {
  Node* tempo = m_root;
  while (tempo != nullptr) {
    if (tempo->m_info >= x) {
      tempo = tempo->m_left;
    } else {
      tempo = tempo->m_right;
    }
  }
  tempo = new Node(x);
}

I am trying to insert a new node to the tree.
But looks like I am missing something in memory  management.
There tempo is a pointer to a new node, however it is not being related to m_root.
I am confused here. I really love the power of c++ but it bends my logic.
What am I missing here?

A: You keep advancing tempo until it is equal to nullptr. At this point you have left the tree and all you have in hand is a pointer into nothingness. Note that in particular the program has no way of determining which node you last visited that led to tempo becoming null.
What you need to do instead is stop one step earlier: While tempo is still pointing to a node, but the next step would make it point to null. Now you still have a valid node of the tree in your hand and can attach the newly allocated node to it.

A: You can't save the pointer in tempo only. Tempo is a copy of your current position in the tree. You have to assign it to actual variable.
My solution to this problem would be to check if child is nullptr before you iterate
void SearchTree::insert(const int &x) {
  if (!m_root) {
      m_root = new Node(x);
      return;
  }
  Node* tempo = m_root;
  while (true) {
    if (tempo->m_info >= x) {
      if (!tempo->m_left) {
        tempo->m_left = new Node(x);
        return;
      }
      tempo = tempo->m_left;
    } else {
      if (!tempo->m_right) {
        tempo->m_right = new Node(x);
        return;
      }
      tempo = tempo->m_right;
    }
  }
}

Also you should use smart pointers instead of raw pointers.
An alternative solution is a pointer to pointer. I didn't test it but you can try
void SearchTree::insert(const int &x) {
  Node** tempo = &m_root;
  while (*tempo) {
    if ((*tempo)->m_info >= x) {
      tempo = &(*tempo)->m_left;
    } else {
      tempo = &(*tempo)->m_right;
    }
  }
  *tempo = new Node(x);
}

In this image you can see. If you use Node* tempo = m_root then tempo contains a copy of the value in m_root. If you change tempo then m_root stays unchanged.
If you use Node** tempo = &m_root then tempo is pointer to m_root. You can change m_root through tempo.


text:
Q: why i cannot use chain expression in numpy? This don't work:
import numpy as np
np.random.random(10).sort()

this is ok:
Z = np.random.random(10)
Z.sort()

Please tell me why the chain expression don't work in Numpy.

A: Just like list.sort, numpy.ndarray.sort sorts in-place, meaning that it mutates the array and then returns None.
help(numpy.ndarray.sort) ->

sort(...)
      a.sort(axis=-1, kind='quicksort', order=None)
      Sort an array, in-place.

With
np.random.random(10).sort()

you won't see any output in the REPL because None is not displayed.
(Even if this line produced a value other than None, which it does not, it would be pretty pointless since you don't assign any name.)
In the second example, you create an array Z and then sort it, which works as expected.


text:
Q: Possible Bug in ArrayMesh Bug introduced in V10.4 and fixed in 10.4.1

Suppose we have the following array from which we intend to create an ArrayMesh:
arr = {{{1, 1, 1}, {1, 0, 1}, {1, 1, 0}}, {{1, 1, 1}, {0, 1, 1}, {1, 1,
   0}}, {{0, 1, 0}, {0, 1, 1}, {0, 0, 1}}};

If we create the ArrayMesh and use one of the styling Options in this case MeshCellStyle, the color is not evenly applied:
ArrayMesh[arr, MeshCellStyle -> {{2, All} -> Yellow}]

And as you manipulate this mesh object it flickers like crazy:

This does not happen if you use HighlightMesh to style it:
HighlightMesh[ArrayMesh[arr], {Style[2, Yellow]}]

.
Can anyone reproduce this behavior. Note that ArrayMesh is new in 10.4. I'm using Windows 10 64bit

A: This is an artifact in Graphics3D rendering (Z-fighting) which is generally difficult to avoid when using a depth buffer.
While ArrayMesh is new in 10.4, you would see similar behavior if you did copy and paste the result into an older version.
As a possible workaround, try
SetOptions[$FrontEnd,
   RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}]


text:
Q: SDK error in Visual Studio Community 2015 Upon rebuilding the solution to a file in Visual Studio exported from Construct 2 I received errors:
MSB3774 Could not find SDK "Microsoft.WinJS.2.0, Version-1.0"

MSB3774 Could not find SDK "Microsoft.WinJS.2.1, Version-1.0"

A: Open Visual Studio
Click File->New Project
Click Windows
Click Windows 8
There will be an option there to install the Windows 8.1 tools.


text:
Q: How should one manager external and internal DNS servers at the same time? We run a mac network here in the office. We have an internal DNS server to manage the network. Everything is resolved to a local ip (for mail.mydomain.com etc). However, we also have an external DNS server for when our users are not in the office. However, isn't it a pain to have to manage two lists? Whenever you change something you have to change another? And you can't have one be a slave of another because the ip are sometimes different (for example mail.mydomain.com would point to a local ip in local dns server but an external ip in the external dns server). Any tricks?

A: If you're running BIND on your public DNS server, you could configure it to perform what's known as "split DNS".  This is where queries from one location get one set of responses, and queries from another location get another set of responses.  Other DNS server implementations may support this as well, but there is an excellent howto for BIND which explains the details on how to configure it.
I'll amend that to say that when you configure BIND in this way, each "location" that you're splitting gets its own zone file, so you still have two lists to manage, but they're at least on the same server rather than different servers.

A: I am using djbdns because of this...
http://cr.yp.to/djbdns.html
http://cr.yp.to/djbdns/tinydns-data.html
It is hard to get it first, but it works well.


text:
Q: Python for loop iterating an already iterated item So I was trying to solve this leetcode problem:
Input: command = "G()(al)"
Output: "Goal"
Explanation: The Goal Parser interprets the command as follows:
G -> G
() -> o
(al) -> al
The final concatenated result is "Goal".
This is my code:
def interpret(command: str) -> str:

        res = ''

        for i in command:

            if i == 'G':
                res += i

            if i == '(':
                ind = command.index(i)
                if command[ind + 1] == ')':
                    res += 'o'
                if command[ind + 1] == 'a':
                    res += 'al'

        return res

The problem is, instead of returning 'Goal', the function returns 'Goo'. So I changed the function to the following to see what's going on:
for i in command:
            if i == '(':
                print(command.index(i))

And the above code prints out this
1
1

which means the loop is iterating an element twice?
What did I do wrong and how can I fix the function to return the correct output?

A: command.index() gives you the first occurrence of '('.
Rewrite your function as follows:
def interpret(command: str) -> str:

    res = ""

    for c, i in enumerate(command):

        if i == "G":
            res += i

        if i == "(":
            ind = c
            if command[ind + 1] == ")":
                res += "o"
            if command[ind + 1] == "a":
                res += "al"

    return res


text:
Q: MySQL LEFT JOIN AND ORDER BY ERROR? I'm working on some code and I came across some problems.
I have 2 tables "Table1" and "Table2" and I wanna combine both of them (LEFT JOIN). When I do everything works fine. But when I add ORDER BY at the end my website stops working for a few minutes.
The code:
SELECT table1.id, table2.id
FROM table1
    LEFT JOIN table2 ON table1.id=table2.id
ORDER BY table1.name
LIMIT 0, 20

for some reason this code crashes the server.
any help would be appreciated!


text:
Q: Flask Simple Question About Printing Strings with newline For Example, I am using the following code.
@app.route('/test', methods=['GET', 'POST'])
def test():
    if request.method == 'POST':
        test = request.form['test']
        print(test)
        print('\nprinted')

If I send the post request with a value containing newline '\n' the print method will not print the content with the new line but printing directly like this  "print('\nprinted')" will print the content with a new line.
Example: Sending data.
Request:
curl  http://127.0.0.1:9090/test -XPOST -d "test=\nhello"

Response:
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:9090
Press CTRL+C to quit
\nhello

printed

Is there any way to pass the data containing the newline and the result containing the actual newline?
Updated:
test = request.form['test']
print(test)

The desired output should look like this for the above code.
Input:
curl -XPOST -d 'test=\nhello' http://127.0.0.1:5000
Output:

hello

The hello should be printed after a newline.

A: I believe it's due to the way the input field value is handled. So it escapes the escape character, because it wants to keep the format of the input as exact as possible.
So the true values of your varaible is test = \\nhello
You can fix this like so:
test.replace("\\n", "\n") # "\\nhello" -> "\nhello"

Here we replace two escape characters with a single one

A: This is how I solved it for now.
counter = test.count("\\n")
test = counter * "\n" + test
print(test)


text:
Q: python: AttributeError: 'PDFPage' object has no attribute 'extractText' I am trying to extract the content from a pdf. and would like to create an excel sheet out of it. Please find the code below.
import pdfquery
pdf = pdfquery.PDFQuery('C:\\Users\\Santosh\\Downloads\\2017-San-Jamar-
Price-List-US-Z120913E-RevA.pdf')
page = pdf.get_page(3)
page_content = page.extractText()
print (page_content)

It throws the following error:
AttributeError                            Traceback (most recent call last)
<ipython-input-32-d6b615faa422> in <module>()
      1 page = pdf.get_page(3)
----> 2 page_content = page.extractText()
      3 print (page_content)

AttributeError: 'PDFPage' object has no attribute 'extractText'

Please let me know a possible solution.
Thanks.

A: use PyPDF2 instead of pdfquery
import PyPDF2
pdfFileObj = open('C:\\Users\\Santosh\\Downloads\\2017-San-Jamar-
Price-List-US-Z120913E-RevA.pdf','rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
page = pdfReader.getPage(3)
print(page.extractText())

A: I had also face the same issue. This is due to the non updated version of pypdf2 package installed already with other pdf reader dependencies. By reinstalling pypdf2 is resolved my error.
pip uninstall pypdf2
pip install pypdf2

This worked for me


text:
Q: List files with strings and then ALL files checked with powershell I want to search for all files, of .exe.config for certain strings.  I want to list the files with those strings and then list all of the files that were checked.  I can get it to find the files with the strings with:
Get-ChildItem -Path c:\ -I *.exe.config -R| Select-String 'string1','string2'

My issue, I can't figure out how to get it to show all the .exe.config files that it checked (without searching the computer again).   I thought I could save the intial search results into a variable. Then run through that with a for loop, but I can't even get the right info into a variable.  I tried several variations of below, but $files is always empty.  Also, I'm not sold on this approach, so if anyone has a completely different method, that would be fine
$files = (Get-ChildItem -Path c:\ -I *.exe.config -R).Path
$files = (Get-ChildItem -Path c:\ -I *.exe.config -R | select fullname)

A: Use the common -OutVariable parameter to capture Get-ChildItem's output in a variable of your choice, separately from what the pipeline overall outputs:
Get-ChildItem c:\ -Include *.exe.config -Recurse -OutVariable files |
  Select-String 'string1','string2'

Variable $file now contains all System.IO.FileInfo instances output by Get-ChildItem; note how you must pass the variable name without the $ sigil to -OutVariable.
A small caveat is that -OutVariable, as of PowerShell [Core] 7.0:

*

*collects multi-object output in a System.Collections.ArrayList instance rather than in a regular PowerShell array of type [object[]] (fixed-size array of System.Object instances).

*even collects single-object output that way (wrapped in a collection) - whereas direct pipeline output just emits the object itself.
See this answer for background information and a workaround.


text:
Q: Finding a formula for a series INDUCTION
11. Find a formula for $\sum_{i=1}^n \frac{1}{i(i+1)}$ and prove that it holds for all $n \geq 1$.

How does this relate from proofing this by induction and making a formula. Confused how you would find the formula. How can I approach this, or maybe give me an answer and show me how you did this in detail? Would really appreciate your help. Thanks.

A: Think about how you would use the fact that
$$\frac1{i (i+1)} = \frac1{i}-\frac1{i+1}$$
Write out individual terms in the sum using this formula and see what happens.


text:
Q: Check Php variables to proper MySql type (prepare for Insert query) If i'm going to query mysql with this:
mysql_query("INSERT INTO subscribers (email, referral_id, user_id, ip_address)
VALUES ('$user_email', '$user_refer', '$user_share', '".$_SERVER['REMOTE_ADDR']."')");

How can I check those variables (eg $user_mail), that has been just read from $_REQUEST["user_mail"], respects their MySql type (varchar(30) notnull)?
Once I saved all $_REQUEST in $vars are there any fast function to check MySql types?

A: Firstly, you should be using prepared statements with PDO or MySQLi. I'd recommend PDO. There are a few examples of prepared statements w/ PDO on the PHP website.
Secondly, your app should control what gets sent to the database. You could write up custom validation rules to match each column:
if(strlen(trim($_REQUEST["user_mail"])) > 30){
    //Show error to user because they're not going to like having
    //their mail truncated without warning.
}

You can also look into using the SQL query:
DESCRIBE NameOfYourTable


text:
Q: How to prevent non numeric Character and accepts 3 decimal places I have this code it's working but it's accept small letter (e) and big (E)
How can I prevent that? I've seen some similar codes that also accepts (e & E)
function isNumberKeyDecimal(evt)
    {
         var charCode = (evt.which) ? evt.which : event.keyCode

         if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46)
         return false;

     return true;
    }


text:
Q: Find the total number of permutation with K inversions I have been given the number N. I have to find all the permutations of numbers 1..N such that the total number of inversions in the array is K.
For example: (all the following permutations have exactly 2 inversions)
N=4 , K=2
(1,4,2,3) , (1,3,4,2) , (2,1,4,3) , (3,1,2,4) and (2,3,1,4).

My Approach:
Dynamic Programming: let dp[i][j] hold number of ways such that position i is responsible for j number of inversion.
dp[n][0]=1
 for(int i=n-1;i>=1;i--){

      int x = Math.min(k,n-i); // Maximum Number of inversion i position can do

      for(int j=0;j<=x;j++){

          for(int v=0;v<=j;v++){
                dp[i][j]+=dp[i+1][v];
            }

      }

But my approach give me individual position inversions, how can I get the total ways?

A: Since for any permutation of 1,2...N-1, we can insert N, at position j, adding a total of N-j inversions, the total number of permutations of 1,2...N with k inversions may be calculated by
T(N,k) = T(N-1,k) + T(N-1,k-1) + T(N-1,k-2) ... + T(N-1,0)

JavaScript example:

function f(N,K){
  var M = [[1]];

  for (var n=1; n<=N; n++){
    M[n] = new Array((n-1)*n/2 + 1).fill(0);

    for (var k=0; k<=(n-1)*n/2; k++){
      for (var j=Math.min(k,(n-2)*(n-1)/2); j>= Math.max(0,k-n+1); j--){
        M[n][k] += M[n-1][j];
      }
    }
  }

  return M;
}

var res = f(5,10);

for (var i=0; i< res.length; i++){
  console.log(JSON.stringify(res[i]));
}


text:
Q: 100 terabytes database on PostgreSQL without sharding Is it realistic to setup a 100 TB database (about 90 TB actually) on PostgreSQL without data  sharding between a number of nodes? Are there any success stories / examples about similar setups?

A: 50K writes per second that need to be absorbed is more than a challenge usually. Even in synthetic benchmarks with quite simple inserts, PostgreSQL's limits tend to max out around roughly 10 K/s - and there you don't even have such a large beast in terms of database size.
Also the I/O system for that single PostgreSQL node is going to be interesting as even with RAID 10 and assuming that 50K inserts are going to be equal to just 50K IOPS (which is probably wrong, but it depends on your database scheme and indices), you are going to need roughly a hundred disks paired with a very good array that saves you from buying several hundred disks to service those writes in a timely manner.
If sharding is easy and you expect such a huge write load then go for sharding. Writes can be very difficult to scale.

A: It is realistic and will work. Performance largerly depends on how much RAM you have. The larger the RAM, the larger the cache, and the longer PostgreSQL can cache data before offloading to disk.
PostgreSQL will write data to cache, and offload the cache from time to time. So 50k INSERTs per second will not be translated to 50k IOPS. It will be way less, because it will cluster records together and write them all at the same time.
A database that large is not a problem if the majority of the work is INSERT. PostgreSQL will have to change the indexes here and there, but that's really an easy job. If you had lots of SELECTs on a database this size, you would really need to shard.
I once worked on a Oracle DB (Oracle 10g) with 400TB on a 16GB server, one instance only. The database workload was primary INSERTs too, so a few SELECTs per day and millions of INSERTs every day. Performance was far from being a problem.

A: At 100TB you have some important challenges.  Whether it will work for you or not depends on how you want to address these.

*

*You need sufficient ways to absorb the write load.  This depends on the write load.  But with sufficiently awesome storage it can be solved.  Velocity is a big problem here.  Similarly read access has to be looked at carefully.

*Most databases don't consist of a bunch of smallish tables but often have one or two really big ones, which can be up to half of the db size.  PostgreSQL has a hard limit of 32TB per table.  After that the tid type runs out of page counters.  This could be handled by a custom build of PostgreSQL or by table partitioning but it is a serious challenge that needs to be addressed at first.

*PostgreSQL has real limits in how much RAM it can use for various tasks.  So having more RAM may or may not help you beyond a certain point.

*Backups....  Backups are interesting at this scale.  The 60TB db that I know of had to use fs snapshot backups and then fake the backups for barman for wal archiving.  These fake backups were proxies for fs snapshot backups.  As I said "They aren't fake backups.  They are alternative backups!"
There are people with databases approaching this range.  I have met at least one individual who worked for a bank in the Netherlands which had a 60TB PostgreSQL database.  However it really, really depends on your workload and size by itself is not the problem.


text: Q: Has anyone done a python tornado compatible firebase implementation? I did a search but did not come up with any hits for a tornado.websocket implementation of the  firebase sdk.  Abe Haskin's python-firebasin runs inside a thread.  I know its possible to port thinking about it not sure it is trivial, particularly if you try to make the rootdataref dynamic.  Was wondering if anyone had been down this path?


text:
Q: iphone build app for iphone 3gs and iphone4 what's the best way to develop an app for the old iphone with the resolution 320x480 and for the new iphone 4 with retina display with resolution 640x960?
thanks in advance

A: You can develop just as normal with Xcode and Interface Builder.
It's just advisable to provide 2 different resolutions of images - those for iPhone 2G/3G/3GS named as wanted - and the replacement for that image at the end before the suffix with @2x.
e.g.
   * for iPhone 2G/3G/3GS: Default.png
   * for iPhone 4: Default@2x.png
The compiler automatically takes the right one. If you do not provide an additional (or "better version") of a picture for iPhone 4, it will take the one without @2x at the end ;-).

A: The sizes you specify are in interface points, not pixels. One interface point equals one pixel on the old iPhones, and equals two pixels on Retina devices. This means you can layout the interface once, with 320x480 points size.
Standard UI elements and fonts are automatically rendered in the higher resolution on Retina devices. For images, use the @2x method as described by thedom.
So there really is nothing to do for you except provide higher resolution versions of each image. Do not fall for the caveat of "I can just use double resolution images for both devices". This will result in inferior image quality on older devices (and likely a little performance loss due to the scaling).


text:
Q: Python class instance return value My problem is as follows: I have a class Taskpane with a couple of methods. Instantiating works as it should. Now, when i show a list of all instantiated objects, i would like to print out a member variable per object for example the _tp_nr.
The following code returns the correct values, but it gets return in a strange(?) format.
This is the code:
#import weakref

class Taskpane():
    '''Taskpane class to hold all catalog taskpanes '''

    #'private' variables
    _tp_nr = ''
    _tp_title = ''
    _tp_component_name = ''

    #Static list for class instantiations
    _instances = []

    #Constructor
    def __init__(self,
                  nr,
                  title,
                  component_name):

      self._tp_nr             = nr,
      self._tp_title          = title,
      self._tp_component_name = component_name

      #self.__class__._instances.append(weakref.proxy(self))
      self._instances.append(self)

    def __str__(self):
      return str( self._tp_nr )

    def setTaskpaneId(self, value):
      self._tp_nr = value

    def getTaskpaneId(self):
      return str(self._tp_nr)

    def setTaskpaneTitle(self, value):
      self._tp_title = value

    def getTaskpaneTitle(self):
      return str(self._tp_title)

    def setTaskpaneComponentName(self, value):
      self._tp_component_name = value

    def getTaskpaneComponentName(self):
      return self._tp_component_name

tp1 = Taskpane( '0', 'Title0', 'Component0' )
tp2 = Taskpane( '1', 'Title1', 'Component1' )

#print Taskpane._instances

#print tp1

for instance in Taskpane._instances:
    print( instance.getTaskpaneId() )

for instance in Taskpane._instances:
    print( instance.getTaskpaneTitle() )

Result:
('0',)
('1',)

('Title0',)
('Title1',)

The question is:
Why does it return the results in this kind of formatting? I would expect only to see:
'0'
'1'

('Title0')
('Title1')

When using:
for instance in Taskpane._instances:
    print( instance._tp_nr )

The result is the same.

A: You are creating tuples by using a comma:
self._tp_id             = nr,

The comma is what makes _tp_id a tuple:
>>> 1,
(1,)

A: Remove commas in the end of this strings in constructor:
self._tp_id             = nr,
self._tp_title          = title,

Python treats such expressions as tuple with one element

A: Remove the trailing commas, which are turning the value into a tuple.


text:
Q: Can't get  working in Spring 3 Trying to link a css stylesheet to one of my jsp files, but I seem to be missing something because the stylesheet is never found.
mvc-config.xml:

<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />

<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:annotation-driven />
</beans>

my link tag in jsp file
<link rel="stylesheet" type="text/css" href="http://localhost/testing/resources/css/common.css">

web.xml:
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
                /WEB-INF/dispatcher-servlet.xml,
                /WEB-INF/datasource.xml,
                /WEB-INF/spring-security.xml,
                /WEB-INF/mvc-config.xml
        </param-value>
  </context-param>

    <!--  Spring Security Filter -->
    <filter>
      <filter-name>springSecurityFilterChain</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
      <filter-name>springSecurityFilterChain</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

My folder structure is webapp/resources/css
What am I missing?
When I try to access the css file directly through the browser, it just redirects me to my jsp file.

A: I noticed you are including a security configuration file in your web.xml. Make sure you disable security for your assets / resources:
<http pattern="/resources/**" security="none" />


text:
Q: LevelDB files are corrupt, How can we repair them? We have been using a filesystem build in Golang, seaweedfs, and our own disk's file system was XFS,
a few days back we got an error as
[   42.236828] XFS (sda5): xfs_do_force_shutdown(0x8) called from line 118 of file /build/linux-lts-wily-JUyKGw/linux-lts-wily-4.2.0/fs/xfs/xfs_bmap_util.c.  Return address = 0xffffffffc02e35e4
[   42.237271] XFS (sda5): Corruption of in-memory data detected.  Shutting down filesystem
[   42.237320] XFS (sda5): Please umount the filesystem and rectify the problem(s)

so, we mounted and unmounted the disk and then It needs cleaning, so we repaired it with xfs_repair -L /dev/sda5
there was nothing in lost+found folder but after that, our seaweed master server started to crash, As We asked a question to Chris Lu, who made the seaweedFS, he mentioned the files are corrupt, in filer, actually leveldb files. the error was something like this
I1101 12:42:19 31159 volume.go:110] loading index file /storage/1082.idx readonly false
F1101 12:42:19 31159 filer_server.go:53] Can not start filer in dir /storage/filer : leveldb/storage: corrupted or incomplete meta file
goroutine 21 [running]:
github.com/chrislusf/seaweedfs/weed/glog.stacks(0x1214600, 0x0, 0x0, 0x0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/glog/glog.go:767 +0xb8
github.com/chrislusf/seaweedfs/weed/glog.(*loggingT).output(0x11f59e0, 0xc800000003, 0xc8200faf00, 0x11cb17f, 0xf, 0x35, 0x0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/glog/glog.go:718 +0x259
github.com/chrislusf/seaweedfs/weed/glog.(*loggingT).printf(0x11f59e0, 0xc800000003, 0xe57d80, 0x22, 0xc82004dd10, 0x2, 0x2)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/glog/glog.go:656 +0x1d4
github.com/chrislusf/seaweedfs/weed/glog.Fatalf(0xe57d80, 0x22, 0xc82004dd10, 0x2, 0x2)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/glog/glog.go:1149 +0x5d
github.com/chrislusf/seaweedfs/weed/server.NewFilerServer(0xc8200659e0, 0xd8b9b0, 0x7, 0x22b8, 0xc8200eb740, 0x13, 0xc82018d280, 0xe, 0x0, 0x0, ...)

after that, we used a tool to repair leveldb files, https://github.com/rchunping/leveldb-tools, It repaired the files without any error, and seaweedfs Master started with filer, with no errors like the mentioned above, But as when everything is working fine, filer should respond on port 8888, but when we access port 8888, it gave error like this,
017/11/02 01:50:41 http: panic serving 39.36.53.157:46124: leveldb: internal key "\x00\x01d,", len=4: invalid length
goroutine 2498 [running]:
net/http.(*conn).serve.func1(0xcd3aaf8080)
    /usr/lib/go/src/net/http/server.go:1389 +0xc1
panic(0xaf99a0, 0xcfefca8210)
    /usr/lib/go/src/runtime/panic.go:426 +0x4e9
github.com/syndtr/goleveldb/leveldb.internalKey.assert(0xc8712930ed, 0x4, 0x20)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/key.go:115 +0x22c
github.com/syndtr/goleveldb/leveldb.internalKey.ukey(0xc8712930ed, 0x4, 0x20, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/key.go:120 +0x46
github.com/syndtr/goleveldb/leveldb.(*iComparer).Compare(0xc852e100a0, 0xc8712930ed, 0x4, 0x20, 0xcfefca81d0, 0xc, 0xc, 0xc850f5cf60)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/comparer.go:36 +0x4a
github.com/syndtr/goleveldb/leveldb/table.(*block).seek.func1(0x1, 0x8cce81)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:68 +0x278
sort.Search(0x3, 0xcfefc44bd0, 0xe8)
    /usr/lib/go/src/sort/search.go:66 +0x52
github.com/syndtr/goleveldb/leveldb/table.(*block).seek(0xc87231c1c0, 0x7f8204327100, 0xc852e100a0, 0x0, 0x3, 0xcfefca81d0, 0xc, 0xc, 0xcdcd40, 0x443815, ...)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:69 +0xa9
github.com/syndtr/goleveldb/leveldb/table.(*blockIter).Seek(0xcfefb9e5a0, 0xcfefca81d0, 0xc, 0xc, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:229 +0x10e
github.com/syndtr/goleveldb/leveldb/table.(*Reader).newBlockIter(0xc8387461a0, 0xc87231c1c0, 0x7f81f57e7168, 0xcb79534140, 0xc87026d3b0, 0x1, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:736 +0x1db
github.com/syndtr/goleveldb/leveldb/table.(*Reader).NewIterator(0xc8387461a0, 0xc87026d3b0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:804 +0x356
github.com/syndtr/goleveldb/leveldb.(*tOps).newIterator(0xc86b6ad350, 0xc85214bf90, 0xc87026d3b0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table.go:411 +0x1a5
github.com/syndtr/goleveldb/leveldb.(*version).getIterators(0xc844da5cc0, 0xc87026d3b0, 0x0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/version.go:253 +0x1a7
github.com/syndtr/goleveldb/leveldb.(*DB).newRawIterator(0xc8201f4780, 0x0, 0x0, 0x0, 0x0, 0xc87026d3b0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db_iter.go:41 +0xdc
github.com/syndtr/goleveldb/leveldb.(*DB).newIterator(0xc8201f4780, 0x0, 0x0, 0x0, 0x0, 0x16571aa28, 0xcfefc45550, 0x0, 0x4ee651)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db_iter.go:79 +0x229
github.com/syndtr/goleveldb/leveldb.(*DB).NewIterator(0xc8201f4780, 0xcfefc45550, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db.go:882 +0x205
github.com/chrislusf/seaweedfs/weed/filer/embedded_filer.(*FileListInLevelDb).ListFiles(0xc82009c138, 0xcf00000000, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/filer/embedded_filer/files_in_leveldb.go:64 +0x48c
github.com/chrislusf/seaweedfs/weed/filer/embedded_filer.(*FilerEmbedded).ListFiles(0xc849337300, 0xcfefca8144, 0x1, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/filer/embedded_filer/filer_embedded.go:63 +0xf1
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).listDirectoryHandler(0xc8201f6000, 0x7f81e2155190, 0xcbbe8221a0, 0xc820156380)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers_read.go:40 +0x6b1
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).GetOrHeadHandler(0xc8201f6000, 0x7f81e2155190, 0xcbbe8221a0, 0xc820156380, 0xffffffffffffff01)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers_read.go:50 +0x150
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).filerHandler(0xc8201f6000, 0x7f81e2155190, 0xcbbe8221a0, 0xc820156380)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers.go:10 +0xf6
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).(github.com/chrislusf/seaweedfs/weed/server.filerHandler)-fm(0x7f81e2155190, 0xcbbe8221a0, 0xc820156380)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server.go:60 +0x3e
net/http.HandlerFunc.ServeHTTP(0xc82ddf86d0, 0x7f81e2155190, 0xcbbe8221a0, 0xc820156380)
    /usr/lib/go/src/net/http/server.go:1618 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc82017eb40, 0x7f81e2155190, 0xcbbe8221a0, 0xc820156380)
    /usr/lib/go/src/net/http/server.go:1910 +0x17d
net/http.serverHandler.ServeHTTP(0xc852de9f00, 0x7f81e2155190, 0xcbbe8221a0, 0xc820156380)
    /usr/lib/go/src/net/http/server.go:2081 +0x19e
net/http.(*conn).serve(0xcd3aaf8080)
    /usr/lib/go/src/net/http/server.go:1472 +0xf2e
created by net/http.(*Server).Serve
    /usr/lib/go/src/net/http/server.go:2137 +0x44e
2017/11/02 01:51:12 http: panic serving 39.36.53.157:46128: leveldb: internal key "\x00\x01d,", len=4: invalid length
goroutine 2467 [running]:
net/http.(*conn).serve.func1(0xc921cf6780)
    /usr/lib/go/src/net/http/server.go:1389 +0xc1
panic(0xaf99a0, 0xcf62fea290)
    /usr/lib/go/src/runtime/panic.go:426 +0x4e9
github.com/syndtr/goleveldb/leveldb.internalKey.assert(0xc8712930ed, 0x4, 0x20)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/key.go:115 +0x22c
github.com/syndtr/goleveldb/leveldb.internalKey.ukey(0xc8712930ed, 0x4, 0x20, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/key.go:120 +0x46
github.com/syndtr/goleveldb/leveldb.(*iComparer).Compare(0xc852e100a0, 0xc8712930ed, 0x4, 0x20, 0xcf62fea250, 0xc, 0xc, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/comparer.go:36 +0x4a
github.com/syndtr/goleveldb/leveldb/table.(*block).seek.func1(0x1, 0x8cce81)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:68 +0x278
sort.Search(0x3, 0xca5cc78bd0, 0xe8)
    /usr/lib/go/src/sort/search.go:66 +0x52
github.com/syndtr/goleveldb/leveldb/table.(*block).seek(0xc87231c1c0, 0x7f8204327100, 0xc852e100a0, 0x0, 0x3, 0xcf62fea250, 0xc, 0xc, 0xcdcd40, 0x443815, ...)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:69 +0xa9
github.com/syndtr/goleveldb/leveldb/table.(*blockIter).Seek(0xce24069b30, 0xcf62fea250, 0xc, 0xc, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:229 +0x10e
github.com/syndtr/goleveldb/leveldb/table.(*Reader).newBlockIter(0xc8387461a0, 0xc87231c1c0, 0x7f81f57e7168, 0xcb795cc1f8, 0xc87024edb0, 0x1, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:736 +0x1db
github.com/syndtr/goleveldb/leveldb/table.(*Reader).NewIterator(0xc8387461a0, 0xc87024edb0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:804 +0x356
github.com/syndtr/goleveldb/leveldb.(*tOps).newIterator(0xc86b6ad350, 0xc85214bf90, 0xc87024edb0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table.go:411 +0x1a5
github.com/syndtr/goleveldb/leveldb.(*version).getIterators(0xc844da5cc0, 0xc87024edb0, 0x0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/version.go:253 +0x1a7
github.com/syndtr/goleveldb/leveldb.(*DB).newRawIterator(0xc8201f4780, 0x0, 0x0, 0x0, 0x0, 0xc87024edb0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db_iter.go:41 +0xdc
github.com/syndtr/goleveldb/leveldb.(*DB).newIterator(0xc8201f4780, 0x0, 0x0, 0x0, 0x0, 0x16571aa28, 0xca5cc79550, 0x0, 0x4ee651)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db_iter.go:79 +0x229
github.com/syndtr/goleveldb/leveldb.(*DB).NewIterator(0xc8201f4780, 0xca5cc79550, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db.go:882 +0x205
github.com/chrislusf/seaweedfs/weed/filer/embedded_filer.(*FileListInLevelDb).ListFiles(0xc82009c138, 0xcf00000000, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/filer/embedded_filer/files_in_leveldb.go:64 +0x48c
github.com/chrislusf/seaweedfs/weed/filer/embedded_filer.(*FilerEmbedded).ListFiles(0xc849337300, 0xcf62fea1c4, 0x1, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/filer/embedded_filer/filer_embedded.go:63 +0xf1
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).listDirectoryHandler(0xc8201f6000, 0x7f81e2155190, 0xcdf1bf21a0, 0xc82018c8c0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers_read.go:40 +0x6b1
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).GetOrHeadHandler(0xc8201f6000, 0x7f81e2155190, 0xcdf1bf21a0, 0xc82018c8c0, 0xffffffffffffff01)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers_read.go:50 +0x150
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).filerHandler(0xc8201f6000, 0x7f81e2155190, 0xcdf1bf21a0, 0xc82018c8c0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers.go:10 +0xf6
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).(github.com/chrislusf/seaweedfs/weed/server.filerHandler)-fm(0x7f81e2155190, 0xcdf1bf21a0, 0xc82018c8c0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server.go:60 +0x3e
net/http.HandlerFunc.ServeHTTP(0xc82ddf86d0, 0x7f81e2155190, 0xcdf1bf21a0, 0xc82018c8c0)
    /usr/lib/go/src/net/http/server.go:1618 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc82017eb40, 0x7f81e2155190, 0xcdf1bf21a0, 0xc82018c8c0)
    /usr/lib/go/src/net/http/server.go:1910 +0x17d
net/http.serverHandler.ServeHTTP(0xc852de9f00, 0x7f81e2155190, 0xcdf1bf21a0, 0xc82018c8c0)
    /usr/lib/go/src/net/http/server.go:2081 +0x19e
net/http.(*conn).serve(0xc921cf6780)
    /usr/lib/go/src/net/http/server.go:1472 +0xf2e
created by net/http.(*Server).Serve
    /usr/lib/go/src/net/http/server.go:2137 +0x44e
2017/11/02 01:52:23 http: panic serving 39.36.53.157:46142: leveldb: internal key "\x00\x01d,", len=4: invalid length
goroutine 2456 [running]:
net/http.(*conn).serve.func1(0xc97d935b80)
    /usr/lib/go/src/net/http/server.go:1389 +0xc1
panic(0xaf99a0, 0xce2f857050)
    /usr/lib/go/src/runtime/panic.go:426 +0x4e9
github.com/syndtr/goleveldb/leveldb.internalKey.assert(0xc8712930ed, 0x4, 0x20)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/key.go:115 +0x22c
github.com/syndtr/goleveldb/leveldb.internalKey.ukey(0xc8712930ed, 0x4, 0x20, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/key.go:120 +0x46
github.com/syndtr/goleveldb/leveldb.(*iComparer).Compare(0xc852e100a0, 0xc8712930ed, 0x4, 0x20, 0xce2f857010, 0xc, 0xc, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/comparer.go:36 +0x4a
github.com/syndtr/goleveldb/leveldb/table.(*block).seek.func1(0x1, 0x8cce81)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:68 +0x278
sort.Search(0x3, 0xca5cc78bd0, 0xe8)
    /usr/lib/go/src/sort/search.go:66 +0x52
github.com/syndtr/goleveldb/leveldb/table.(*block).seek(0xc87231c1c0, 0x7f8204327100, 0xc852e100a0, 0x0, 0x3, 0xce2f857010, 0xc, 0xc, 0xcdcd40, 0x443815, ...)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:69 +0xa9
github.com/syndtr/goleveldb/leveldb/table.(*blockIter).Seek(0xce24069ef0, 0xce2f857010, 0xc, 0xc, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:229 +0x10e
github.com/syndtr/goleveldb/leveldb/table.(*Reader).newBlockIter(0xc8387461a0, 0xc87231c1c0, 0x7f81f57e7168, 0xcb795cc478, 0xc8701be090, 0x1, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:736 +0x1db
github.com/syndtr/goleveldb/leveldb/table.(*Reader).NewIterator(0xc8387461a0, 0xc8701be090, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table/reader.go:804 +0x356
github.com/syndtr/goleveldb/leveldb.(*tOps).newIterator(0xc86b6ad350, 0xc85214bf90, 0xc8701be090, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/table.go:411 +0x1a5
github.com/syndtr/goleveldb/leveldb.(*version).getIterators(0xc844da5cc0, 0xc8701be090, 0x0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/version.go:253 +0x1a7
github.com/syndtr/goleveldb/leveldb.(*DB).newRawIterator(0xc8201f4780, 0x0, 0x0, 0x0, 0x0, 0xc8701be090, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db_iter.go:41 +0xdc
github.com/syndtr/goleveldb/leveldb.(*DB).newIterator(0xc8201f4780, 0x0, 0x0, 0x0, 0x0, 0x16571aa28, 0xca5cc79550, 0x0, 0x4ee651)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db_iter.go:79 +0x229
github.com/syndtr/goleveldb/leveldb.(*DB).NewIterator(0xc8201f4780, 0xca5cc79550, 0x0, 0x0, 0x0)
    /root/go/src/github.com/syndtr/goleveldb/leveldb/db.go:882 +0x205
github.com/chrislusf/seaweedfs/weed/filer/embedded_filer.(*FileListInLevelDb).ListFiles(0xc82009c138, 0xce00000000, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/filer/embedded_filer/files_in_leveldb.go:64 +0x48c
github.com/chrislusf/seaweedfs/weed/filer/embedded_filer.(*FilerEmbedded).ListFiles(0xc849337300, 0xce2f856f64, 0x1, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/filer/embedded_filer/filer_embedded.go:63 +0xf1
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).listDirectoryHandler(0xc8201f6000, 0x7f81e2155190, 0xcc30caf520, 0xcfef0d87e0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers_read.go:40 +0x6b1
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).GetOrHeadHandler(0xc8201f6000, 0x7f81e2155190, 0xcc30caf520, 0xcfef0d87e0, 0xffffffffffffff01)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers_read.go:50 +0x150
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).filerHandler(0xc8201f6000, 0x7f81e2155190, 0xcc30caf520, 0xcfef0d87e0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server_handlers.go:10 +0xf6
github.com/chrislusf/seaweedfs/weed/server.(*FilerServer).(github.com/chrislusf/seaweedfs/weed/server.filerHandler)-fm(0x7f81e2155190, 0xcc30caf520, 0xcfef0d87e0)
    /root/go/src/github.com/chrislusf/seaweedfs/weed/server/filer_server.go:60 +0x3e
net/http.HandlerFunc.ServeHTTP(0xc82ddf86d0, 0x7f81e2155190, 0xcc30caf520, 0xcfef0d87e0)
    /usr/lib/go/src/net/http/server.go:1618 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc82017eb40, 0x7f81e2155190, 0xcc30caf520, 0xcfef0d87e0)
    /usr/lib/go/src/net/http/server.go:1910 +0x17d
net/http.serverHandler.ServeHTTP(0xc852de9f00, 0x7f81e2155190, 0xcc30caf520, 0xcfef0d87e0)
    /usr/lib/go/src/net/http/server.go:2081 +0x19e
net/http.(*conn).serve(0xc97d935b80)
    /usr/lib/go/src/net/http/server.go:1472 +0xf2e
created by net/http.(*Server).Serve
    /usr/lib/go/src/net/http/server.go:2137 +0x44

So Chris says , the leveldb file seems corrupted.
My question is:
Is there any way to repair those corrupted files, As I have used the above tool, but I made little bit difference only, are there any good tools which can repair those corrupted files, or we are shooting in the dark and it not even possible.
I don't have any knowledge about Golang or leveldb, So pardon me if the question seems silly to all of you. Purpose of posting here is: If you can see the error and suggest about, how to recover that. :)


text:
Q: Set CopyingRowClipboardContent event dynamically for all DataGrids I want to be able to copy a cell instead of a row when I hit Ctrl + C in a DataGrid, and I found that I can do this using the event CopyingRowClipboardContent and the handler :
Private Sub DataGrid_CopyingRowClipboardContent(ByVal sender As Object, ByVal e As DataGridRowClipboardEventArgs)
    Dim currentCell = e.ClipboardRowContent(dataGrid.CurrentCell.Column.DisplayIndex)
    e.ClipboardRowContent.Clear()
    e.ClipboardRowContent.Add(currentCell)
End Sub

I would like to assign this behavior globally to any DataGrid created during runtime (instead of going back to my code and adding the handler to all the DataGrid one by one).
I tried adding the following line into my <Window.Resources> code :
<Style x:Key="DataGridCustomStyle" TargetType="{x:Type DataGrid}">
    <EventSetter Event="CopyingRowClipboardContent" Handler="Datagrid_CopyingRowClipboardContent" />
</Style>

But I get an error saying that CopyingRowClipboardContent must be a RoutedEvent event.

A: I've read again your question after commenting, and I think we are not looking for the same...
If you just  want to be able to select ONE cell instead of entire row then I think you can go with
<Style x:Key="DataGridCustomStyle" TargetType="{x:Type DataGrid}">
    <!--Copy only selected content without header-->
    <Setter Property="ClipboardCopyMode" Value="ExcludeHeader" />
    <!--Able to select many cells-->
    <Setter Property="SelectionMode" Value="Extended" />
    <!--Able to select cells or entire row/column-->
    <Setter Property="SelectionUnit" Value="CellOrRowHeader" />
</Style>

So this way if user has just one cell selected and press Ctrl+C only the selected cell content will be pasted to clipboard.


text:
Q: How to use EventBus just for first time in Android In my application i have 2 activity.Activity A and Activity B.
For show Activity B users should go to from Activity A.
In activity B i have one button and i want when click on this button finish Activity B and call one method into Activity A.
For this work i write below code :
       baseDialog_positiveBtn.setOnClickListener(v -> {
            EventBus.getDefault().postSticky(new BuyPremiumUserEvent(true));
            finish();
        });

And for call method into Activity A i write below code :
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onBuyPremium(final BuyPremiumUserEvent event) {
    clickedOnBuyPremium = event.isClickOnBuyPremium();
    Log.e("clickedOnBuyPremium", "Event : " + clickedOnBuyPremium);
    if (AppConstant.getInstance().isPackageInstalled(AppConstant.BAZAAR_PAYMENT_PACKAGE, packageManager)) {
        initBazaarUserRegistered();
    } else {
        AppConstant.getInstance().showMessage(activity, getString(R.string.errorTitle),
                getString(R.string.notInstalledBazaar), R.color.catRedColor);
    }
}

When click on Button, call above method!
But when click on Button, call Activity A methods always!
My mean is : after click on button, even go to Activity C , E and more ... and when click on back button for go to Activity A again call above method of Activity A.
I want call above method just when click on button from Activity B, not always!
How can i fix it?

A: If I correctly understood your situation - you have a button in one activity that initiates an eventBus event, and a second activity-subscriber to this event.
And after button is clicked, you run some registration wizard on another activity, but your problem is that this subscribed method called on other events too, that you don't want to handle in a such way. Is this correct?
Actually, I don't see a point to use eventBus in a such case. If you just want to show Activity B from Activity A, when button is clicked, then just show your activity using Intent instance:
Intent intent = new Intent(this, ActivityB.class)
startActivity(intent)

I could misunderstand you. Can you add more details about your situation?
If you need to use eventBus, then maybe your multiple calls of subscribed events is the cause of making event sticky.
Try the same with usual events:
 baseDialog_positiveBtn.setOnClickListener(v -> {
            EventBus.getDefault().post(new BuyPremiumUserEvent(true));
            finish();
        });

And handle them without sticky flag:
@Subscribe(threadMode = ThreadMode.MAIN)
public void onBuyPremium(final BuyPremiumUserEvent event) {
  //...
}


text:
Q: Shiny update data from selectInput I am facing an issue in getting the output of selectizeInput to update the uploaded csv data.  The specific code block having issue is
observeEvent(input$Go, {
    tmp <- values$df_data
    output$Grp = renderUI({

      lvls <- tmp %>%
        pull(Group) %>%
        levels

      selectizeInput('group', 'Groups', choices = lvls, selected = lvls[1], multiple = FALSE)

    })

    tmp1 <- tmp %>%
      filter(Group == "A") # need to change here by updating the value from input$Grp
    values$df_data <- tmp1

  })

The 'Group' column is filtered with a hard coded value.  My intention is to make it dynamic by getting the values of "Grp".  Image below shows the issue
enter image description here
The full code is below
library(shinydashboard)
 library(shiny)
 library(dplyr)
 library(tidyr)

ui = dashboardPage(
   dashboardHeader(),
   dashboardSidebar(
     width = 200,
     sidebarMenu(
       menuItem("File Upload", icon = shiny::icon("table")),

       fileInput('datafile', 'Choose CSV file',
                 accept=c('text/csv', 'text/comma-separated-values,text/plain')),
       uiOutput('Grp'),
       actionButton("Go","Subset Data"))
   ),

   dashboardBody( fluidPage(

     titlePanel("Data Table"),

     sidebarLayout(
       tabPanel("tab",
                div( id ="Sidebar",sidebarPanel(

                ))),

       mainPanel(
                 DT::dataTableOutput("tableOut")

       )
     )
   )
   )
 )

server = function(input, output, session) {

  values <- reactiveValues(df_data = NULL)

  observeEvent(input$datafile, {
    values$df_data <- read.csv(input$datafile$datapath)

  })

  observeEvent(input$Go, {
    tmp <- values$df_data
    output$Grp = renderUI({

      lvls <- tmp %>%
        pull(Group) %>%
        levels

      selectizeInput('group', 'Groups', choices = lvls, selected = lvls[1], multiple = FALSE)

    })

    tmp1 <- tmp %>%
      filter(Group == "A") # need to change here by updating the value from input$Grp
    values$df_data <- tmp1

  })

  output$tableOut <- DT::renderDataTable({

    DT::datatable(values$df_data)

  })

}

shinyApp(ui = ui, server = server)

I am uploading .csv file.  The below data is similar to the one I have.
set.seed(12345)
data <- data.frame(DATE = rep(seq(as.Date("2014-01-01"), length.out = 200,
by = "week"), each = 4), Group = rep(c("A", "B", "C", "D"), each = 200),
       ValueColumn = rnorm(800))

A: welcome to the site here. This is also a problem I have had recently -- it does not seem to be isolated to selectizeInput but pertains to any new data that you are trying to get your Shiny app to "see". Here are a couple things to try:

*

*Delete any _cache directories in the root of your shiny server, then try to load again. If there is no difference,

*touch the .csv files (or make an edit if on Windows, to get a new timestamp) and then try to load again. If there is no difference,

*Restart the shiny server with sudo systemctl restart shiny-server where the last argument is the name of your shiny server (default is shiny-server)

This last solution is the one that worked most reliably for me -- it is #2 from this document (Shiny app does not reflect changes in update RData file) -- to restart the shiny server from the command line. This worked reliably and routinely. The other ideas in this solution did not work on my machine so must be dependent on your server or client specifications.
The second thing that worked for me was to use reactiveTimer (https://shiny.rstudio.com/reference/shiny/0.14/reactiveTimer.html).
In any case, if you have been beating your head against a wall with this, it is a tricky issue and is troublesome for many of us. Good luck with picking a best solution for your context.


text:
Q: Pinned tabs not lighting up when changed in chrome on Mac OSX I just switched to Chrome from Firefox and one of the things I really liked about Firefox was pinned tabs. I found that Chrome has this too, but there are some differences that I don't like.
In Firefox, it doesn't let you navigate away from or close pinned tabs without right clicking on them and selecting "close tab".
I found this feature very useful and convenient. Unfortunately, Chrome doesn't have this and I am unable to find an extension to do this.
I am a programmer so I was considering just making an extension myself. I can live without those features but the most important feature to me was when a page changed, for example Facebook, in Firefox, the tab lit up blue and stayed blue.
For some reason Chrome doesn't do this, all it does is flash a slightly whiter white than tabs normally are. I heard it only does this in the Mac version of Chrome, is there any way to fix this because it makes it very hard to tell when I have a notification on Facebook.


text:
Q: Checking validation for the whole User control fields I have a User Control inside Window which fires validation when a user interacts with that.
in code behind of window i check validation result such as :
private void CheckValidationResults(){

if (Validation.GetHasError(MyUserControl.NameTextBox) ||
    Validation.GetHasError(MyUserControl.FamilyTextBox) ||
    Validation.GetHasError(MyUserControl.AgeTextBox)) return;
else
 //  do something if every field is valid

now my question !!
how can i replace it with something like this :

private void CheckValidationResults(){

if (Validation.GetHasError(MyUserControl.Fields)) return;
else
 //  do something if every field is valid


text:
Q: Groovy - Type Check Closure Code Before Execution I have a Groovy script that lets the user define some dynamic properties and methods and later executes a user-defined closure. A script would look like this:
// init properties and methods dynamically at runtime
context.prop1 = "Some test value"
context.method1 = { String input ->
    "exec " + input.toUpperCase()
}

// "this" is set to the context variable from above
run {
    println method1( prop1 )
}

So in the beginning of the script, a context is initialized with user-defined properties (e.g. prop1) and methods (e.g. method1). The context is then used as this pointer in the run closure. I have achieved this by dynamically extending the meta class of the context and setting the context as delegate of the run closure (with DELEGATE_FIRST as resolves strategy).
Currently I am struggling at type checking. Before executing the run closure, I would like to check if method1 really expects prop1. I have looked into the DelegatesTo annotation, but that doesn't seem to work for dynamically extended objects. I have also played with the AST, but since my knowledge on that topic is limited, I haven't come up with a solution. If what I want to achieve is possible, any pointers in the right direction would be greatly appreciated.

A: You want to add a method to a context at runtime and then type check this before execution of that method.
Type checking is done at compile time. That is before anything of your program is executed. There is normally no chance this can ever check anything that will only happen at runtime, unless you have a way to statically declare it and give the compiler the power to do the check. But this means normally, you will have to do static compilation.
One way would be to use type checking extensions, but I think in your case that might be overkill. A more simple way would be to use extension modules. And the most simple way would be to use custom script base class.
But for any of these solution you will need static compilation to really have type checking, same for DelegatesTo (which is more used in combination with extension modules). For a type checked DSL a mix of type checking extensions and extension modules can work very well. But you will of course loose more dynamic features of the language and some simplicity.


text:
Q: BASEmesh plugin error while interpolation between quality and elevation mesh I am creating a 2D hydronumeric model of a watershed. The quality meshing and elevation meshing are fine, but I am getting the following error during interpolation. Does anyone know what should I do?
An error has occurred while executing Python code:

TypeError: %d format: a number is required, not str
Traceback (most recent call last):
  File "C:/Users/Shuvom/.qgis2/python/plugins\BASEmesh\interpolation\interpolation_dialog.py", line 171, in accept
    iface.messageBar().pushMessage("Interpolation", "Nr points with special treatment: %d." % result, QgsMessageBar.INFO, 3)
TypeError: %d format: a number is required, not str

Python version: 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)]
QGIS version: 2.18.28 Las Palmas, aa30730ac6

Python Path:
C:/PROGRA~1/QGIS 2.18/apps/qgis-ltr/./python/plugins\processing
C:/PROGRA~1/QGIS 2.18/apps/qgis-ltr/./python
C:/Users/Shuvom/.qgis2/python
C:/Users/Shuvom/.qgis2/python/plugins
C:/PROGRA~1/QGIS 2.18/apps/qgis-ltr/./python/plugins
C:\PROGRA~1\QGIS 2.18\bin\python27.zip
C:\PROGRA~1\QGIS 2.18\apps\Python27\DLLs
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\plat-win
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\lib-tk
C:\PROGRA~1\QGIS 2.18\bin
C:\Users\Shuvom\AppData\Roaming\Python\Python27\site-packages
C:\PROGRA~1\QGIS 2.18\apps\Python27
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\win32
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\Pythonwin
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg
C:\PROGRA~1\QGIS 2.18\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg
C:/Users/Shuvom/.qgis2//python
C:/Users/Shuvom/Desktop/Watershed


text:
Q: Requirements for the Pearson Correlation Coefficient I discovered the following content in an old discussion thread:"Normality is not required to calculate a Pearson correlation; it's just that some forms of inference about the corresponding population quantity are based on the normal assumptions (CIs and hypothesis tests)." (How to choose between Pearson and Spearman correlation?)
Can anyone please advise on published literature confimring the above claims? I am assuming that in saying "Normality is not required to calculate a Pearson correlation", the contributor meant "Normality is not required to calculate a valid Pearson correlation coefficient."