body1
stringlengths 20
4.1k
| body2
stringlengths 23
4.09k
|
---|---|
Is it possible to use generics something like that in Java 1.7? class Test<T> { public <Z extends T & Serializable> void method(Z test) { ... } } I would like my method to accept only objects of generic type which implements specific interface. | So, I understand that the following doesn't work, but why doesn't it work? interface Adapter<E> {} class Adaptulator<I> { <E, A extends I & Adapter<E>> void add(Class<E> extl, Class<A> intl) { addAdapterFactory(new AdapterFactory<E, A>(extl, intl)); } } The add() method gives me a compile error, "Cannot specify any additional bound Adapter<E> when first bound is a type parameter" (in Eclipse), or "Type parameter cannot be followed by other bounds" (in IDEA), take your pick. Clearly you're just Not Allowed to use the type parameter I there, before the &, and that's that. (And before you ask, it doesn't work if you switch 'em, because there's no guarantee that I isn't a concrete class.) But why not? I've looked through Angelika Langer's FAQ and can't find an answer. Generally when some generics limitation seems arbitrary, it's because you've created a situation where the type system can't actually enforce correctness. But I don't see what case would break what I'm trying to do here. I'd say maybe it has something to do with method dispatch after type erasure, but there's only one add() method, so it's not like there's any ambiguity... Can someone demonstrate the problem for me? |
For sets $A,B,C$ not equal to $\emptyset$ prove that $$AXB=BXA$$ $$\iff$$ $$A=B$$ | I have to resit a calculus exam and for some reason set proofs were never my best friend... Anyway, on a practice exam I encountered the following proof: $$A\cap(B\cup C) = (A\cap B)\cup(A\cap C)$$ When I draw a Venn-diagram it seems quite obvious but I couldn't manage to write the proof down properly. If someone could help me, that'd be great! |
Can any on help me out how to get the Data split based on the year , product name and get the column count in a visual force page which is in a PDF format . With Code i could retrive the data correctly.I need to split the product name based on the year.I get the Total but the subtotal is not getting calculated correctly and i get the data added in the same year. For Example :In the above table i got the data for the Year 2014 with their product names and quarter value displayed.Now when i add the data for the Year 2015 with their product names and in the quarter ,it gets added in the Year 2014 itself. But Im looking for this type of Table: ProductName Year Q1 Q2 Q3 Q4 Total BXRC-25e4000-F-04 2014 100 200 300 400 1000 2015 100 100 BXRC-25e4000-F-23 2014 200 200 400 2015 300 300 Subtotal ------------ 700 200 300 600 1800 Code : Public Integer subtotalofquantity{get;set;} Public Integer subtotalofamount{get;set;} subtotalofquantity=0; subtotalofamount=0; for(integer i=0;i<opflist.size();i++){ if(i==3){ subtotalofquantity+= integer.valueOf(opflist[0].gmod__Quantity__c); subtotalofquantity+= integer.valueOf(opflist[1].gmod__Quantity__c); subtotalofquantity+= integer.valueOf(opflist[2].gmod__Quantity__c); subtotalofamount+= integer.valueOf(opflist[0]. gmod__Amount__c); subtotalofamount+= integer.valueOf(opflist[1]. gmod__Amount__c); subtotalofamount+= integer.valueOf(opflist[2]. gmod__Amount__c); } Any help very much appreciated. | Can any on help me out how to get the Data split based on the year and product name in a visual force page which is in a PDF format . ProductName Year Q1 Q2 Q3 Q4 Total BXRC-25e4000-F-04 2014 100 200 300 400 1000 BXRC-25e4000-F-23 2014 200 200 400 Subtotal ------------ 300 200 300 600 1400 With Code i could retrive the data correctly.I need to split the product name based on the year.But i get the data added in the same table. For Example :In the above table i got the data for the Year 2014 with their product names and quarter value displayed.Now when i add the data for the Year 2015 with their product names and in the quarter ,it gets added in the Year 2014 itself. But Im looking for this type of Table: ProductName Year Q1 Q2 Q3 Q4 Total BXRC-25e4000-F-04 2014 100 200 300 400 1000 2015 100 100 BXRC-25e4000-F-23 2014 200 200 400 2015 300 300 Subtotal ------------ 700 200 300 600 1800 Any help very much appreciated. |
In my project I'm trying to get the offset position of the caret in a textarea in pixels. Can this be done? Before asking here, I have gone through many , especially Tim Down's, but I couldn't find a solution which works in IE8+, Chrome and Firefox. It seems . Some which I have found have many issues like not finding the top offset of the caret position. I am trying to get the offset position of the caret because I want to show an auto-complete suggestion box inside the textarea by positioning it based on the offset position of the caret. PS: I can't use a contenteditable div because I have written lots of code related to a textarea. | I am using jQuery and trying to find a cross browser way to get the pixel coordinates of the caret in <textarea>s and input boxes such that I can place an absolutely positioned div around this location. Is there some jQuery plugin? Or JavaScript snippet to do just that? |
I have this question from here: It is the question number 4a. I am also aware that a question was posted on MSE about the exact same exercise over here But my solution is different from both of them. I reason in such way: once there is a $1$ in the string, there are $2^3$ possibilities for the rest of the string. Now, in both answers, the reasoning goes on counting only the positions of where $1$ can go, yet I reason that it's important to see where the other letters go. As for example: $0123$ and $0132$ are different words and should be taken into account as two separate cases. Thus I reasoned I should count the total number of string not equal to $2^3 * 4$ or $2^3 *3$ but to $2^3 * 4!$. Am I wrong or correct? | Answer: Ternary strings have symbols 0, 1, and 2. If there is exactly one 1, then there are 3 positions the one can be in and 2*2*2 ways to fill the other 3 blanks with a 0 or a 2. So the answer is 3*2*2*2 = 24. I don't understand why there can only be 3 positions the one can be in? |
How can I print repeating label on every page in first column? The example below, I would like to repeat \plab on other pages at the same place. It is not header actually. \documentclass{article} \usepackage{multicol} \usepackage{lipsum} \usepackage{geometry} \usepackage{xcolor} \geometry{ a4paper, landscape, margin=1cm } \newcommand*{\plab}{ {\LARGE label1} \\ \textcolor{gray}{\rule{\columnwidth}{2pt}} \par } \begin{document} \begin{multicols*}{3} \plab \lipsum[1-20] \end{multicols*} \end{document} EDIT: I found very simmilar need and solution on TEX at But I am not able to make it working in my example, though. | I want to use multicols in my document and also having a small box on each page (upper left) to be drawn automatically. I already tried \AtBeginPage hooks but the box didn't print at proper position... I've defined \header for what I want as a box: MWE: \documentclass[10pt,landscape,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} \usepackage[utopia,sfscaled]{mathdesign} %\usepackage[lf,minionint]{MinionPro} %\renewcommand{\sfdefault}{phv} %\usepackage[lf]{MyriadPro} \usepackage{multicol} \usepackage[top=0mm,bottom=0mm,left=0mm,right=0mm]{geometry} %\usepackage{hyperref} \usepackage{lipsum} \usepackage[framemethod=tikz]{mdframed} %\usepackage{fancyhdr} ---> ??? \usepackage{microtype} \renewcommand{\baselinestretch}{.8} \pagestyle{empty} \global\mdfdefinestyle{header}{% linecolor=gray,linewidth=1pt,% leftmargin=0mm,rightmargin=0mm,skipbelow=0mm,skipabove=0mm, } \newcommand{\header}{ \begin{mdframed}[style=header] \footnotesize Some Text Inside\\ Page~\thepage~of~6 \end{mdframed} } \makeatletter \renewcommand{\section}{\@startsection{section}{1}{0mm}% {.2ex}% {.2ex}%x {\sffamily\bfseries}} \makeatother \setlength{\parindent}{0pt} \begin{document} \footnotesize \begin{multicols*}{5} \header \lipsum\lipsum\lipsum\lipsum \end{multicols*} \end{document} Is there a way I could achieve this result having the box automatically at upperleft column for each page and no text will be drawn above the box? |
I have two sets of vectors S1 and S2. These sets are subsets of a vector space V, which has both the base and the dimension unknown. Now, I don't know the elements of sets S1 and S2 and I need to prove that if S1 is a subset of S2, then span(S1) is a subspace of span(S2). I was hoping that I could get some hints, since I am really confused by this question. Thanks | If X and Y are two sets of vectors in a vector space V, and if X $\subset$ Y, then is span X $\subset$ span Y? If so, why is or isn't the span of X a subset of the span of Y? EDIT: Thank you for the hints! Here is the proof I came up with; please let me know if it is correct. The spanning set of X can be written as: Span(X) = {$a_1 x_1 + a_2 x_2 + ... + a_n x_n$} where all $x_i$ are vectors and all $a_i$ are scalars. Since X$\subset$Y then all $x_i$ are also in Y. Thus, Span(x) is a linear combination of vectors from Y So Span(x) $\subset$ Span(Y). |
I'm writing recommendation for one of my colleagues and one of the points I'd like to highlight is his "greed/hunger for knowledge". Something like: X is very greedy for knowledge, taking each opportunity to improve his expertise. Frankly speaking I doubt that using such phrase is good in official document, thus I'd like to ask you for any suggestion how such expression can be written. (disclaimer - English is not my native language) | Is there a term that means "a person who enjoys learning"? This term might be used to describe someone who: Is a self-motivated learner. Is curious, wants to understand many things. I understand the term "philosopher" might be a good fit, in terms of its root words, however, the general population has an inconsistent understanding of this term, so I am looking for a more precise term. |
I have the following object being created: var i = 0; var foo = new Foo(); foo.A = ++i; foo.B = ++i; foo.C = ++i; Assert(foo.A == 1); Assert(foo.B == 2); Assert(foo.C == 3); The same object can we written using an object initializer: var i = 0; var foo = new Foo { A = ++i, B = ++i, C = ++i } Assert(foo.A == 1); Assert(foo.B == 2); Assert(foo.C == 3); Is the order that the properties are set guaranteed in the case of the object initializer? | Does the order in which I set properties using the object initializer syntax get executed in the exact same order? For instance if I do this: var s = new Person { FirstName = "Micah", LastName = "Martin", IsLoaded = true } will each property get set in the same order? |
I have data in an Excel worksheet called "Data Sheet" in the below format. F7: ID1 F8: Amt1 F9: Units1 F10: Status1 F11: <blank> F12: ID2 F13: Amt2 F14: Units2 F15: Status2 F16: <blank> F17: ID3 F18: Amt3 F19: Units3 F20: Status3 F21: <blank> ⋮ I want to obtain the below details in another sheet ("Result Sheet"): E12: =Data Sheet'!F7 E13: =Data Sheet'!F12 E14: =Data Sheet'!F17 ⋮ How can I make the reference to auto increment by custom multiples instead of the default increment by 1? Here I need the reference cell to be incremented by 5 while dragging the formula. The answer in the "how to customize autofill in excel2010" thread is referring to the same sheet. But, here my requirement is referring to different work sheet. I tried modifying the formula in the other thread, but it didn't helped me. | like making a rule or something. I am trying to autofill a function, the first cell is (B14-B2)/B2, the second is (B26-B14)/B14, the third is (B38-B26)/B26, so I wanna to increase number by 12, however, the excel didn't get it and try to fill in (B17-B5)/B5;(B29-B17)/B17;(B41-B29)/B29; how can I let excel autofill function in the way I want it to? |
I am having hard time understanding logic of properties , as far as i looked in internet its more logical and safe to use properties instead of public variables. But i want to understand the logic of properties to scratch it on my mind private int myVar; public int MyProperty { get { return myVar; } set { myVar = value; } } public int myVar; What are the benefits of using properties instead of public variables ? Why i shouldnt write a public variable in my class and use from instance? | In C#, what makes a field different from a property, and when should a field be used instead of a property? |
I tried with the following command: sudo apt-get install nessus But It shows: Reading package lists... Done Building dependency tree Reading state information... Done Package nessus is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: openvas-client:i386 openvas-client E: Package 'nessus' has no installation candidate What to do now? | What does the above Error mean? What is an installation candidate? I was trying to do sudo apt-get install munin-memcached and I get this message: Reading package lists... Done Building dependency tree Reading state information... Done Package munin-memcached is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package munin-memcached has no installation candidate I googled for the problem and someone said to do a apt-get upgrade but it still did not solve my problem. |
In other words, how do I know which one to use? I know when I use strings. I would do string = "This is a string" When would I use ' ' or """ """? | According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to use one over the other? |
I tried to install xdman using sudo add-apt-repository ppa:noobslab/apps sudo apt-get update sudo apt-get install xdman but I can't download it; I get this: E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? I get the same error if I try to install anything else. After resolving that, I now get the error E: unable to locate package xdman | I want to install xdman on Ubuntu 17.10 but it's not installing. I ran the following commands : sudo add-apt-repository ppa:noobslab/apps sudo apt-get update sudo apt-get install xdman |
Is there a way to add some code in the preamble of a LaTeX document so that certain fields of the .bib file are ignored conditionally? More precisely, I want the url field of my .bib entries to be ignored in the case the entry already has a DOI or a arXiv identifier. | inspired me to make the printing of the Url and the Eprint field conditional, so that it only prints if there's no Doi field. Any pointers would be appreciated, If I use the code posted below, I would like it to remove what I've striked out with red here, \documentclass{article} \usepackage[backend=bibtex, style=authoryear-comp, natbib=true]{biblatex} %for digital version \bibliography{\jobname} \usepackage{filecontents} \begin{filecontents}{\jobname.bib} @article{Holland1986, Author = {Paul W. Holland}, Doi = {10.1080/01621459.1986.10478354}, Eprint = {http://www.tandfonline.com/doi/pdf/10.1080/01621459.1986.10478354}, Journal = {Journal of the American Statistical Association}, Keywords = {Applied_Economics}, Number = {396}, Pages = {945-960}, Title = {Statistics and Causal Inference}, Url = {http://www.tandfonline.com/doi/abs/10.1080/01621459.1986.10478354}, Volume = {81}, Year = {1986}} @article{Heckman1990, Author = {James Heckman}, Issn = {00028282}, Journal = {The American Economic Review}, Keywords = {_MSc}, Number = {2}, Pages = {313-318}, Publisher = {American Economic Association}, Title = {Varieties of Selection Bias}, Url = {http://www.jstor.org/stable/2006591}, Volume = {80}, Year = {1990}} \end{filecontents} \begin{document} \citet{Holland1986} and \citet{Heckman1990} went for a swim. \printbibliography \end{document} |
In writing a phd thesis, if a sentence is copied as it is and given proper references, then will it be considered as plagiarism? | Is it plagiarism if I copy several paragraphs from another's source (let's say a CS paper) into my work and then footnote Source: ..., for example, as background information? |
I had a question which is as follows:Number of words of 4 letters formed using the word IITJEE.The book says the answer as coefficient of $x^4$ in 4!$\mathrm{[1+ \frac {x}{1!}+\frac{x^2}{2!}]}^{2}[1+x]^2$.My question is where did this $\mathrm{[1+ \frac {x}{1!}+\frac{x^2}{2!}]}^{2}$ come from? | How many 6-letter permutations can be formed using only the letters of the word, MISSISSIPPI? I understand the trivial case where there are no repeating letters in the word (for arranging smaller words) but I stumble when this isn't satisfied. I'm wondering if there's a simpler way to computing all the possible permutations, as an alternative to manually calculating all the possible 6-letter combinations and summing the corresponding permutations of each. In addition, is there a method to generalize the result based on any P number of letters in a set with repeating letters, to calculate the number of n-letter permutations? Sorry if this question (or similar) has been asked before, but if it has, please link me to the relevant page. I also apologize if the explanation is unclear, or if I've incorrectly used any terminology (I'm only a high-school student.) If so, please comment. :-) |
Let $G$ be a finite group. If the order of $G$ is even, prove that there is at least one element $a$ in $G$ such that $a\not= e$ and $a=a^{-1}$. Here's my idea: Suppose $\{x_1,\cdots,x_n\}$ is all of the elements in $G$ [edit: I meant to add "such that $x\not =x^{-1}$"] (but without their inverses or the identity $e$). This set has $n$ elements. Now consider the set of the inverses that correspond to each element: $\{x^{-1}_1,\cdots,x^{-1}_n\}$. Since $G$ is a group, there is a one-to-one correspondence between these two subsets. The total order of these groups is $2n$. Consider the identity $e$, which adds 1 to $\left| G \right|$ to give $G=\{e,x_1,\cdots,x_n,x^{-1}_1,\cdots,x^{-1}_n\}$, which yields: $$|G|=2n+1,$$ which is an odd value. But there may be elements that satisfy $y\in G:y=y^{-1}$. In this case, these elements are redundant and so they each add 1 to the order of $G$. Therefore, $$|G|=[2n_x+1]+n_y$$ The term in brackets is odd, so $|G|$ is even if and only if the number of elements $y$, or $n_y$, is odd. If $n_y$ is odd, it is clear that $\exists y\in G:y\not = e \wedge y= y^{-1}$. Q.E.D. My questions are: Is this proof valid? Any recommendations on how I can make this proof shorter and more elegant? (I struggle with wordiness) Thank you. | I am working on the following problem from group theory: If $G$ is a group of order $2n$, show that the number of elements of $G$ of order $2$ is odd. That is, for some integer $k$, there are $2k+1$ elements $a$ such that $a \in G,\;\; a*a = e$, where $e$ is the identity element of $G$. |
I have calculated NDVI and SAVI for landsat-8 image. But I am getting higher value of NDVI than SAVI Can you tell me reason for this NDVI=0.46 SAVI=0.34 Specific band pixel values are toa b4- 0.130 toa b5- 0.365 L= 0.5 taken | I have calculated NDVI and SAVI vegetation indices for a landsat-8 image. I am unexpectedly getting higher values for the NDVI than SAVI. What may be causing these unusual results? NDVI=0.46 SAVI=0.34 Specific band pixel values are: toa b4- 0.130 toa b5- 0.365 L= 0.5 taken |
Often we have questions on this site which ask for a proof of some result without induction.1 It seems that when such a question is posted, it is quite well-understood what is meant by proof avoiding induction.2 But can the meaning of this phrase be precise? Is it possible to define formally what do "proof without induction" and "proof using induction" mean? For example, I would suspect that if the claim contains some object defined by induction, then we would expect that the proof uses induction, too. (Perhaps in some non-obvious way.) In the other words, if we want induction-free proof, we should have induction-free formulation of the theorem. (Although I do not claim that this intuition is correct - as you can see from this question, I cannot give even reasonable formalization of this.) Examples of claims which are typically shown by induction and which involve objects defined by induction could be:3 $\sum_{k=1}^n k = \frac{n(n+1)}2$ (We have several posts about this sum, for example .) If $a_1,\dots,a_n$ are elements of a finite abelian group $G=\{a_1,\dots,a_n\}$ (where $|G|=n$, i.e. no element is listed twice), then $(a_1a_2\dots a_n)^2$ see Of course, induction can also be used in proofs where inductive (recursive) definitions are not used in the formulation of the result.4 If we have some formalization of the distinction between proofs with/without induction, is it possible to prove about some results that induction cannot be avoided in the proof? What are some examples of results for which it is proven that any proof will need induction. (For some reasonable meaning of the phrase "need induction".) Perhaps I could imagine something like this when working with . We could simply omit the induction axiom and ask whether there is a proof using the remaining axioms. (Or whether there is a model in which the claim fails.) However, in this way we restrict ourselves to claims about natural numbers. Moreover, if we want to omit induction axioms, we would have problems already with formulating results which use recursive definitions. (The fact that recursive definitions are possible in Peano Arithmetic is proved using this axiom. Some authors calls this result .) The question becomes more complicated if we move beyond natural numbers. For example, if we are working in ZFC, then there is not an easy way out by just saying: "Let us omit the axiom about induction." 1You can . Some of the most popular examples (base on the number of views and score) could be 2I do not remember seeing some lengthy argument about whether some proof involves induction or not. Just compare that with the type of questions. Situation is somewhat similar in that we often intuitively can see whether some answer is correct (or at least reasonable) or not; whether it was the solution intended by the creator of the problem. But such questions almost immediately get the response: "Any number can be an answer. Just take Lagrange interpolation." 3Here $S_n=\sum_{k=1}^n k$ is defined inductively by $S_{n+1}=S_n+(n+1)$. Similarly, we have inductive definition for $a_1a_2\dots a_n$. I think that the well-know proofs use induction in some hidden way. For example, the proof based on $2S_n=(1+\dots+n)+(n+\dots+1)=\underset{\text{$n$-times}}{\underbrace{(n+1)+\dots+(n+1)}}$ used commutativity several times. Similarly in the proof that product of all elements of abelian groups we would use commutativity. If by commutativity we mean that the product of $n$ elements gives the same result when reordered in any way, the formal proof of this fact would be based on induction. 4One example I was able to find quickly: But I cannot at the moment think of an example where it would be difficult to give a proof without induction. | Proofs that proceed by induction are almost always unsatisfying to me. They do not seem to deepen understanding, I would describe something that is true by induction as being "true by a technicality". Of course, the axiom of induction is required to pin down the Natural numbers and certainly seem to be indispensable in one form or another. However, I am still interested in the following: Are there any "natural" theorems in mathematics that seem unlikely to fall to any method other than induction for whatever reason? I would not include examples that proceed by breaking down a structure into smaller components that are more easily handled - somehow these proofs satisfy whatever criteria for beauty I have in my mind. An example of a theorem that does have an inductive proof and a more "superior" proof is Fermat's little theorem. It is perfectly possible to prove it by induction but the proof through group theory seems better - perhaps because it is more easily generalizable. I would like examples where it seems like the "neat" proof is unlikely to exist. This is probably very philosophical and I do not really have a concrete question but I am sure I am not alone in feeling this way. |
The best time to travel is in the autumn. The best time to travel is in autumn. Which sentence is correct? | Notice these sentences: Shops are open late in summer. Summer is a traditionally viewed as a slow season for games. At the summer solstice, the days are longest and the nights are shortest. it's time to start thinking about what 2016's Song of the Summer will be. In English class, they told us that "the" is used for the things that are known. One example for this was a phrase like "The man who killed his wife". So when we are speaking of that man, we know what he did. Somehow we know something more than nothing about him. He's not just every man in the world. So Now I'm confused about why "the" is not used in the first and second sentences. Can anyone please explain it for me? |
Let $0 < a < b$. Let $f > 0$ be continuous and strictly increasing on $[a, b]$. Prove that $\int_a^b f + \int_{f(a)}^{f(b)} f^{-1} = bf(b) - af(a)$ By drawing the graph I can see and prove the theorem holds. Area of Outer rectangle - inner rectangle gives the sum of two integrands. How to prove theoretically? | Suppose $f$ is a continuous, strictly increasing function defined on a closed interval $[a,b]$ such that $f^{-1}$ is the inverse function of $f$. Prove that, $$\int_{a}^bf(x)dx+\int_{f(a)}^{f(b)}f^{-1}(x)dx=bf(b)-af(a)$$ A high school student or a Calculus first year student will simply, possibly, apply change of variable technique, then integration by parts and he/she will arrive at the answer without giving much thought into the process. A smarter student would probably compare the integrals with areas and conclude that the equality is immediate. However, I am an undergrad student of Analysis and I would want to solve the problem "carefully". That is, I wouldn't want to forget my definitions, and the conditions of each technique. For example, while applying change of variables technique, I cannot apply it blindly; I must be prudent enough to realize that the criterion to apply it includes continuous differentiability of a function. Simply with $f$ continuous, I cannot apply change of variables technique. Is there any method to solve this problem rigorously? One may apply the techniques of integration (by parts, change of variables, etc.) only after proper justification. The reason I am not adding any work of mine is simply that I could not proceed even one line since I am not given $f$ is differentiable. However, this seems to hold for non-differentiable functions also. I would really want some help. Pictorial proofs and/or area arguments are invalid. |
I need to know the name of this font because I like the style of the integral and the sum | Is it possible to identify the font used in a specific document/picture? Answers to this question should identify: Possible methods to do this (perhaps one answer per method) and adequately describe how to use it (as opposed to merely stating it); Ways of finding the identified fonts, if possible (free or not); and Any prerequisites associated with the method used, if required (for example, "In order to use method X, your document has to be in format Y"). This question is meant as an FAQ, based on an . Its aim is to facilitate the community with the general procedures involved in font identification. Similar cases are solved on a per-usage basis on 's tag. |
Which code block is better? foreach (CloudBlockBlob b in allBlobs) { res.Add(b.Name); } or foreach (var listBlobItem in allBlobs) { var b = (CloudBlockBlob) listBlobItem; res.Add(b.Name); } I don't know why "foreach (var ...)" is more popular. | After discussion with colleagues regarding the use of the 'var' keyword in C# 3 I wondered what people's opinions were on the appropriate uses of type inference via var? For example I rather lazily used var in questionable circumstances, e.g.:- foreach(var item in someList) { // ... } // Type of 'item' not clear. var something = someObject.SomeProperty; // Type of 'something' not clear. var something = someMethod(); // Type of 'something' not clear. More legitimate uses of var are as follows:- var l = new List<string>(); // Obvious what l will be. var s = new SomeClass(); // Obvious what s will be. Interestingly LINQ seems to be a bit of a grey area, e.g.:- var results = from r in dataContext.SomeTable select r; // Not *entirely clear* what results will be here. It's clear what results will be in that it will be a type which implements IEnumerable, however it isn't entirely obvious in the same way a var declaring a new object is. It's even worse when it comes to LINQ to objects, e.g.:- var results = from item in someList where item != 3 select item; This is no better than the equivilent foreach(var item in someList) { // ... } equivilent. There is a real concern about type safety here - for example if we were to place the results of that query into an overloaded method that accepted IEnumerable<int> and IEnumerable<double> the caller might inadvertently pass in the wrong type. var does maintain strong typing but the question is really whether it's dangerous for the type to not be immediately apparent on definition, something which is magnified when overloads mean compiler errors might not be issued when you unintentionally pass the wrong type to a method. |
I have 3 files to compile: main.cc transcoder.hpp transcoder.cc The g++ commands I'm running are: g++ -c -Wall -g transcoder.cc transcoder.hpp -I. -lboost_system -pthread g++ -c -Wall -g main.cc -I. -lboost_system -pthread g++ -o main main.o transcoder.o -I. -lboost_system -pthread After the last line, I get an undefined error reference error for when code in main.cc tries to call a function defined in transcoder.hpp/transcoder.cc. Does anyone know what I'm doing wrong? Edit to add code snippets: transcoder.hpp #include <boost/network/protocol/http/server.hpp> namespace transcoder { template<class T> class Transcoder { public: void HandleRequest(const typename ::boost::network::http::server<T>::request& request, typename ::boost::network::http::server<T>::response* response); }; } // namespace transcoder transcoder.cc namespace transcoder { using boost::network::http::server; template<class T> void Transcoder<T>::HandleRequest(const typename server<T>::request& request, typename server<T>::response* response) { // random implementation } } // namespace transcoder main.cc const server<Handler>::request request; server<Handler>::response response ::transcoder::Transcoder<Handler> transcoder; transcoder.HandleRequest(request, &response); Exact error message: main.o: In function `(anonymous namespace)::Handler::operator()(boost::network::http::basic_request<boost::network::http::tags::http_server> const&, boost::network::http::basic_response<boost::network::http::tags::http_server>&)': /some_dir/main.cc:16: undefined reference to `transcoder::Transcoder<(anonymous namespace)::Handler>::HandleRequest(boost::network::http::basic_request<boost::network::http::tags::http_server> const&, boost::network::http::basic_response<boost::network::http::tags::http_server>*)' | Quote from : The only portable way of using templates at the moment is to implement them in header files by using inline functions. Why is this? (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.) |
I am looping through folders, opening a file within the folder with the same name, and doing some manipulation. I'm using sed to manipulate a line: sed "1s/Log R Ratio/$SAMPLE.LRR/" $FILE where $FILE is a file with 1+ spaces in the name. Example: NAT062813_Batch A_1_TR27GD1_CytoScanHD_NL_092913/NAT062813_Batch A_1_TR27GD1_CytoScanHD_NL_092913.txt Is there a way (without going through and renaming things) to use sed with these files? I tried putting quotes around $FILE, but that just printed it out. | Or, an introductory guide to robust filename handling and other string passing in shell scripts. I wrote a shell script which works well most of the time. But it chokes on some inputs (e.g. on some file names). I encountered a problem such as the following: I have a file name containing a space hello world, and it was treated as two separate files hello and world. I have an input line with two consecutive spaces and they shrank to one in the input. Leading and trailing whitespace disappears from input lines. Sometimes, when the input contains one of the characters \[*?, they are replaced by some text which is is actually the name of files. There is an apostrophe ' (or a double quote ") in the input and things got weird after that point. There is a backslash in the input (or: I am using Cygwin and some of my file names have Windows-style \ separators). What is going on and how do I fix it? |
I am working on finding the asymptotic of $\int_0^\infty\frac{\cos x}{x^a} \, dx$ for $a\to0^+$. And I have reduced the problem on finding the asymptotic of $a\int_0^\infty\frac{\sin x}{x^{a+1}} \,d x$. The result is known to be $a\pi/2$ if $a\to0^+$ and there is my proof. $$a\int_0^\infty\frac{\sin x}{x^{a+1}} \,dx = a\int_0^{\pi/2}\frac{\sin x}{x^{a+1}} \, dx + a\int_{\pi/2}^\infty\frac{\sin x}{x^{a+1}} \, dx$$ On the other hand $a\int_0^{\pi/2}\frac{\sin x}{x^{a+1}}\,dx$ behaves as $a\pi/2$ and $a\int_{\pi/2}^\infty\frac{\sin x}{x^{a+1}} \, dx = O(1)$. However the problem is that $a\pi/2$ is way smaller that $1$. Any suggestions would be appreciated. | I came across the following exercise on asymptotic behavior of integrals: $$I(a) = \int_0^\infty\frac{\cos x}{x^a} \, dx, \text{ where } a\to0^+.$$ I have tried integrating by parts or replacing $\cos x$ with the first summands of its Taylor series, but I end up with something equal to infinity (independent of $a$ and that is not what we want). I just thought about the substitution $x \leftrightarrow\frac{1}{1+x^2}$ and I get the following result: $$I(a) = \frac{\cos(1/2)}{2^{2-a}} + \int_0^1\frac{2x^3 \cos\left(\frac{1}{1+x^2}\right)}{(1+x^2)^{3-a}} \, dx - \int_0^1 \frac{2x^3\sin\left(\frac{1}{1+x^2}\right)}{(1+x^2)^{2-2a}}\,dx$$ If I could prove that the last summands are $o(I(a))$ then it would be OK, but I think, in general my strategy won't work. Apparently this is supposed to be an easy exercise, but I can't come up with anything right now. |
I am trying to understand how to quantify the relationship between variables and their principal components, e.g. PC1, and that lead me to consider the information contained in the loadings of each variable for PC1. If the variables are normalized prior to running the PCA, it seems fair to me (am I wrong?) to assume that the loading of a variable is at least somewhat representative of the strength of the relationship between said variable and PC1. But my next question is, how does collinearity of variables impact their loadings? If I recall correctly, in a linear model, if two variables are collinear, then any linear combination of the two in the model would result in pretty much the same thing, as long as the coefficients are only "shifted" between the two variables. Can the same happen for the principal components? EDIT: It seems this is pretty similar, but more details are always welcome | I know that in a regression situation, if you have a set of highly correlated variables this is usually "bad" because of the instability in the estimated coefficients (variance goes toward infinity as determinant goes towards zero). My question is whether this "badness" persists in a PCA situation. Do the coefficients/loadings/weights/eigenvectors for any particular PC become unstable/arbitrary/non-unique as the covariance matrix becomes singular? I am particularly interested in the case where only the first principal component is retained, and all others are dismissed as "noise" or "something else" or "unimportant". I don't think that it does, because you will just be left with a few principal components which have zero, or close to zero variance. Easy to see this isn't the case in the simple extreme case with 2 variables - suppose they are perfectly correlated. Then the first PC will be the exact linear relationship, and the second PC will be perpindicular to the first PC, with all PC values equal to zero for all observations (i.e. zero variance). Wondering if its more general. |
Let $R$ be an integral domain and a Noetherian U.F.D. with the following property: for each couple $a,b\in R$ that are not both $0$, and that have no common prime divisor, there are elements $u,v\in R$ such that $au+bv=1$. I want to show that $R$ is a P.I.D.. Could you give me some hints what we could do to show that $R$ is a P.I.D. ? $$$$ EDIT: Why is an ideal of the form $(x,y)$ principal? | The following is a problem from Dummit & Foote. Let $R$ be an integral domain. Prove that if the following two conditions are true, then $R$ is a principal ideal domain. Any two non-zero elements $a$ and $b$ in $R$ have a greatest common divisor that can be written as $d=ra+sb$, $r,s \in R$ If $a_1,a_2,\dots$ are non-zero elements of $R$ such that $a_{i+1}\mid a_i$ for all $i$, then there exists a positive integer $N$ such that $a_n$ is a unit times $a_N$ for all $n \ge N$. I am a bit confused really. Isn't the first condition sufficient? For e.g. an ideal generated by two elements $a,b$ would be a principal ideal, as any two elements have a gcd. This can then be extended to ideals generated by an arbitrary number of elements by induction. Obviously, there is something wrong in what I am doing. What is the second condition for? I can only think of defining principal ideals generated by the elements in a chain, and then finding a maximal ideal with respect to divisibility. I have no idea. |
In Hebrew, the operation of deducing $$ab=ac \Rightarrow b=c$$ is called "צימצום" [tsimtsum] which translates roughly to "elimination" or "reduction" More specifically for non-abelian groups the above formula would be "Right-elimination" or "Right-sided elimination", and $$ ba=ca \Rightarrow b=c$$ would be "Left elimination" What is the accepted terminology for this in English? | An important group lemma is the left and right cancellation property: $$ \forall a b c: a * b = a * c \implies b = c $$ $$ \forall a b c: b * a = c * a \implies b = c $$ This lemma does not only hold for groups, but also some monoids, for example the free monoid $\Sigma^*$ over an alphabet $\Sigma$. It doesn't hold for all monoids, as monoids with absorbing elements are counterexamples: $$ <\mathbb{Z}, \times> : 0 \times 1 = 0 \times 2 \nRightarrow 1 = 2 $$ What are Monoids with the cancellation property called? |
I've spotted a bug in the mobile view of the network. It's near the notification box and the achievement tracker (top right corner): Those who are used to the mobile view, would be knowing that previously, the "1" or any number would completely hide the notification box, and the "+5" or any such number would completely honest the achievement tracker symbol. Currently these have moved to the right. Hope that the site developers will look into this. | The inbox notification indicator and reputation score indicator are misaligned in the mobile web view. |
My desktop machine is currently running Windows XP (32 bit) on an AMD Sempron processor. For various reasons, this is far from satisfactory, & my plan is to do a complete rebuild, with Ububtu (64 bit) as the operating system. Currently, I have two 500 GB drives set up as a RAID 1 mirror (I believe they are being supported by what's termed "fakeRAID"). Is there a procedure by which, when I have the two drives plugged into the new motherboard, I can then install Ubuntu in such a way as to have it treat them as an existing RAID 1, rather than as two separate discs? Can this be accomplished by running the software RAID manager from the Live USB device, or what do I need to do, assuming I can do anything? | I had: Software: Dual boot with Windows XP Ubuntu 10.04 LTS x32 Hardware Fake RAID 1 (mirroring) with 2x1 TB: Partition 1 - Windows Partition 2 - SWAP Partition 3 - / (root) Partition 4 - Extended Partition 5 - /home Partition 6 - /data arek@domek:/var/log/installer$ sudo fdisk -l Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000de1b9 Device Boot Start End Blocks Id System /dev/sda1 * 63 524297339 262148638+ 7 HPFS/NTFS/exFAT /dev/sda2 524297340 528506369 2104515 82 Linux swap / Solaris /dev/sda3 528506370 570468149 20980890 83 Linux /dev/sda4 570468150 1953118439 691325145 5 Extended /dev/sda5 570468213 675340469 52436128+ 83 Linux /dev/sda6 675340533 1953118439 638888953+ 83 Linux Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000de1b9 Device Boot Start End Blocks Id System /dev/sdb1 * 63 524297339 262148638+ 7 HPFS/NTFS/exFAT /dev/sdb2 524297340 528506369 2104515 82 Linux swap / Solaris /dev/sdb3 528506370 570468149 20980890 83 Linux /dev/sdb4 570468150 1953118439 691325145 5 Extended /dev/sdb5 570468213 675340469 52436128+ 83 Linux /dev/sdb6 675340533 1953118439 638888953+ 83 Linux arek@domek:/var/log/installer$ ls -l /dev/mapper/ total 0 crw------- 1 root root 10, 236 Oct 7 20:17 control lrwxrwxrwx 1 root root 7 Oct 7 20:17 pdc_jhjbcaha -> ../dm-0 lrwxrwxrwx 1 root root 7 Oct 7 20:17 pdc_jhjbcaha1 -> ../dm-1 lrwxrwxrwx 1 root root 7 Oct 7 20:17 pdc_jhjbcaha2 -> ../dm-2 lrwxrwxrwx 1 root root 7 Oct 7 20:17 pdc_jhjbcaha3 -> ../dm-3 lrwxrwxrwx 1 root root 7 Oct 7 20:17 pdc_jhjbcaha4 -> ../dm-4 lrwxrwxrwx 1 root root 7 Oct 7 20:17 pdc_jhjbcaha5 -> ../dm-5 lrwxrwxrwx 1 root root 7 Oct 7 20:17 pdc_jhjbcaha6 -> ../dm-6 I want to upgrade from 10.04 x32 to 12.04 x64 using FRESH installation. |
I am trying to get historical flight data relating to the specific flight. EZY 7153 from Liverpool (LPL) to Arrecife (ACE) The airline states the flight was 2 Hours and 57 Minutes late. I believe that it was over 3Hours The flight stats / log may help ? | Where can I get flight info for a flight a month ago for an insurance claim? Flight stat sites will only show a weeks worth of data. |
I am making a graduate application that requires me to fill "other schools" that I am applying to. It is not a mandatory field. If I choose not to fill, will my application be negatively impacted? Why do they want this? | I understand that schools are trying to gauge the chances of an offer being accepted by a potential candidate. Similarly to what has been described for job applications and other questions that a lower ranked program might not offer admission to someone who applied to just top schools. How much should a candidate divulge about the other schools he/she is applying to? If applying to a top school will it decrease your chances if you are stating you are applying to another top school? I find this kind of questions a bit intrusive and that might even compromise to some degree my application. Perhaps some people that have been in admission commitees can shed some light on the dynamics related to applicants that applied to several schools. |
I'm very new to latex and I'm trying to write a latex document in polish. It contains diacritical marks such as "ą" or "ś" and it all works fine until I try to add some Matlab code to the document. My code also contains polish letters (for example in plot titles) and when I'm trying to create pdf I get a message like the one bellow for every line of Matlab code that contains some polish letters ! Package inputenc Error: Invalid UTF-8 byte sequence. See the inputenc package documentation for explanation. Type H for immediate l.80 xlabel('częstotliwość próbkowania'); Does anyone know what to do to use a diacritical mark in Matlab code in latex? Here's what I use for my MatLab code: \definecolor{greenMatlab}{RGB}{75,150,0} \definecolor{stringColor}{RGB}{170,55,241} \lstset{breaklines=true, framextopmargin=50pt, frame=bottomline, language=Matlab, breaklines=true, morekeywords={matlab2tikz}, keywordstyle=\color{black}, identifierstyle=\color{black}, stringstyle=\color{stringColor}, commentstyle=\color{greenMatlab}, showstringspaces=false, numbers=left, numberstyle={\tiny \color{black}}, numbersep=9pt, emph=[1]{for,end,break}, emphstyle=[1]\color{blue}, } | I'm having some problems with listings and UTF-8 in my document. Maybe someone can help me? Some characters work, like é and ó, but á and others appear at the beginning of words... \documentclass[12pt,a4paper]{scrbook} \KOMAoptions{twoside=false,open=any,chapterprefix=on,parskip=full,fontsize=14pt} \usepackage[portuguese]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{listingsutf8} \usepackage{inconsolata} \lstset{ language=bash, %% Troque para PHP, C, Java, etc... bash é o padrão basicstyle=\ttfamily\small, numberstyle=\footnotesize, numbers=left, backgroundcolor=\color{gray!10}, frame=single, tabsize=2, rulecolor=\color{black!30}, title=\lstname, escapeinside={\%*}{*)}, breaklines=true, breakatwhitespace=true, framextopmargin=2pt, framexbottommargin=2pt, extendedchars=false, inputencoding=utf8 } \begin{document} \begin{lstlisting} <?php echo 'Olá mundo!'; print 'Olá mundo!'; \end{lstlisting} \end{document} \end{lstlisting} |
I'm doing some stuff with my mate's controller, but it won't even sync to my PS4. I did all the tricks and even bought a new sync cable, but nothing seems to work. Can anyone help me with this issue? | I was playing my PS4 two days ago and then packed it up with two controllers that were both connected to this PS4. I got to where I was going, set everything up and now the controllers won't connect. They show pulsing orange when they plug in, but when I hit the PS Button to connect, it blinks white 1-2 times and goes back to orange. I have tried resetting them both. Can anyone help? |
I have a Nokia 5.3 running Android 10. Of the 64GB hard drive space, the system file is currently taking up 52GB. Couple of days back, it was taking up 48GB and my phone was complaining of running out of hard drive space, so I removed some old apps and files to free up some room, and now it looks like the system file has just expanded to take up the available free space, and again it's complaining about running out of hard drive space. How do I go about reclaiming some of the space taken by the system folder(s), as I can't believe that it's needed to write 4GB worth of data in a few days, nor that the OS really needs 52GB of hard drive space, when my old phone only had a 32GB hard drive for the same OS. (apologies, I'm not entirely sure what tags to use for this) | I have critical low storage level and can't understand what takes much of it and how that's possible that the installed applications can use 7 GB? I only use a few social media clients without any games or soft like Photoshop. Also on the second screenshot it indicates that the apps are using just 1.13 GB and so I can't understand the situation. Also what is the "Other"? |
If A,B,C are angles of a triangle show that: $$\tan A+ \tan B+\tan C = \tan A \tan B \tan C $$ I've tried this many times but I cannot seem to prove it, can someone show me how to solve this problem? | I want to prove \begin{equation*} \tan A + \tan B + \tan C = \tan A\tan B\tan C \quad\text{when } A+B+C = 180^\circ \end{equation*} We know that \begin{equation*} \tan(A+B) = \frac{\tan A+\tan B}{1-\tan A\tan B}~\text{and that}~A+B = 180^\circ-C. \end{equation*} Therefore $\tan(A+B) = -\tan C.$ From here, I get stuck. Please help. |
my question is simple - I want to have variable SELECT but this doesnt work, probably because of param type casting. How can I make it work? $statement = $pdo->prepare("SELECT :select FROM hp_data"); $statement->bindValue(":select", $_GET['polozky']); $statement->execute(); $rows = $statement->fetchAll(); Or is it safe to simply put SELECT into query? I guess it is not. $pdo->prepare("SELECT {$_GET['polozky']} FROM hp_data") Thanks in advance. | Why can't I pass the table name to a prepared PDO statement? $stmt = $dbh->prepare('SELECT * FROM :table WHERE 1'); if ($stmt->execute(array(':table' => 'users'))) { var_dump($stmt->fetchAll()); } Is there another safe way to insert a table name into a SQL query? With safe, I mean that I don't want to do $sql = "SELECT * FROM $table WHERE 1" |
Can I teach at a community college with only a Bachelor's degree? I am interested in the liberal arts. Specifically: English. I read someone else's post with a similar question, and the responses really shot it down. That is, of course, teaching with only a Bachelor's. But I found on another site: Higher Ed Jobs, many community colleges require only a Bachelor's. Do they want the candidate to be a PHd student or something? | Can someone with a bachelor's degree teach at a community college, or are they required to have something more? |
I want to set relative path to folder with my executive script that will works from any machine without hardcoding absolute path to file. So far I have following: import os path_to_folder = os.path.realpath('.') When I run my script from PyCharm calling print(path_to_folder) return correct path C:\Users\Me\Desktop\Project\Script\ But if I try to call it from cmd like python3.4 C:\Users\Me\Desktop\Project\Script\my_script.py I get just C:\Users\Me\ What is the more reliable way to set relative path? | I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. For example, let's say I have three files. Using : script_1.py calls script_2.py. In turn, script_2.py calls script_3.py. How can I get the file name and path of script_3.py, from code within script_3.py, without having to pass that information as arguments from script_2.py? (Executing os.getcwd() returns the original starting script's filepath not the current file's.) |
I bought a new ps4 controller and I’m trying to sync and use it wirelessly to my PS4 ,but everytime I do the LED lights wouldn’t come on without the USB. I’ve done all the resets and turn my PS4 on and off and even gotten a new USB cord and I’m still having this problem | I was playing my PS4 two days ago and then packed it up with two controllers that were both connected to this PS4. I got to where I was going, set everything up and now the controllers won't connect. They show pulsing orange when they plug in, but when I hit the PS Button to connect, it blinks white 1-2 times and goes back to orange. I have tried resetting them both. Can anyone help? |
Is it possible to vertical align a image (variable height) in a div? And that it work in IE 7 and up? I know that it can be done with the display : table-cell but the table-cell is not supported in IE 7... I hope somewone has a solution? | I have a div with two images and an h1. All of them need to be vertically aligned within the div, next to each other. One of the images needs to be absolute positioned within the div. What is the CSS needed for this to work on all common browsers? <div id="header"> <img src=".." ></img> <h1>testing...</h1> <img src="..."></img> </div> |
I have a C++ program that uses the equation $$\zeta(s)=\sum_{n=1}^\infty\frac{1}{n^s}$$ to calculate the Riemann zeta function. This equation converges fast for larger values, like 183, but converges much slower for smaller values, like 2. For example, calculating the value of $\zeta(2)$ took an hour to be accurate to 5 digits, but one second for $\zeta(183)$ to be accurate to 100 digits. Are there any equations for calculating the Riemann zeta function that are faster for calculating smaller values? Because I am coding in C++, I cannot use $\int$ (without implementing external libraries, which is not really an option here). | How do I evaluate this function for given $s$? $$\zeta(s) = \sum_{n=1}^\infty \frac1{n^s} = \frac{1}{1^s} + \frac{1}{2^s} + \frac{1}{3^s} + \cdots$$ |
When I am check multiple check boxes form jQuery dialog box form attempt to update I used the below code: $(".chk").prop('checked', true); and the same code when i click UncheckAll not removed checked attribute i used the below code $('.chk:checkbox').prop('checked', false); then i changed to $(".chk").val(0); $(".chk").removeAttr("checked"); console.log(this); //Here remove all checked attribute but when i submit the form that form not updated the same thing click CheckAll working fine but UncheckAll not working what is the problem <input type="checkbox" class="chk" id="meters" name="Ids" value="0" ></input> In my jps page multiple elements are there with name Ids i am expected array of Ids[0] in my form but the result is ids[2,3] like this I am using jquery 1.9.1 api | I'd like to do something like this to tick a checkbox using jQuery: $(".myCheckBox").checked(true); or $(".myCheckBox").selected(true); Does such a thing exist? |
As root `Failed to run gdebi-gtk '--non-interactive' '/home/cheesymelon/Downloads/steam_latest.deb'` Unable to copy the user's Xauthorization file. That was what it said when I tried to install package, I don't know how to fix it, please help . BTW I am using a chromebook with crouton | How can I install and run on Ubuntu? |
$A$ is a $m \times n$ matrix and $B$ is a $m \times m$ matrix. I have that if a vector $x$ is in the kernel of $A$, then $Ax=0$, so that vector $x$ would be also in the kernel of $BA$. Then, from the rank nullity theorem I get that the nullity of $A$ is $n-rank(A)$ and the nullity of $BA$ is $m-rank(BA)$ | I am given the info that A is an invertible m by m matrix and B is a m by n matrix. By solving for the null space $ABx=0$, I get $A^{-1}ABx=A^{-1}0$, therefore $Bx=0$. I concluded that the null spaces of A and AB must be equivalent, and therefore the nullity(AB) = nullity(B) = some number p. Therefore rank(AB) = n-p = rank(B) (because both AB and B are m by n matrices). Is this proof valid, specifically the null space step? |
Given an 8x8 Mboard ( top left piece missing), as given below in the image, and 21 trominoes, how can we proof that there exists a configuration where there will be no overlap after all trominoes are placed. What I tried doing was - a 8x8 Mboard will have 63 squares, now $63 / 21 = 3$, ie. it is divisble. But recall a tromino is L-shaped, so just show that the total number of squares is divisble with the total number of trominoes really isnt telling much. I mean how do you account for the shape of the tromino in that case. I actually manually plotted out a configuration but could only get up 20 trominoes to fit. I have no idea how 21 fits in, and how we can say that there will be no overlap. The red squares are the squares that were blank. There are 3 of them, but how can we rearrange the configuration to included 21 trominoes. And more than that how can we say that there will be no overlap? | Suppose we have an $2^n\times 2^n$ board. Prove you can use any rotation of L shaped trominoes and a monomino to fill the board completely. You can mix different rotations in the same tililng. |
I have done all these sudo apt-get update && sudo apt-get upgrade sudo apt-get dist-upgrade sudo add-apt-repository ppa:phablet-team/tools sudo apt-get update sudo apt-get install phablet-tools android-tools-adb android-tools-fastboot its 12.04 LTS i think... | Occasionally, when I'm installing stuff, I get an error like the following: Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed E: Unable to correct problems, you have held broken packages. How can I resolve this? |
The All Setting Brightness & lock do not stop the screensaver | When I'm watching a film in Mythtv the screen turns to black every 10 - 15 mins and I have to log back into Ubuntu. Very annoying! How do I disable the black screen / screensaver / logout in Unity? There no longer seems to be any options to turn the screen saver off as there were in Ubuntu prior to Unity. |
How can I transpile using universal $Clifford + T$ gates set? I have only seen examples using rotations + $CNOT$. This is what I have tried from qiskit import * from qiskit.quantum_info import Operator from qiskit.compiler import transpile %matplotlib inline u = Operator([[0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0]]) qc = QuantumCircuit(3) qc.unitary(u, [0,1,2], label='u') result = transpile(qc, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=3) result.draw(output='mpl') And this example works fine. But when I was trying to set: basis_gates=['h', 's', 't', 'cx'] It doesn't work. Could you help me, please?) UPDATE: After comments I've tried this: pip install git+https://github.com/LNoorl/qiskit-terra.git@feature/sk-pass and then: from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import TGate, HGate, TdgGate, SGate from qiskit.transpiler.passes import SolovayKitaevDecomposition from qiskit import * from qiskit.quantum_info import Operator from qiskit.compiler import transpile %matplotlib inline u = Operator([[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, -1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1]]) qc = QuantumCircuit(3) qc.unitary(u, [0,1,2], label='u') print('Orginal circuit:') print(qc) basis_gates = [TGate(), SGate(), HGate()] skd = SolovayKitaevDecomposition(recursion_degree=2, basis_gates=basis_gates, depth=5) discretized = skd(qc) print('Discretized circuit:') print(discretized) But it outputs only this: Orginal circuit: ┌────┐ q_0: ┤0 ├ │ │ q_1: ┤1 u ├ │ │ q_2: ┤2 ├ └────┘ Discretized circuit: ┌────┐ q_0: ┤0 ├ │ │ q_1: ┤1 u ├ │ │ q_2: ┤2 ├ └────┘ Where is a problem? | I know the Solovay-Kitaev algorithm can achieve this. Is there an implementation of this or any other algorithm for the same task in Qiskit? Or perhaps some other library that interfaces well with Qiskit? |
This is question 2.6 of textbook Apostol introduction to analytic number theory and I am unable to solve it. Prove that $\sum_{d^2 | n} \mu(d) = {\mu}^2(n) $ . RHS = r where $n = p_{1} ... p_{r} {p_{r+1}}^{a_{r+1}}...{ p_{k}}^{a_k} $ , $a_{r+i}$ such that i>0 . But i am not able to prove lhs equal to it. So, can you please help! ! | Let $\mu$ be the . Then prove that $\sum \limits_{d^2|n}\ \mu (d)=\mu^2(n)$, and more generally $$ \sum \limits_{d^k|n}\ \mu (d) = \begin{cases} 0 &\text{if } m^k \mid n \\ 1 &\text{otherwise.} \end{cases}$$ |
My Code: DELETE FROM doctorreport WHERE id IN ( SELECT id FROM doctorreport GROUP BY id HAVING COUNT(*) > 1) LIMIT 1 Error: #1093 - You can't specify target table 'doctorreport' for update in FROM clause | I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries: SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id); I tried to delete them executing: DELETE FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id); But I get the next error: #1093 - You can't specify target table 'story_category' for update in FROM clause How can I overcome this? |
I want to download Portal for ArcGIS, but I am not finding the link to download it. Where I can download Portal for ARCGIS? | How can I install Portal for ArcGIS? I have installed ArcGIS for server 10.1 on linux. I read in ArcNews that . How can I enable it? |
(define (delete-list my-list element) (if (null? my-list) '() (if (eqv? (car my-list) element) (cdr my-list) (append (list (car my-list)) (delete-list (cdr my-list) element))))) (delete-list '('aaa 'bbb) 'aaa) ; ==> ('aaa 'bbb) Why doesn't this code output ('bbb)? How to solve this problem? | After making it through the major parts of an introductory Lisp book, I still couldn't understand what the special operator (quote) (or equivalent ') function does, yet this has been all over Lisp code that I've seen. What does it do? |
Here is my calculator program /*program calculator */ import java.util.Scanner; class calculator { public static void main (String args[]) { System.out.println("First enter two number , then type Sum for addition, Sub for subtraction, Mul for multiplication, Div for division"); int x, y; Scanner in = new Scanner(System.in); System.out.println("Enter 1st number"); x = in.nextInt(); System.out.println("Enter 2nd number"); y = in.nextInt(); System.out.println("Enter Sum for addition, Sub for subtraction, Mul for multiplication, Div for division"); String z = in.next(); if (z = "Sum") {a = x + y;}; if (z = "Sub") {a = x - y;}; if (z = "Mul") {a = x * y;}; if (z = "Div") {a = x / y;}; System.out.println("Result of entered two number = "+z); } } It is showing an error "incompatible types" in statement if (z = "Sum") {a = x + y;}; and I think it must have more mistakes. I am a beginner. I would like to make this program perfect with no errors, so it work exact same like a small calculator. | I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug. Is == bad? When should it and should it not be used? What's the difference? |
I have just installed ubuntu-gnome-16.04 flavor on my notebook and am quite pleased with it. But natural scrolling was not really working. I have followed some answers on these questions: After installing xserver-xorg-input-libinput, in particular gave me what I wanted, but only until I reboot. How can I make this permanent? Why this is not a duplicate: I am not looking for a way to run this command every time I boot ubuntu. I am looking for a proper way of change the settings without the need to run this command arbitrarily every time I boot. Specially, I am trying to avoid putting this command to change a setting anywhere it doesn't belong. I had previously managed to make it work by making the command run on by appending it to ~/.bashrc. But leaving it there felt unnatural. Maybe I am wrong, but I have the feeling this is not the proper place to make this setting change even if it does work | How can I make an application automatically start when I have logged in? |
I'm using Illustrator and doing a typography course. In order to create a bit more visual weight, I'm trying to mimic the idea of sound resonance through color. In this image I simply use the blend tool to duplicate the type and after creating outlines and expanding the shape I try using the radial gradient as I need the center to be dark and the last blocks of type to be grey. What happens instead is that every letter gets its own gradient. Can you guys think of a smart way to go around this. I've found a solution to my issue by manually lowering the opacity, but I'm wondering if there's a more efficient way to approach this. Thanks | I have two separate objects that I have applied gradient fill to. The gradient fill seems to only apply to the objects as individuals. I tried grouping the shapes, but that doesn't seem to change the gradient. How do I get one gradient to cover all my shapes? |
I THINK I asked a question on Stack Overflow years ago, but I can't find it. Was it deleted / removed? How do I tell? From my memory (which could be false), the question was about "entropy" and asked on either Stack Overflow or Cross Validated. The question probably had an "R" tag. Reading through the auto-deleted criteria or , I doubt it met the criteria. Again from memory, the question received at least 1 answer and a handful of comments. How does one tell if a question was deleted / removed (e.g., are there notifications or timeline indicators)? If a question was indeed deleted, how does one find it? Note: while I am curious as to the why my question might have been deleted (the context), my core questions is how to tell if question is deleted. | What circumstances can cause a question or answer to be deleted, and what does that actually mean? How can a post be deleted? When can't I delete my own post? Can I still see my post even after it's deleted? Can I see a list of my deleted posts? How can I undelete one of my posts? What does deletion mean for a post? How do votes to delete work? What are the criteria for deletion? What else should I know about deleted posts? If I flag my question with a request to delete it, what will happen? For more information, see the articles about and in the . |
I thought arrays are passed by reference - so when I pass str into replaceSpaces, the method returns 'Mr%20John%20Smith' as a char array which is right, but when it returns back to the main method, the char array goes back to its original value of "Mr John Smith ". public static char[] replaceSpaces(char[] s, int n) { String result = ""; for(int i=0; i<n; i++) { if(s[i]==' ') { result+="%20"; } else { result+=s[i]; } } s=result.toCharArray(); return s; } public static int findLastCharacter(char[] str) { for (int i = str.length - 1; i >= 0; i--) { if (str[i] != ' ') { return i; } } return -1; } public static void main(String[] args) { String str = "Mr John Smith "; char[] arr = str.toCharArray(); int trueLength = findLastCharacter(arr) + 1; replaceSpaces(arr, trueLength); System.out.println("\"" + AssortedMethods.charArrayToString(arr) + "\""); } | I always thought Java uses pass-by-reference. However, I've seen a couple of blog posts (for example, ) that claim that it isn't (the blog post says that Java uses pass-by-value). I don't think I understand the distinction they're making. What is the explanation? |
I'm applying for a UK Visa using the newest portal. One section is called Convictions and other penalties and asks At any time have you ever had any of the following, in the UK or in another country?. One voice is the following: A penalty for a driving offence, for example disqualification for speeding or no motor insurance. I remember I received a ticket because I once overtook another car on the white stripes. It was probably 15 years ago but here they ask for the day, month and year, and I have absolutely no idea when this happened exactly. Moreover, on the next page they say: You must tell us about fixed penalty notices (e.g. a speeding or parking ticket) if you've received three or more. If you received a fixed penalty notice but didn't pay the fine and there was a criminal proceeding resulting in a conviction, tell us here. Isn't this in contrast with what said before? Does this mean that if I received only 1 ticket I do not have to include it? | I have been filling in the UK visitor visa application online, and there is a section under convictions and other penalties: A. Penalty for driving offences, e. g., disqualification for speeding or no insurance Last year, in Australia, I received fine for not stopping at a red light, caught on a traffic camera, and incurred 3 demerit points on my driving record. Do I need to declare that under this section? It never went to court. I received the notice of the fine by mail, and paid it in full. I have checked with the Australian authorities who confirmed that I do not have a criminal record for this; it is only recorded on my driving licence. Is it something that is expected to be declared on the visitor application form? I wouldn't mind disclosing it, as it is a common traffic offence and a lot of people have the same on their licence. I am worried that it might be a reason to be refused a visa. |
Consider the following calculation 3 * 20.9 normally it equals to 62.7. However, when I calculate it in javascript, the output is 62.699999999999996. And what's more I found that 7, 11 will also produce the wrong answer. Why it goes wrong and how to make it right? I think it's about the binary? | Consider the following code: 0.1 + 0.2 == 0.3 -> false 0.1 + 0.2 -> 0.30000000000000004 Why do these inaccuracies happen? |
Is it possible to bypass hist_verify for specific history commands? For instance, I rarely have the need to verify !$ or !!, whereas I find verification to be a useful feature for more complicated history expansions. Can select history operators be excluded from history verification? | Is it possible to make shopt -s histverify ignore !! (execute it without verifying) but still verify other history expansions, such as !rm ? |
It looks like something's seriously wrong... My Air should have 4 cores. However, I saw that the number of cores has sunk to 2 when I was going to make a new virtual machine... I checked out what System Information says and the result doesn't match with the one I get by running htop in Terminal. Please, check out these screenshots: htop: System Information: I don't understand... Any help is hugely appreciated! | I checked the specs, and the i5-3427U CPU has 2 cores. But the Activity Monitor shows 4 little charts for the CPU, so it looks like 4 cores. Which is correct? Why does the Activity Monitor have 4 charts? |
I have a very old laptop that runs windows XP (I think it originally came with vista?) It has an intel centrino 2 vPro duo core p8400 @2.26 GHz processor with 2 GB RAM I am trying to load the 18.04 LTS version of Ubuntu which needs a 64bit processor. Obviously I'm having trouble and I’m not sure if it is because of the processor or not? I was under the impression that duo core processors were 64 bit. Can anyone confirm or deny this and how would I find out this information? | I was told that computers with more than 2 gig's memory need a 64 bit operating system to utilize all RAM. Is the 64bit Ubuntu download really JUST for AMD processors? I am asking because the disk image I downloaded says AMD64. So will my new Intel 2.3Ghz Core i3 Dual Core processor work with 64 bit Ubuntu? It runs the 64bit version of Windows without any qualm. |
New to Maven... I have succeeded in creating a jar for my app. I'd like to run the app from this jar "java -jar foo.jar MyClass" but I have no idea where to get (and package) all the dependencies. Does maven have a goal to do this? If not, do I use something like proguard? And then how do I thread that into the maven goals? Thanks in advance | I want to package my project in a single executable JAR for distribution. How can I make a Maven project package all dependency JARs into my output JAR? |
You're a friend of Tom's, aren't you? Question: What does the 's in Tom's stand for? | I have often heard people say "x of his" or "x of mine". But since his and mine point out ownership, isn't using "of" here doubles that ownership? Wouldn't it be more appropriate to say "x of him" or "x of them" etc.? Example: I was a good friend of your dad's. He told me all about you` |
A few months ago I discovered that my network profile flair had stopped appearing as before, and instead it was showing that I don't have any linked accounts with 200+rep. Like this question: I did search for a while to find a solution at that time with no success. Then I thought that it could be something temporary. But today some months later, the flair is still not displaying correctly. I am going rounds around, logging-in/out but nothing changes... and I can't find anywhere the answer. Is there any problem with the network flair? Is it something I did wrong? How to fix this? This is not a duplicate with that other question: that answer doesn't address my issue. My question actually proved to be a how to do something on SE that I didn't know and couldn't find the answer, rather than reporting a bug on a feature. | The combined flair started to display in this week site icons from hidden accounts. For example, this is my current flair: The freehand red circle shows a hidden community that you can't see in my . This issue looks to me as a privacy issue. Being associated with a SciFi community or Arqade is not a bad thing for my serious work-only profile, but it could be indeed an issue for people trying to hide association with a religious community due to the dark times that we are living on. I know that this question is similar to , but I'm posting this as of Adam Lear |
A question similar to , but a little different. We know as mentioned in the tagged question that Polyjuice potion will account for injuries, such as Mad-Eye's in Goblet of Fire. How tight is the timeline though? Say Person A were to steal a hair from person B to use in Polyjuice potion, and then Person B were to receive some large and noticeable injury, would Person A assume that injury with the potion, or would they need to grab a new hair? | We know that if you (using Polyjuice), take the form of someone who had been injured, you assume that injured form (e.g. Barty/Moody). If you are injured, presumably you would be uninjured while under Polyjuice. My question is, is this in real-time? That is, if you take a Polyjuice, and while you're still under its effects, the person being transformed into gets injured (or even dies), will that injury be transferred onto you? And conversely, if you get injured while in someone else's body, will that transfer over to your real body after the Polyjuice wears off, will it disappear, or will it go to the person you turned into? |
The reputation pane in the new activity tab shows I have achieved a gold badge for the tag: However, my score isn't high enough and the badges section doesn't show that badge. | On Stack Overflow, I have 428 questions answered with a total score of 775 as of the writing of this post. It seems that this is happening to a lot more people than just me. (Only possibly related)? |
I'd like to combine the contents of A1 "Hello," with the contents of B1 "It's Me" in the cell C1 so it will read "Hello, It's Me." I know I can do it manually, but I have to repeat the process several times, so I was hoping there was a command for that. I am using excel for Mac. | Column A has first name. Column B has last name. I need column C to be "display name" (first name and last name separated by a space). I assume this involves the concatenate function. Bonus Question: Column D is email address. I need column E to be "username" (everything in email address left of the @ symbol). I assume this involves some regular expression function. |
I have a file context.xml which contains following.. <import resource="beans.xml"/> I need to comment this line as follows using batch file.. Please help.. Thanks in advance.. <!--import resource="beans.xml"/--> I tried this.. But its not working.. @echo off setlocal enableextensions enabledelayedexpansion set "search= <import resource="beans.xml"/> " set "replace= <!--import resource="beans.xml"/--> " set "textFile=context.xml" for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do ( set "line=%%i" setlocal enabledelayedexpansion set "line=!line:%search%=%replace%!" >>"%textFile%" echo(!line! endlocal ) | I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions? |
I have installed Ubuntu 14.04 on my system. Initially Wi-fi successfully connected to a networ. E.g.: "Mario" After a while, I deleted "Mario" from edit connections. Then I tried to connect to the same Wi-fi again but it's not working. Why? How can I solve the problem? | I have installed Ubuntu 15.04 on my laptop with RTL8723BE Wi-fi card. But it is always disconnecting from network. I have tried echo "options rtl8723be fwlps=N ips=N" | sudo tee /etc/modprobe.d/rtl8723be.conf but that didn't helped. What can I do to prevent the wifi from disconnecting? If I upgrade to kernel 4.X, will it help? ~$ lspci -knn | grep Net -A2 09:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter [10ec:b723] Subsystem: Hewlett-Packard Company Device [103c:2231] Kernel driver in use: rtl8723be ~$ rfkill list 0: hci0: Bluetooth Soft blocked: yes Hard blocked: no 1: phy0: Wireless LAN Soft blocked: no Hard blocked: no ~$ ifconfig && iwconfig && route -n && ping -c 1 google.com eth0 Link encap:Ethernet HWaddr 38:63:bb:cd:4a:7e UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:53 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:752 (752.0 B) TX bytes:8445 (8.4 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:3870 errors:0 dropped:0 overruns:0 frame:0 TX packets:3870 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:314613 (314.6 KB) TX bytes:314613 (314.6 KB) wlan0 Link encap:Ethernet HWaddr c0:38:96:6d:c4:83 inet addr:192.168.1.205 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::c238:96ff:fe6d:c483/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:15240 errors:0 dropped:0 overruns:0 frame:0 TX packets:14627 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:14410285 (14.4 MB) TX bytes:2192744 (2.1 MB) eth0 no wireless extensions. wlan0 IEEE 802.11bgn ESSID:"DIR-615" Mode:Managed Frequency:2.437 GHz Access Point: 00:90:4C:08:00:0D Bit Rate=150 Mb/s Tx-Power=20 dBm Retry short limit:7 RTS thr=2347 B Fragment thr:off Power Management:off Link Quality=70/70 Signal level=-22 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:186 Missed beacon:0 lo no wireless extensions. Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 400 0 0 wlan0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 PING google.com.Dlink (172.26.136.19) 56(84) bytes of data. 64 bytes from 19.136.26.172.in-addr.arpa (172.26.136.19): icmp_seq=1 ttl=249 time=102 ms --- google.com.Dlink ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 102.547/102.547/102.547/0.000 ms |
My friends and I are having a stupid argument about this sentence: Someday this pain will be useful to you. I claim “this” in this sentence is an adjective modifying pain, but they claim it is a demonstrative pronoun in this instance. Can someone please confirm what part of speech it is? This does not seem hard to me but they seem so confident against it. | Question 1: In the following, is this a demonstrative determiner: I will go to the store this week. Question 2: If so, then what class is next in the following: I will go to the store next week. Question 3: It seems that both serve the same grammatical syntax and function here; are they therefore classified the same? (If not, why not?) |
I duplicated a mesh and I want to make it a different object than the original, how do you do that? | I added two torus objects, and when I click one of them, it also selects the other. They both share the same node thing. I want to delete one of them, but it keeps on deleting the other with it. I can't even undo placing the second torus without removing the other. |
I am a Indian passport holder with a Schengen Visa (type C, valid from May'18 to May'19, 90 days stay). I'm in Sweden since May'18 (till Nov'18) with a Schengen visa and I also have a Swedish work-permit (valid from July'18 to Jan'19). Now I am traveling back to India (in Nov'18), but what about the validity of my Schengen Visa with regard to the 90/180 rule? Can I travel in other Schengen countries until visa is valid ? | I am a citizen of the Republic of Macedonia. This summer, I spent 7 days in Croatia and a little bit over 3 months in Switzerland. I had a Swiss national visa (type D) valid for 3 months, as I performed an internship during that period. The "little bit over" (just a few days) period I stayed there as a tourist. In other words, I spent around 10 days as a tourist in the Schengen area, and 3 months on a type D visa. My question now is: do the days spent on a type D visa count towards the 90/180 days rule? I would like to travel to the Schengen area soon (as a tourist), but I'm afraid that wouldn't be possible if those 3 months counted toward the 90/180 days rule. |
Hey is there any known combinatorial formula for nth fibonacci number? (n+1)th fibonacci number is given by summation of r=0 to (round)n/2:C(n-r,r) Can someone verify the formula?Help! | If $F_n$ is the $n$-th fibonacci number, then prove that, $$F_n={n-1 \choose 0 }+{n-2 \choose 1 }+{n-3 \choose 2 }+\ldots$$ I tried the idea of using Pascal's triangle, but it seems to need some adjustment, so I am stuck, please help. Any combinatorial argument would be of greater help than rigorous proof. Thank you. |
i read that you can just use .all { margin: auto; width: 50%; } but that doest work for my case because the browser make it auto margin left and right , and it make the width to 50% but it doesnt make my div start from the center. it do that and start in the left ,also all items get messed up. this is my html code <div class = "all"> <div class="one"> 1 </div> <div class="text"> Januarry 1 2016 </div> </div> this is my css code .all{ display: inline-block; border: 1px groove; box-shadow: 5px 5px 10px black; } .one { background-color:green; color:white; font-size: 150px; display: inline-block; padding-right:120px ; padding-left: 120px; padding-top:40px; padding-bottom:40px; } .text { font-size:25px; text-align: center; padding: 30px; } so how can i center all of the div (class ("all")) | How can I horizontally center a <div> within another <div> using CSS? <div id="outer"> <div id="inner">Foo foo</div> </div> |
I have to calculate sum of series $\sum \frac{n^2}{n!}$. I know that $\sum \frac{1}{n!}=e$ but I dont know how can I use that fact here.. | For some series, it is easy to say whether it is convergent or not by the "convergence test", e.g., ratio test. However, it is nontrivial to calculate the value of the sum when the series converges. The question is motivated from the simple exercise to determining whether the series $\sum\limits_{k=1}^{\infty}\frac{k^2}{k!}$ is convergent. One may immediately get that it is convergent by the ratio test. So here is my question: What's the value of $$\sum_{k=1}^{\infty}\frac{k^2}{k!}?$$ |
how do I to edit table's caption's name ? Transformation : "Table" --->> "Tableau" | I'd like to modify the names used to typeset some of my document elements. For example, the caption of figure floats should change from "Figure" to "Fig.", and my \tableofcontents sectioning heading shouldn't read "Contents", but "Table of Contents". How can I do that? \documentclass{article} % \usepackage[english]{babel} \begin{document} \tableofcontents \section{foo} \begin{figure}[h] \centering \rule{1cm}{1cm}% placeholder for graphic \caption{A figure} \end{figure} \end{document} |
I am trying to use hibernate5 with sqlite3, but always getting exception org.hibernate.TransactionException: Unable to commit against JDBC Connection at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.commit(AbstractLogicalConnectionImplementor.java:86) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:231) at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:65) at market.dal.hibernate.HibernatePurchaseHistoryRepository.saveAll(HibernatePurchaseHistoryRepository.java:20) at jobs.LoadLastPurchasesJob.execute(LoadLastPurchasesJob.java:52) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.sql.SQLException: database is locked at org.sqlite.core.DB.throwex(DB.java:859) at org.sqlite.core.DB.exec(DB.java:142) at org.sqlite.jdbc3.JDBC3Connection.commit(JDBC3Connection.java:165) OS: Ubuntu 14.04 SQLite dialect downloaded from: My hibernate.cfg.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="show_sql">false</property> <property name="format_sql">true</property> <property name="dialect">org.hibernate.SQLiteDialect</property> <property name="connection.driver_class">org.sqlite.JDBC</property> <property name="connection.url">jdbc:sqlite:mydb.db</property> <property name="connection.username">admin</property> <property name="connection.password">admin</property> <property name="hibernate.hbm2ddl.auto">update</property> <property name="hibernate.current_session_context_class">org.hibernate.context.internal.ThreadLocalSessionContext</property> <mapping resource="market/dal/hibernate/mapping/TestItem.hbm.xml"/> </session-factory> </hibernate-configuration> My code (very simple): public static void main(String[] args) throws Exception { SessionFactory sessionFactory = configureHibernateSessionFactory(); Session session = sessionFactory.openSession(); Transaction transaction = session.beginTransaction(); try { try { session.saveOrUpdate(new TestItem(1,"test")); session.flush(); transaction.commit(); } catch (Exception e) { transaction.rollback(); e.printStackTrace(); } } finally { if (session != null) { session.close(); } } } private static SessionFactory configureHibernateSessionFactory() throws HibernateException { // A SessionFactory is set up once for an application sessionFactory = new Configuration() .configure() // configures settings from hibernate.cfg.xml .buildSessionFactory(); return sessionFactory; } I was really confused, because my code is very simple, but it doesn't work. What i need to do to avoid "database is locked" exception? EDIT: I disagree that this question is duplicate of . I not found no one working solution for me in that question answers. Also i have only one working process for my db file (fuser dbfile). It looks like a bug or peculiarity of Hibernate. | sqlite> DELETE FROM mails WHERE (`id` = 71); SQL error: database is locked How do I unlock the database so this will work? |
I want to install Ubuntu as primary OS. How should I do the partitioning to get maximum output? I am java/Liferay developer. My system configuration is: dual core 4 gb ram. | I need my pre-installed version of Windows 7 (or any other version of Windows), how could I install Ubuntu without erasing it? |
This is my first time trying to import plots created by MATLAB into LaTeX and it's not turning out very nicely. I have saved my MATLAB plot as a .png file and an .eps file . Using the .eps file, I have the following code: \documentclass[twoside, a4paper, 12pt]{article} \usepackage{graphicx} \begin{document} \begin{center} \includegraphics[scale=0.6]{graph2.eps} \end{center} \end{document} which turns out to look like: (half the image is missing) So then I changed the scale to 0.4: \includegraphics[scale=0.4]{graph2.eps} which produces the output: However now the image is way too small to be eligible (and it doesn't feel like it's centered properly). Does anyone have a good solution for this? How can I get the image to look "good" when imported into LaTeX? Thanks. EDIT: I have saved the three plots separately: The first graph is called g1 and can be found g2 can be found and g3 can be found How can I combine them into one figure using the tabular environment? Could someone provide a template code? | How can I put two figures side-by-side? Not two sub-figures, but two actual figures with separate "Fig.: bla bla" captions. A figure is supposed to spread over the entire text width, but I have two figures which are narrow and long, and I need to save the space in order to withstand the pages limit. |
I use a program called SimpleScreenRecorder to record videos for YouTube. I was having a problem with it when trying to launch it so I decided to reinstall it. When I try to run the command sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder it tells me this: Traceback (most recent call last): File "/usr/bin/add-apt-repository", line 91, in <module> sp = SoftwareProperties(options=options) File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__ self.reload_sourceslist() File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist self.distro.get_sources(self.sourceslist) File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources (self.id, self.codename)) aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Ubuntu/xenial This does not happen when I run sudo apt-get update and it says this (just in case something is wrong here too) Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB] Get:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Fetched 204 kB in 1s (178 kB/s) Reading package lists... Done When I try to run sudo apt-get install simplescreenrecorder it gives me this output: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package simplescreenrecorder and SimpleScreenRecorder does not install. The exact same thing happens when I try to install LiVES even down to the same outputs and I had the same problems. I am running Ubuntu 16.04.2 | When I attempt to install anything using apt-get I get the following error: Traceback (most recent call last): File "/usr/bin/add-apt-repository", line 60, in <module> sp = SoftwareProperties() File "/usr/lib/python2.6/dist-packages/softwareproperties/SoftwareProperties.py", line 90, in __init__ self.reload_sourceslist() File "/usr/lib/python2.6/dist-packages/softwareproperties/SoftwareProperties.py", line 538, in reload_sourceslist self.distro.get_sources(self.sourceslist) File "/usr/lib/python2.6/dist-packages/aptsources/distro.py", line 90, in get_sources raise NoDistroTemplateException("Error: could not find a " aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template Any idea what this means and how to resolve it? |
I found a question that is marked as duplicate, even though it seems to not be a duplicate and has a different intent. How can I get the question reopened? The question was posted by someone else (not me). | To reopen a closed question, must agree that the question is suitable for the site and cast votes to reopen the question. But: How does one actually vote to reopen? Is there a reputation level that you must have before you can see this function? Or do I just leave a comment along the lines of, "I vote to reopen"? What happens if someone with less than 3000 reputation leaves a comment that they wish to vote to reopen? How can one draw attention to their closed questions? Is it done via a posting new question? Or do you edit the closed question? Related: For more information, see "" in the . |
I have a Postfix mail that I have configured pretty good. mail-tester.com gives me a 10/10. I have tested on both Google and Yahoo, and checked their headers. Nothing seems to be wrong in the headers. Authentication-Results: mta4213.mail.bf1.yahoo.com; dkim=pass (ok) [email protected] header.s=mail; spf=pass [email protected]; dmarc=pass(p=quarantine sp=NULL dis=none) header.from=mymail.com; I am not blacklisted anywhere and this mail address was never used for spam. I have checked lots of resources before coming here, but couldn't find any solutions. I don't think this is a duplicate question (I mean this is a common issue, but none of the answers worked out for me). | This is a about how to handle email sent from your server being misclassified as spam. For additional information you may find these similar questions helpful: Sometimes I want to send newsletters to my customers. The problem is, that some of the emails get caught as spam messages. Mostly by Outlook at the client (even in my own Outlook 2007). Now I want to know what should be done to create "good" emails. I know about reverse lookup etc., but (for example), what about a unsubscribe link with an unique ID? Does that increase a spam rating? |
I'm building a simple hangman game right now, and I want to be able to identify where in a list a user guesses a specific letter. For example, if the word list was [D,R,A,G,O,N] -- and the user guesses A, I want to be able to get a return that would say 4...this is my failed code so far import random word_list = ['red', 'better', 'white', 'orange', 'time'] hidden_list = [] selected_word = random.choice(word_list) letters = len(selected_word) selected_word_list = list(selected_word) game_playing = True print('My word has ' + str(letters) + ' letter(s).') print(selected_word_list) for i in selected_word_list: hidden_list.append('_') while game_playing: print(hidden_list) guess = input('What letter do you want to guess?') if guess in selected_word_list: print('Nice guess!') else: print('Nope!') | Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index (1) in Python? |
How can i unit test a private method, which is in a private static class. public class ProjectModel { //some code private static class MyStaticClass{ private model (Object obj, Map<String , Object> model) } } I tried to realise that its give NoSuchMethodException Method method = projectModel.getClass().getDeclaredMethod("model", methodParameters); | How do I unit test (using xUnit) a class that has internal private methods, fields or nested classes? Or a function that is made private by having (static in C/C++) or is in a private () namespace? It seems bad to change the access modifier for a method or function just to be able to run a test. |
Let $I:=[a,b]$ and let $g: I \to \Bbb R$ be continuous on $I$. Suppose that there exists $K > 0$ such that $$|g(x)| \leq K \int_a^x|g| \ \ \forall x \in I.$$ Then $g(x) = 0\ \ \forall x \in I $. I am stuck with the problem please help! | Let $u, v$ be continuous functions on $[a,b]$ and let $c>0$. Suppose that for all $x \in [a,b]$ we have the following inequality: $$|u(x)-v(x)| \leq c \int_a^x |u(t)-v(t)| dt$$ Show that $u(x)=v(x)$ for all $x \in [a,b]$ My first thought was to consider $h(x)=|u(x)-v(x)|$ and try to show that $h=0$, but I got stuck. Also, I proved the inequality considering the case $c(b-a) \leq 1$, but I'm not sure how to continue. |
I am trying to understand use of :. I have below example code. I am not getting what the last line is doing. Please explain. Also please share how or when to use : listoflists = [] list = [] for i in range(0,10): list.append(i) if len(list)>3: list.remove(list[0]) listoflists.append((list, list[0])) print (listoflists) print (listoflists[:][0][1])#print y values only for the first batch, : for all batches print (listoflists[0][1]) print(listoflists[:]) | I need a good explanation (references are a plus) on Python's slice notation. To me, this notation needs a bit of picking up. It looks extremely powerful, but I haven't quite got my head around it. |
My question is a bit naive, but what if someone generates the same RSA key pair as someone else? This person would have the same private key and so would be able to decrypt messages not intended to him. I bet that the answer will be: “It is very unlikely”, but I would like a more persuasive answer to realize that it can't happen in practice. A related question: when someone generates a key pair, how can he/she be sure that nobody has already generated this key pair? Would the answer again be, that it is “very unlikely”? | I was wondering how many possible private/public keys exist? If a million people – for whatever reason – would try to generate 5 keys each in the same minute (on the same date and time) is there a high chance of collision? I believe GUID would suffer from that problem as many bits are reversed for date/time (and GUID version) and isn't meant to be used in that way. Would RSA suffer from collisions if many keys were to be generated in the same moment? Is the amount of possible keys known? I know RSA is based on prime numbers and small numbers are to be rejected. I’m sure values above a certain amount of digits/bits are rejected because software may not be able to support those large values? So: How many RSA keys before a collision? And if you would try to make many at the same time, would that give you a high chance of collision? |
I saw in a grammar book mentioned something like this : Liz can speak French very well. Then I saw another example saying like this : She often eats durians My mother always wipes the floor. With those examples, I got a little bit confuse. Why is the 1st example not saying "speaks" as it is referring to Liz which is only 1 person? Is it because it is referring to Proper Noun ? | What is the correct form? 1) It can contain 2) It can contains |
I have to prove that a polynom $f = a_nx^n+...+a_0 \in R[x] $ (the polynom ring) is inversible, if and only if $a_0$ is inversible and all $a_i$ are nilpotent. It is obvious that $a_0$ is inversible, but I have no idea how to prove the rest. Also, I'm wondering if $ a\neq 0, \exists b\neq 0 \quad \text{such that}\quad ab=0\quad $ always implies that $a$ is nilpotent. | I am trying to prove a result, for which I have got one part, but I am not able to get the converse part. Theorem. Let $R$ be a commutative ring with $1$. Then $f(X)=a_{0}+a_{1}X+a_{2}X^{2} + \cdots + a_{n}X^{n}$ is a unit in $R[X]$ if and only if $a_{0}$ is a unit in $R$ and $a_{1},a_{2},\dots,a_{n}$ are all nilpotent in $R$. Proof. Suppose $f(X)=a_{0}+a_{1}X+\cdots +a_{n}X^{n}$ is such that $a_{0}$ is a unit in $R$ and $a_{1},a_{2}, \dots,a_{r}$ are all nilpotent in $R$. Since $R$ is commutative, we get that $a_{1}X,a_{2}X^{2},\cdots,a_{n}X^{n}$ are all nilpotent and hence also their sum is nilpotent. Let $z = \sum a_{i}X^{i}$ then $a_{0}^{-1}z$ is nilpotent and so $1+a_{0}^{-1}z$ is a unit. Thus $f(X)=a_{0}+z=a_{0} \cdot (1+a_{0}^{-1}z)$ is a unit since product of two units in $R[X]$ is a unit. I have not been able to get the converse part and would like to see the proof for the converse part. |
I'm creating a web-based using php (and etc) with mysqli database. I have created a table that contain trademark(™) data in certain column. When I import the data from the csv file, the ™ sign shown perfectly in my phpmyadmin(using utf8). But when it comes to viewing part in my php page, it show � symbol that replaced my ™ symbol. How can i get rid of this? | I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1. Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur? This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2. |
I am basically trying to make an intro for my youtube channel. I am sort of familiar with the program because I was playing around with it for a long time, getting the basics of it. With the help of youtube videos I am basically done with my project. I put my name in it and everything. I just need to know how to save the animation onto my desktop as a file that I could open and would be in a video format. | Yesterday I was working on a simple animation, an animated logo. Here is an image of the progress: I already have the animation working and everything is okay with the project, but I can't figure out how I can render the animation and turn it into an AVI format video. How do I render an animation in Blender? |
I have this client.java class and when i call the method sendMsg() it gives me this error: Attempt to invoke virtual method 'void java.io.OutputStream.write(byte[], int, int)' on a null object reference. How to fix it? import android.os.AsyncTask; import android.util.Log; import android.widget.EditText; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException; public class Client extends AsyncTask<Void,Void,String> { private String dstAdress; private int dstPort; private String msg; private OutputStream outStream; private EditText et; public Client(String adress,int port,String msg){ dstAdress=adress; dstPort=port; this.msg=msg; } @Override protected String doInBackground(Void... arg0){ Socket socket=null; String received=""; try{ socket=new Socket(dstAdress,dstPort); outStream= socket.getOutputStream(); outStream.write(msg.getBytes()); //publishProgress(); byte[] buffer=new byte[1024]; int bytesRead; InputStream inputStream=socket.getInputStream(); //citeste de pe socket while((bytesRead=inputStream.read(buffer))!=-1){ String str=new String(buffer,0,bytesRead,"UTF-8"); Log.d("TAG",str); received +=str; } }catch(UnknownHostException e){ e.printStackTrace(); }catch(IOException e){ e.printStackTrace(); }finally{ if(socket!=null){ try{ socket.close(); }catch(IOException e){ e.printStackTrace(); } } } return received; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); Log.d("TAG", "Received: " + result); } @Override protected void onProgressUpdate(Void... values) { super.onProgressUpdate(values); et.setEnabled(true); } public void sendMsg(String msg){ try{ outStream.write(msg.getBytes()); }catch(IOException e){ e.printStackTrace(); } } } | What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely? |
For a natural numbr $n$ we know that $n=3k_1+1$, $n=4k_2+1$ and $n=5k_3+4$, for natural numbers $k_1, k_, k_3$. Calculate $5^n\pmod {13}$ . For that, do we apply the Chinese Theorem? | I've read about Fermat's little theorem and generally how congruence works. But I can't figure out how to work out these two: $13^{100} \bmod 7$ $7^{100} \bmod 13$ I've also heard of this formula: $$a \equiv b\pmod n \Rightarrow a^k \equiv b^k \pmod n $$ But I don't see how exactly to use that here, because from $13^1 \bmod 7$ I get 6, and $13^2 \bmod 7$ is 1. I'm unclear as to which one to raise to the kth power here (I'm assuming k = 100?) Any hints or pointers in the right direction would be great. |
There is a special term for when a place name is representative of something other than the actual place itself but I can't remember what it is. For example: 'Brussels' may be used to refer to the European Union or 'Washington' to refer to the U.S. political establishment. Does anyone know what this term would be? | This happens specifically often in the technology press: There's no point trying to ascribe motives to what Redmond [instead of "Microsoft"] does. We'll see shortly if Cupertino [instead of "Apple"] thinks likewise ... I'm certain its use is much wider though I can't think of many examples right now. Using "Detroit" as another name for the US auto industry is slightly wider: Who says that Detroit does not sell cars Americans want to drive? Anyway, I have a suspicion there is a name for this so what is it? |
I have looked at a bunch of different sites and I really don't want to spam y'all. But I'm really desperate and have nowhere else to turn. So here goes... I am trying to let people post things on my website. And the tutorial I watched told me to use htmlspecialchars() so that people can post things such as greater/less than signs and special symbols and such without breaking anything. But whenever my mysql_query() encounters a single or double quote it throws this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't do this. I won' at line 1 Here is my corresponding code: $sql = mysql_query("INSERT INTO stories (title, content, username, date_posted) VALUES ('$title', '$content', '$un', now())") or die(mysql_error()); And here's where I used the htmlspecialchars(): $content = $_POST['content']; $content = nl2br(htmlspecialchars($content)); What am I supposed to do to fix this? Please help me. -Sam | If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example: $unsafe_variable = $_POST['user_input']; mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')"); That's because the user can input something like value'); DROP TABLE table;--, and the query becomes: INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--') What can be done to prevent this from happening? |
What is the advantage of the first solution over the second? class TestClass { public int value { get; set; } } static void Main() { var myTest = new TestClass(); myTest.value = 3; System.Console.WriteLine(myTest.value); } } vs class TestClass { public int value; } static void Main() { var myTest = new TestClass(); myTest.value = 3; System.Console.WriteLine(myTest.value); } I've search this question on SO, but the top answer I keep seeing is that so in case you need to change how to set/get (add validation or something), you won't need to go back through your code and add it everywhere the property is used. If you do need to add this validation, couldn't you just change it from example two to example one without any additional changes? My understanding is that even if you want to add some validation to the get/set that you can't use the auto generated way like in my example and would need to change it anyway. If that's the case why even have the get/set? | In C#, what makes a field different from a property, and when should a field be used instead of a property? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.