qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
186,308
In a world similar set in renaissance times, there are natural occurring stones with the ability to produce flames. The more precious the stone, the higher and stronger quality of the flame/fire. Each stone, whether it's low quality or not, can be chiseled by skilled craftsmen to produce more efficient fires. These fir...
2020/09/27
[ "https://worldbuilding.stackexchange.com/questions/186308", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/55047/" ]
If you don't need them to burn more than once between recharging, you could have the energy stored in some kind of phase change. Heating the stones in a special oven causes them to store the energy. Once they are at room temperature, they need some kind of catalyst to start releasing the energy again - which is as simp...
[Sodium acetate](https://en.wikipedia.org/wiki/Sodium_acetate#Heating_pad) used in heating packs is a good example of trigger-based chimical exothermic reaction. With a simple "physical" spark (through a little piece of metal), you will trigger the reaction. So you don't need any complicated way to trigger it (unless y...
186,308
In a world similar set in renaissance times, there are natural occurring stones with the ability to produce flames. The more precious the stone, the higher and stronger quality of the flame/fire. Each stone, whether it's low quality or not, can be chiseled by skilled craftsmen to produce more efficient fires. These fir...
2020/09/27
[ "https://worldbuilding.stackexchange.com/questions/186308", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/55047/" ]
You are basically describing magic coal. It is magic because it can maybe burn longer and stronger, but mostly because it is rechargeable. Other than that it is just coal. You light it up just as non-magical coal, by applying a lot of heat on a small point. You can spin a stick on top of it, or rub two sticks together...
If you don't need them to burn more than once between recharging, you could have the energy stored in some kind of phase change. Heating the stones in a special oven causes them to store the energy. Once they are at room temperature, they need some kind of catalyst to start releasing the energy again - which is as simp...
186,308
In a world similar set in renaissance times, there are natural occurring stones with the ability to produce flames. The more precious the stone, the higher and stronger quality of the flame/fire. Each stone, whether it's low quality or not, can be chiseled by skilled craftsmen to produce more efficient fires. These fir...
2020/09/27
[ "https://worldbuilding.stackexchange.com/questions/186308", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/55047/" ]
You are basically describing magic coal. It is magic because it can maybe burn longer and stronger, but mostly because it is rechargeable. Other than that it is just coal. You light it up just as non-magical coal, by applying a lot of heat on a small point. You can spin a stick on top of it, or rub two sticks together...
**Just like a nuclear reactor works (with a bigger safety margin).** Put a lot of them together and they start to make heat. Put them apart and they fade and stop. You may as well handwave two supplemental materials - a reflector (one may put fewer stones inside a reflecting container and they will ignite) and a pois...
373,511
Let $X$ be a connected CW-complex with $\pi\_k(X)$ trivial for $k >2$. Is it known under which circumstances $X$ is an $H$-group? I have been able only to deduce the necessary condition that $\pi\_1(X)$ has to be abelian and act trivially on $\pi\_2(X)$. Furthermore, if the necessary condition holds, vanishing of the ...
2020/10/07
[ "https://mathoverflow.net/questions/373511", "https://mathoverflow.net", "https://mathoverflow.net/users/94647/" ]
The necessary condition is a "additivity"-type condition on the $k$-invariant. Suppose $\pi\_1 X = G$ and $\pi\_2 X = A$. As you correctly point out, $G$ must be abelian and act trivially on $A$. Under these circumstances, the $k$-invariant is expressible as a natural map of pointed spaces $$ \beta: K(G,1) \to K(A,3)....
I just wanted to add to Tyler Lawson's answer that all the maps $\beta\colon K(G,1)\rightarrow K(A,3)$ ($G$ and $A$ abelian and no action of $G$ on $A$) satisfying his additivity condition are loop maps by Stasheff's Homotopy Associativity of $H$-Spaces II (Theorem 5.3). Hence for 2-types being an $H$-space is the same...
14,535,683
I am learning `maven` these days. During making Web application it shows error. When I add servlets in the source location and add these changes in the `web.xml`. It shows `package missing errors`. My imports in code are :- 1. import java.io.\*; 2. import javax.servlet.\*; 3. import javax.servlet.http.\*; When I wr...
2013/01/26
[ "https://Stackoverflow.com/questions/14535683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340736/" ]
You probably just have to add the dependency to your web.xml. check here maybe: <http://mvnrepository.com/artifact/javax.servlet/servlet-api> ``` <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency> ```
I am not sure how have you created web application in first place. You can use Maven to create a sample webApp for you with jsut a simeple command. You can use lates Maven version (I used Maven 3.04) to use the below command ``` mvn archetype:generate ``` then It lists out the templates offered and you are asked t...
3,260,055
From *Convex Optimization* by Boyd & Vandenberghe: > > Let $\Delta x\_{\text{snd}} = \arg \min\{\nabla f(x)^Tv : \|v\| = 1\}$ > be the normalized steepest descent direction with respect to the norm > $\|\*\|$. > > > Consider the norm $\|z\|\_P = (z^TPz)^{1/2} = \|P^{1/2}z\|\_2$ where $P > \in S^n\_{++}$ the set ...
2019/06/12
[ "https://math.stackexchange.com/questions/3260055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/334611/" ]
Generally, the solution to $\min\_{\|x\|=1} g^T x$ is $x = -{1 \over \|g\|} g$. This follows from Cauchy Schwartz. The above problem can be written as $\min\_{\|x\|\_P = 1} g^T x = \min\_{\|\sqrt{P}x\| = 1} g^T x = \min\_{\|y\| = 1} g^T \sqrt{P}^{-1} y $ (where the transformation $y=\sqrt{P} x$ was used). So the sol...
**My attempt**: Perhaps you can finish it $\nabla\_z ||P^{1/2}z||\_2 = \frac{P^{T/2}P^{1/2} z}{||P^{1/2}z||\_2}$. Now you want optimize $$ \min \frac{z^T P^{T/2}P^{1/2}}{||P^{1/2}z||\_2} v \quad \text{s.t.} ||v||^2\_2 = 1, $$ which is equivalent to $$ \min \frac{z^T P}{||P^{1/2}z||\_2} v \quad \text{s.t.} ||v||^2\...
3,260,055
From *Convex Optimization* by Boyd & Vandenberghe: > > Let $\Delta x\_{\text{snd}} = \arg \min\{\nabla f(x)^Tv : \|v\| = 1\}$ > be the normalized steepest descent direction with respect to the norm > $\|\*\|$. > > > Consider the norm $\|z\|\_P = (z^TPz)^{1/2} = \|P^{1/2}z\|\_2$ where $P > \in S^n\_{++}$ the set ...
2019/06/12
[ "https://math.stackexchange.com/questions/3260055", "https://math.stackexchange.com", "https://math.stackexchange.com/users/334611/" ]
Generally, the solution to $\min\_{\|x\|=1} g^T x$ is $x = -{1 \over \|g\|} g$. This follows from Cauchy Schwartz. The above problem can be written as $\min\_{\|x\|\_P = 1} g^T x = \min\_{\|\sqrt{P}x\| = 1} g^T x = \min\_{\|y\| = 1} g^T \sqrt{P}^{-1} y $ (where the transformation $y=\sqrt{P} x$ was used). So the sol...
$$ \Delta x\_{\textrm{nsd}} = \textrm{argmin} \{ \nabla f(x)^Tv \mid \space\space\space \vert\vert v \vert\vert\_{P} \le 1 \} $$ $$ = \textrm{argmin} \{ \nabla f(x)^Tv \mid \space\space\space\vert\vert P^{1/2}v \vert\vert\_{2} \le 1 \} $$ $$ = \textrm{argmin} \{ \nabla f(x)^T P^{-1/2}P^{1/2}v \mid \space\space\spac...
17,232
ISO 639-3 has many language codes for Arabic, but only one for English. I'm an Arab who is familiar with multiple Arabic dialects. We do not call it anything but "لهجات" which is translated to "dialects". We also call it "عامية" which is translated to "slang". I've never heard an Arabic man call its region's dialect a...
2016/04/03
[ "https://linguistics.stackexchange.com/questions/17232", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/12873/" ]
I'm not able to give you an authoritative answer, but here is my attempt at one. See "Macrolanguage" in [Wikipedia](https://en.wikipedia.org/wiki/ISO_639_macrolanguage) and in [SIL](http://www-01.sil.org/iso639-3/scope.asp#M) for more information. The distinction between a language and a dialect is mostly a political ...
ISO639-3 is derived from [The Ethnologue](http://www.ethnologue.com/). The author of this work have a certain point of view on the definition of "language" (vs. "dialect") with a strong tendency to split languages into smaller units. Note that the authors of the Ethnologue have a open agenda that is different from doin...
17,232
ISO 639-3 has many language codes for Arabic, but only one for English. I'm an Arab who is familiar with multiple Arabic dialects. We do not call it anything but "لهجات" which is translated to "dialects". We also call it "عامية" which is translated to "slang". I've never heard an Arabic man call its region's dialect a...
2016/04/03
[ "https://linguistics.stackexchange.com/questions/17232", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/12873/" ]
Are the languages spoken in various Arabian countries actually mutually intelligible? If no then it makes more sense to regard them as separate languages. In China the government likes to officially categorize various Chinese languages as "dialects", but the reality is that the difference is really huge between some o...
I'm not able to give you an authoritative answer, but here is my attempt at one. See "Macrolanguage" in [Wikipedia](https://en.wikipedia.org/wiki/ISO_639_macrolanguage) and in [SIL](http://www-01.sil.org/iso639-3/scope.asp#M) for more information. The distinction between a language and a dialect is mostly a political ...
17,232
ISO 639-3 has many language codes for Arabic, but only one for English. I'm an Arab who is familiar with multiple Arabic dialects. We do not call it anything but "لهجات" which is translated to "dialects". We also call it "عامية" which is translated to "slang". I've never heard an Arabic man call its region's dialect a...
2016/04/03
[ "https://linguistics.stackexchange.com/questions/17232", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/12873/" ]
Unifying and subdividing speech forms under an ISO code is not a rigorous ontological claim: it is the standardization statement "this linguistic thing is to be abbreviated that way". "Quechua", "Luyia", and "Arabic" (also "Latvian") are examples of macrolanguages, under ISO 639-3. The individual languages are differen...
I'm not able to give you an authoritative answer, but here is my attempt at one. See "Macrolanguage" in [Wikipedia](https://en.wikipedia.org/wiki/ISO_639_macrolanguage) and in [SIL](http://www-01.sil.org/iso639-3/scope.asp#M) for more information. The distinction between a language and a dialect is mostly a political ...
17,232
ISO 639-3 has many language codes for Arabic, but only one for English. I'm an Arab who is familiar with multiple Arabic dialects. We do not call it anything but "لهجات" which is translated to "dialects". We also call it "عامية" which is translated to "slang". I've never heard an Arabic man call its region's dialect a...
2016/04/03
[ "https://linguistics.stackexchange.com/questions/17232", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/12873/" ]
Are the languages spoken in various Arabian countries actually mutually intelligible? If no then it makes more sense to regard them as separate languages. In China the government likes to officially categorize various Chinese languages as "dialects", but the reality is that the difference is really huge between some o...
ISO639-3 is derived from [The Ethnologue](http://www.ethnologue.com/). The author of this work have a certain point of view on the definition of "language" (vs. "dialect") with a strong tendency to split languages into smaller units. Note that the authors of the Ethnologue have a open agenda that is different from doin...
17,232
ISO 639-3 has many language codes for Arabic, but only one for English. I'm an Arab who is familiar with multiple Arabic dialects. We do not call it anything but "لهجات" which is translated to "dialects". We also call it "عامية" which is translated to "slang". I've never heard an Arabic man call its region's dialect a...
2016/04/03
[ "https://linguistics.stackexchange.com/questions/17232", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/12873/" ]
Unifying and subdividing speech forms under an ISO code is not a rigorous ontological claim: it is the standardization statement "this linguistic thing is to be abbreviated that way". "Quechua", "Luyia", and "Arabic" (also "Latvian") are examples of macrolanguages, under ISO 639-3. The individual languages are differen...
ISO639-3 is derived from [The Ethnologue](http://www.ethnologue.com/). The author of this work have a certain point of view on the definition of "language" (vs. "dialect") with a strong tendency to split languages into smaller units. Note that the authors of the Ethnologue have a open agenda that is different from doin...
17,232
ISO 639-3 has many language codes for Arabic, but only one for English. I'm an Arab who is familiar with multiple Arabic dialects. We do not call it anything but "لهجات" which is translated to "dialects". We also call it "عامية" which is translated to "slang". I've never heard an Arabic man call its region's dialect a...
2016/04/03
[ "https://linguistics.stackexchange.com/questions/17232", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/12873/" ]
"Also except for some variations in North Africa Arabs" - this isn't just "some variations" - Moroccan Arabic and Tunisian Arabic are significantly different from Lebanese or Saudi (and from each other as well - with Algerian being a sort of middle between the two), far more so than British and American, more like the ...
ISO639-3 is derived from [The Ethnologue](http://www.ethnologue.com/). The author of this work have a certain point of view on the definition of "language" (vs. "dialect") with a strong tendency to split languages into smaller units. Note that the authors of the Ethnologue have a open agenda that is different from doin...
17,232
ISO 639-3 has many language codes for Arabic, but only one for English. I'm an Arab who is familiar with multiple Arabic dialects. We do not call it anything but "لهجات" which is translated to "dialects". We also call it "عامية" which is translated to "slang". I've never heard an Arabic man call its region's dialect a...
2016/04/03
[ "https://linguistics.stackexchange.com/questions/17232", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/12873/" ]
Are the languages spoken in various Arabian countries actually mutually intelligible? If no then it makes more sense to regard them as separate languages. In China the government likes to officially categorize various Chinese languages as "dialects", but the reality is that the difference is really huge between some o...
"Also except for some variations in North Africa Arabs" - this isn't just "some variations" - Moroccan Arabic and Tunisian Arabic are significantly different from Lebanese or Saudi (and from each other as well - with Algerian being a sort of middle between the two), far more so than British and American, more like the ...
17,232
ISO 639-3 has many language codes for Arabic, but only one for English. I'm an Arab who is familiar with multiple Arabic dialects. We do not call it anything but "لهجات" which is translated to "dialects". We also call it "عامية" which is translated to "slang". I've never heard an Arabic man call its region's dialect a...
2016/04/03
[ "https://linguistics.stackexchange.com/questions/17232", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/12873/" ]
Unifying and subdividing speech forms under an ISO code is not a rigorous ontological claim: it is the standardization statement "this linguistic thing is to be abbreviated that way". "Quechua", "Luyia", and "Arabic" (also "Latvian") are examples of macrolanguages, under ISO 639-3. The individual languages are differen...
"Also except for some variations in North Africa Arabs" - this isn't just "some variations" - Moroccan Arabic and Tunisian Arabic are significantly different from Lebanese or Saudi (and from each other as well - with Algerian being a sort of middle between the two), far more so than British and American, more like the ...
15,649,184
Im trying to get different images to load when hovering over the different image map zones. Is this even possible with htlm/css or java? If so how? Thanks Here's my code so far: ``` <img id="navbar" src="img/index-navbar.png" usemap="#navmap"/> <map name="navmap"> <area id="index-hover" shape="po...
2013/03/26
[ "https://Stackoverflow.com/questions/15649184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1899891/" ]
hopefully this helps, i did something like this years ago on specialolympics.org your html ``` <div class="world_map_container"> <img src="http://www.specialolympics.org/RegionsImages/map/transparent.gif" usemap="#the_world_map" id="transparent_map"> <img src="http://www.specialolympics.org/RegionsImages/map/worl...
I did something similar to this yeeeeeaaaaaarrrrssss ago using CSS and JS. [View and deconstruct the code here.](http://www.mackie.com/products/hrmk2series/cutaway/diagram.html) You could probably do it with pure CSS these days as there's unified browser support for it. I would do absolutely positioned divs over a bac...
31,163,728
I am using the CSVJDBC driver for retrieving results from CSV files. All record fields are interpreted as Strings. How can I utilise the MAX aggregate function in order to obtain the maximim Integer of a column? As far as I know, csvjdbc does not support casting. Consider this sample file: ``` sequenceNumber,decimalN...
2015/07/01
[ "https://Stackoverflow.com/questions/31163728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1206601/" ]
You should better specify the column types as it seems the first column is taken as String, where `"9" > "10"`. ``` Properties props = new Properties(); props.put("columnTypes", "Integer,Double,Integer,String,Integer"); Connection conn = DriverManager.getConnection("jdbc:relique:csv:" + CSVDIRECTORY, props); ```
As follows from the [CSV/JDBC documentation](http://csvjdbc.sourceforge.net/doc.html): > > If columnTypes is set to an empty string then column types are inferred from the data. > > > Which I guess is desirable in most use cases. So, using [Joop Eggen](https://stackoverflow.com/users/984823/joop-eggen)'s example ...
1,132,846
Let $f: \mathbb{R^n} \to \mathbb{R^n}$ such that $f(x)= ||x||^2 x$. I want to show that $f$ is bijective. We know local bijection using inverse function theorem at all points other than zero.Can we say a global inverse exists?
2015/02/04
[ "https://math.stackexchange.com/questions/1132846", "https://math.stackexchange.com", "https://math.stackexchange.com/users/138157/" ]
It is convenient to write your function as $$f(x) = ||x||^3 \cdot \frac{x}{||x||}$$ More generally, you can have $$f(x) = \phi(||x||) \cdot \frac{x}{||x||}$$ It is perhaps safe to assume extra that $\phi(0) = 0$. Now, if your function of $1$ variable $\phi\colon [0, \infty)\to [0, \infty)$ is bijective then $f$ is ...
**Hint** $$\big\| \lVert x\rVert^2 x \big\| = \| x \|^3$$ To prove 1-1, if $f(x)=f(y)$ use the above to show first that $\|x\|=\|y\|$. To prove onto, if for given $x$ you want $f(x)=y$ what does the hint tell you about $\|x \|$ and $\| y\|$?
20,225,726
I have a working solution to automatically refresh content on a web page by using the Javascript function: ``` window.setInterval(function() { }, 1000); ``` But this creates a number of GET requests when viewing the development console: ![Multiple Get Requests](https://i.stack.imgur.com/zbpsT.png) Whereas in c...
2013/11/26
[ "https://Stackoverflow.com/questions/20225726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2360657/" ]
The only way to sort cross-tab columns via designer is choosing between descending or ascending order, this means crystal report will order your fields by alphabetical order. A possible workaround is, for example, putting numbers with an underscore before the string you want to order in your datasource (like 01\_July ...
Another use-full workaround is. create a new formula say `column1` = `ToText({yourField}, "yyyy") + '-' + ToText({yourField},"MM")`. use this field as cross tab column. now your cross tab columns will be sorted as `2020-01 | 2020-02 | 2020-03 |...` now Cross-Tab expert> columns> Group Options > tab: Options > ✓ cus...
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
It is much simpler than a lot of people are making it look. This should be very efficient. 1. Put everything into a vector: ``` x <- unlist(list(a, b, c, d, e)) ``` 2. Look for duplicates ``` unique(x[duplicated(x)]) # [1] 2 3 1 4 8 ``` and `sort` if needed. Note: In case there can be duplicates within a list e...
You could try all possible combinations, for example: ``` ## create a list l <- list(a, b, c, d) ## get combinations cbn <- combn(1:length(l), 2) ## Intersect them unique(unlist(apply(cbn, 2, function(x) intersect(l[[x[1]]], l[[x[2]]])))) ## 2 3 1 4 ```
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
It is much simpler than a lot of people are making it look. This should be very efficient. 1. Put everything into a vector: ``` x <- unlist(list(a, b, c, d, e)) ``` 2. Look for duplicates ``` unique(x[duplicated(x)]) # [1] 2 3 1 4 8 ``` and `sort` if needed. Note: In case there can be duplicates within a list e...
A variation of @rengis method would be: ``` unique(unlist(Map(`intersect`, cbn[1,], cbn[2,]))) #[1] 2 3 1 4 8 ``` where, ``` l <- mget(letters[1:5]) cbn <- combn(l,2) ```
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
You could try all possible combinations, for example: ``` ## create a list l <- list(a, b, c, d) ## get combinations cbn <- combn(1:length(l), 2) ## Intersect them unique(unlist(apply(cbn, 2, function(x) intersect(l[[x[1]]], l[[x[2]]])))) ## 2 3 1 4 ```
Yet another approach, applying a vectorised function with `outer`: ``` L <- list(a, b, c, d, e) f <- function(x, y) intersect(x, y) fv <- Vectorize(f, list("x","y")) o <- outer(L, L, fv) table(unlist(o[upper.tri(o)])) # 1 2 3 4 8 # 1 10 3 1 1 ``` The output above gives the number of pairs of vectors that...
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
It is much simpler than a lot of people are making it look. This should be very efficient. 1. Put everything into a vector: ``` x <- unlist(list(a, b, c, d, e)) ``` 2. Look for duplicates ``` unique(x[duplicated(x)]) # [1] 2 3 1 4 8 ``` and `sort` if needed. Note: In case there can be duplicates within a list e...
When the vector is huge, solutions like `duplicated` or `tabulate` might overflow your system. In that case, dplyr comes in handy with the following code ``` library(dplyr) combination_of_vectors <- c(a, b, c, d, e) #For more than 1 combination_of_vectors %>% as_tibble() %>% group_by(x) %>% filter(n()>1) #For more th...
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
It is much simpler than a lot of people are making it look. This should be very efficient. 1. Put everything into a vector: ``` x <- unlist(list(a, b, c, d, e)) ``` 2. Look for duplicates ``` unique(x[duplicated(x)]) # [1] 2 3 1 4 8 ``` and `sort` if needed. Note: In case there can be duplicates within a list e...
Here's another option: ``` # For each vector, get a vector of values without duplicates deduplicated_vectors <- lapply(list(a,b,c,d,e), unique) # Flatten the lists, then sort and use rle to determine how many # lists each value appears in rl <- rle(sort(unlist(deduplicated_vectors))) # Get the values that appear in ...
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
You could try all possible combinations, for example: ``` ## create a list l <- list(a, b, c, d) ## get combinations cbn <- combn(1:length(l), 2) ## Intersect them unique(unlist(apply(cbn, 2, function(x) intersect(l[[x[1]]], l[[x[2]]])))) ## 2 3 1 4 ```
When the vector is huge, solutions like `duplicated` or `tabulate` might overflow your system. In that case, dplyr comes in handy with the following code ``` library(dplyr) combination_of_vectors <- c(a, b, c, d, e) #For more than 1 combination_of_vectors %>% as_tibble() %>% group_by(x) %>% filter(n()>1) #For more th...
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
You could try all possible combinations, for example: ``` ## create a list l <- list(a, b, c, d) ## get combinations cbn <- combn(1:length(l), 2) ## Intersect them unique(unlist(apply(cbn, 2, function(x) intersect(l[[x[1]]], l[[x[2]]])))) ## 2 3 1 4 ```
A variation of @rengis method would be: ``` unique(unlist(Map(`intersect`, cbn[1,], cbn[2,]))) #[1] 2 3 1 4 8 ``` where, ``` l <- mget(letters[1:5]) cbn <- combn(l,2) ```
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
You could try all possible combinations, for example: ``` ## create a list l <- list(a, b, c, d) ## get combinations cbn <- combn(1:length(l), 2) ## Intersect them unique(unlist(apply(cbn, 2, function(x) intersect(l[[x[1]]], l[[x[2]]])))) ## 2 3 1 4 ```
This is an approach that counts the number of vectors each unique value occurs in. ``` unique_vals <- unique(c(a, b, c, d, e)) setNames(rowSums(!!(sapply(list(a, b, c, d, e), match, x = unique_vals)), na.rm = TRUE), unique_vals) # 1 2 3 4 5 8 6 7 9 # 2 5 3 2 1 2 1 1 1 ```
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
It is much simpler than a lot of people are making it look. This should be very efficient. 1. Put everything into a vector: ``` x <- unlist(list(a, b, c, d, e)) ``` 2. Look for duplicates ``` unique(x[duplicated(x)]) # [1] 2 3 1 4 8 ``` and `sort` if needed. Note: In case there can be duplicates within a list e...
This is an approach that counts the number of vectors each unique value occurs in. ``` unique_vals <- unique(c(a, b, c, d, e)) setNames(rowSums(!!(sapply(list(a, b, c, d, e), match, x = unique_vals)), na.rm = TRUE), unique_vals) # 1 2 3 4 5 8 6 7 9 # 2 5 3 2 1 2 1 1 1 ```
26,175,561
Say I have 5 vectors: ``` a <- c(1,2,3) b <- c(2,3,4) c <- c(1,2,5,8) d <- c(2,3,4,6) e <- c(2,7,8,9) ``` I know I can calculate the intersection between all of them by using `Reduce()` together with `intersect()`, like this: ``` Reduce(intersect, list(a, b, c, d, e)) [1] 2 ``` But how can I find elements that ar...
2014/10/03
[ "https://Stackoverflow.com/questions/26175561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540663/" ]
It is much simpler than a lot of people are making it look. This should be very efficient. 1. Put everything into a vector: ``` x <- unlist(list(a, b, c, d, e)) ``` 2. Look for duplicates ``` unique(x[duplicated(x)]) # [1] 2 3 1 4 8 ``` and `sort` if needed. Note: In case there can be duplicates within a list e...
Yet another approach, applying a vectorised function with `outer`: ``` L <- list(a, b, c, d, e) f <- function(x, y) intersect(x, y) fv <- Vectorize(f, list("x","y")) o <- outer(L, L, fv) table(unlist(o[upper.tri(o)])) # 1 2 3 4 8 # 1 10 3 1 1 ``` The output above gives the number of pairs of vectors that...
68,380,054
I have a dataframe like this: ``` df = spark.createDataFrame( [ (dt.datetime(2021, 5, 1, 10, 30, 0), 2.15, "a"), (dt.datetime(2021, 5, 1, 10, 30, 10), 2.12, "a"), (dt.datetime(2021, 5, 1, 10, 30, 20), 2.13, "a"), (dt.datetime(2021, 5, 1, 10, 30, 50), 2.14, "a"), (dt.datetime...
2021/07/14
[ "https://Stackoverflow.com/questions/68380054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6765102/" ]
`rank` function ranks the data by `orderBy` clause, so you cannot rank it by another column. You can use this as an alternative ``` df = (df .withColumn("rank", F.array_sort(F.collect_set('value').over(w))) .withColumn('rank', F.expr("array_position(rank, value)"))) df.show() +-------------------+-----+--...
Chnage your **`orderBy()`** column to **value** ``` import datetime as dt df = spark.createDataFrame( [ (dt.datetime(2021, 5, 1, 10, 30, 0), 2.15, "a"), (dt.datetime(2021, 5, 1, 10, 30, 10), 2.12, "a"), (dt.datetime(2021, 5, 1, 10, 30, 20), 2.13, "a"), (dt.datetime(2021, 5, 1, 10, 3...
20,775,504
If I have an array: ``` var array1=new Array(); array1[0]="two"; array1[1]="three"; array1[2]="four"; ``` And another array: ``` var array2=new Array(); array2[0]="one"; array2[1]="two"; array2[2]="three"; array2[3]="four"; array2[4]="five"; ``` How can I return a true value that Array1 exists in Array2?
2013/12/25
[ "https://Stackoverflow.com/questions/20775504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632545/" ]
Using set theory we know that A is a subset of B if and only if for every element of A there is an equivalent element in B. I made a plnkr showing this: <http://plnkr.co/edit/9l5QplwWq1m7ZAkXV9PX> Using a simple loop you could do it like this: ``` function isSubsetOf(arrayA, arrayB) { for (var i = 0; i < arrayA.le...
convert array to list using `Arrays.asList(array2)` and same for array1 then call collections `contains` method
20,775,504
If I have an array: ``` var array1=new Array(); array1[0]="two"; array1[1]="three"; array1[2]="four"; ``` And another array: ``` var array2=new Array(); array2[0]="one"; array2[1]="two"; array2[2]="three"; array2[3]="four"; array2[4]="five"; ``` How can I return a true value that Array1 exists in Array2?
2013/12/25
[ "https://Stackoverflow.com/questions/20775504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632545/" ]
Try like this: ``` var arr1= ["two", "three"]; var arr2= ["two", "three", "four", "five"]; var isarraySubset = arr1.every(function(val) { return arr2.indexOf(val) >= 0; })); console.log(isarraySubset ); // true ``` **Note:-** This solution will work if your supported browsers are of ECMA-262 standard. **Accordin...
convert array to list using `Arrays.asList(array2)` and same for array1 then call collections `contains` method
20,775,504
If I have an array: ``` var array1=new Array(); array1[0]="two"; array1[1]="three"; array1[2]="four"; ``` And another array: ``` var array2=new Array(); array2[0]="one"; array2[1]="two"; array2[2]="three"; array2[3]="four"; array2[4]="five"; ``` How can I return a true value that Array1 exists in Array2?
2013/12/25
[ "https://Stackoverflow.com/questions/20775504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632545/" ]
Using set theory we know that A is a subset of B if and only if for every element of A there is an equivalent element in B. I made a plnkr showing this: <http://plnkr.co/edit/9l5QplwWq1m7ZAkXV9PX> Using a simple loop you could do it like this: ``` function isSubsetOf(arrayA, arrayB) { for (var i = 0; i < arrayA.le...
``` var checkArray = []; for ( var i; i<array1.length; i++ ){ if ( array2.indexOf( array1[i] ) !== -1 ) { checkArray.push(array1[i]); } } console.log("duplicate values : "+checkArray)// duplicate values : two,three,four ``` this may be not the most performant way ( i didnt test it, its pseudo...
20,775,504
If I have an array: ``` var array1=new Array(); array1[0]="two"; array1[1]="three"; array1[2]="four"; ``` And another array: ``` var array2=new Array(); array2[0]="one"; array2[1]="two"; array2[2]="three"; array2[3]="four"; array2[4]="five"; ``` How can I return a true value that Array1 exists in Array2?
2013/12/25
[ "https://Stackoverflow.com/questions/20775504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632545/" ]
Try like this: ``` var arr1= ["two", "three"]; var arr2= ["two", "three", "four", "five"]; var isarraySubset = arr1.every(function(val) { return arr2.indexOf(val) >= 0; })); console.log(isarraySubset ); // true ``` **Note:-** This solution will work if your supported browsers are of ECMA-262 standard. **Accordin...
``` var checkArray = []; for ( var i; i<array1.length; i++ ){ if ( array2.indexOf( array1[i] ) !== -1 ) { checkArray.push(array1[i]); } } console.log("duplicate values : "+checkArray)// duplicate values : two,three,four ``` this may be not the most performant way ( i didnt test it, its pseudo...
20,775,504
If I have an array: ``` var array1=new Array(); array1[0]="two"; array1[1]="three"; array1[2]="four"; ``` And another array: ``` var array2=new Array(); array2[0]="one"; array2[1]="two"; array2[2]="three"; array2[3]="four"; array2[4]="five"; ``` How can I return a true value that Array1 exists in Array2?
2013/12/25
[ "https://Stackoverflow.com/questions/20775504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632545/" ]
Using set theory we know that A is a subset of B if and only if for every element of A there is an equivalent element in B. I made a plnkr showing this: <http://plnkr.co/edit/9l5QplwWq1m7ZAkXV9PX> Using a simple loop you could do it like this: ``` function isSubsetOf(arrayA, arrayB) { for (var i = 0; i < arrayA.le...
If your requirement is to return true only if the sequence [two, three, four] is in array2, here is a fast but not 100% correct method: ``` var sep = 'zzz_some_highly_unlikely_occurring_string_zzz'; array2.join(sep).indexOf( array1.join(sep) ); ```
20,775,504
If I have an array: ``` var array1=new Array(); array1[0]="two"; array1[1]="three"; array1[2]="four"; ``` And another array: ``` var array2=new Array(); array2[0]="one"; array2[1]="two"; array2[2]="three"; array2[3]="four"; array2[4]="five"; ``` How can I return a true value that Array1 exists in Array2?
2013/12/25
[ "https://Stackoverflow.com/questions/20775504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632545/" ]
Using set theory we know that A is a subset of B if and only if for every element of A there is an equivalent element in B. I made a plnkr showing this: <http://plnkr.co/edit/9l5QplwWq1m7ZAkXV9PX> Using a simple loop you could do it like this: ``` function isSubsetOf(arrayA, arrayB) { for (var i = 0; i < arrayA.le...
``` var a1=""; for(var tmp:array1) a1+=tmp; var a2=""; for(var tmp:array2) a2+=tmp; ``` Now check if a1 exists in a2 ``` a2.indexOf(a1)>-1 ``` Will return true if array1 is there in array2
20,775,504
If I have an array: ``` var array1=new Array(); array1[0]="two"; array1[1]="three"; array1[2]="four"; ``` And another array: ``` var array2=new Array(); array2[0]="one"; array2[1]="two"; array2[2]="three"; array2[3]="four"; array2[4]="five"; ``` How can I return a true value that Array1 exists in Array2?
2013/12/25
[ "https://Stackoverflow.com/questions/20775504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632545/" ]
Try like this: ``` var arr1= ["two", "three"]; var arr2= ["two", "three", "four", "five"]; var isarraySubset = arr1.every(function(val) { return arr2.indexOf(val) >= 0; })); console.log(isarraySubset ); // true ``` **Note:-** This solution will work if your supported browsers are of ECMA-262 standard. **Accordin...
If your requirement is to return true only if the sequence [two, three, four] is in array2, here is a fast but not 100% correct method: ``` var sep = 'zzz_some_highly_unlikely_occurring_string_zzz'; array2.join(sep).indexOf( array1.join(sep) ); ```
20,775,504
If I have an array: ``` var array1=new Array(); array1[0]="two"; array1[1]="three"; array1[2]="four"; ``` And another array: ``` var array2=new Array(); array2[0]="one"; array2[1]="two"; array2[2]="three"; array2[3]="four"; array2[4]="five"; ``` How can I return a true value that Array1 exists in Array2?
2013/12/25
[ "https://Stackoverflow.com/questions/20775504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632545/" ]
Try like this: ``` var arr1= ["two", "three"]; var arr2= ["two", "three", "four", "five"]; var isarraySubset = arr1.every(function(val) { return arr2.indexOf(val) >= 0; })); console.log(isarraySubset ); // true ``` **Note:-** This solution will work if your supported browsers are of ECMA-262 standard. **Accordin...
``` var a1=""; for(var tmp:array1) a1+=tmp; var a2=""; for(var tmp:array2) a2+=tmp; ``` Now check if a1 exists in a2 ``` a2.indexOf(a1)>-1 ``` Will return true if array1 is there in array2
420,134
I am building an electric go-kart. I would like to use regenerative braking. I would like to have a brake pedal that controls the amount of torque (slowing the motor and wheels down) that the back emf from the motor creates. In a hypothetical situation, the motor (90amp 36volts permanent magnet dc motor) will be spun...
2019/02/02
[ "https://electronics.stackexchange.com/questions/420134", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/179628/" ]
I don't think you realize how much is involved in building such a powerful motor controller. I will explain some basic concepts to hopefully give you and idea of what you are trying to achieve, but I suggest you purchase a speed controller with appropriate ratings. Building a safe and reliable speed controller for 90A ...
V=IR + E. For a given speed, thus a given electromotive force (E) you will need to vary voltage in order to vary current. You will need to include a DC converter which is able to absorb current from the motor. Maybe a full bridge with optional filtering between it and the motor. Then, you will need to design the contro...
420,134
I am building an electric go-kart. I would like to use regenerative braking. I would like to have a brake pedal that controls the amount of torque (slowing the motor and wheels down) that the back emf from the motor creates. In a hypothetical situation, the motor (90amp 36volts permanent magnet dc motor) will be spun...
2019/02/02
[ "https://electronics.stackexchange.com/questions/420134", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/179628/" ]
I don't think you realize how much is involved in building such a powerful motor controller. I will explain some basic concepts to hopefully give you and idea of what you are trying to achieve, but I suggest you purchase a speed controller with appropriate ratings. Building a safe and reliable speed controller for 90A ...
You can use field oriented control to control the torque of the motor.The field oriented control does the torque control by regulating the current .first you have to select a proper motor as per the torque requirements .You can select PMSM/Induction motor/Bldc motor for this purpose.Then you have to design the motor co...
221,577
I see several explanations online, what was the true inspiration for the character's final production name "Michael Burnham?" Star Trek: Discovery's lead female role was initially announced under the pseudonym "Commander Rainsford" but somehow that was changed. What’s behind the new character name Michael?
2019/10/14
[ "https://scifi.stackexchange.com/questions/221577", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/120362/" ]
This was addressed in an interview with Discovery showrunner Aaron Harberts. > > **Q:** ***Why is Michael Burnham’s name… Michael?*** > > > All right, so here we go. **We've worked on a number of Bryan Fuller shows… Wonderfalls, Pushing Daisies. Many of his female protagonists have typically what you would call mal...
The lead character for *Star Trek: Discovery* [was originally named "LCDR Rainsford"](https://deadline.com/2016/12/star-trek-discovery-sonequa-martin-green-cast-lead-rainsford-1201871015/) and it was decided that she would only ever be called "Number One" in honor of the First Lieutenant on Captain Pike's Enterprise, w...
17,698,053
I am trying to solve a problem by fetching the maximum number from each row in a triangle. So far am able to generate a triangle but how do I fetch the max number from each row? Here is my code --------------- `private static Integer solve(Triangle triangle) { //triangle is extending an ArrayList Syst...
2013/07/17
[ "https://Stackoverflow.com/questions/17698053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1257986/" ]
As there is no ordering in your rows and this would lead to O(n) to get the maximum value per row i would look up the maximum value during insertion. Something like that (not tested and you probably have to override the other add methods also, depending on your use case): ``` public class Row extends ArrayList<Integer...
Try ``` private static int getTriangleMax(final Triangle rows) { int max = 0; for (final Row row : rows) { final int rowMax = getRowMax(row); max += rowMax; } return max; } private static int getRowMax(final Row row) { int rowMax = Integer.MIN_VALUE; for (final Integ...
17,698,053
I am trying to solve a problem by fetching the maximum number from each row in a triangle. So far am able to generate a triangle but how do I fetch the max number from each row? Here is my code --------------- `private static Integer solve(Triangle triangle) { //triangle is extending an ArrayList Syst...
2013/07/17
[ "https://Stackoverflow.com/questions/17698053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1257986/" ]
Here, just change with your `solve()` ``` private static void solve(Triangle triangle) { System.out.println(triangle); ArrayList<Integer> result = new ArrayList<Integer>(); int total = 0; for(Row row : triangle){ Collections.sort(row); total += row.get(row.size()-1); result...
Try ``` private static int getTriangleMax(final Triangle rows) { int max = 0; for (final Row row : rows) { final int rowMax = getRowMax(row); max += rowMax; } return max; } private static int getRowMax(final Row row) { int rowMax = Integer.MIN_VALUE; for (final Integ...
17,698,053
I am trying to solve a problem by fetching the maximum number from each row in a triangle. So far am able to generate a triangle but how do I fetch the max number from each row? Here is my code --------------- `private static Integer solve(Triangle triangle) { //triangle is extending an ArrayList Syst...
2013/07/17
[ "https://Stackoverflow.com/questions/17698053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1257986/" ]
Here, just change with your `solve()` ``` private static void solve(Triangle triangle) { System.out.println(triangle); ArrayList<Integer> result = new ArrayList<Integer>(); int total = 0; for(Row row : triangle){ Collections.sort(row); total += row.get(row.size()-1); result...
As there is no ordering in your rows and this would lead to O(n) to get the maximum value per row i would look up the maximum value during insertion. Something like that (not tested and you probably have to override the other add methods also, depending on your use case): ``` public class Row extends ArrayList<Integer...
17,698,053
I am trying to solve a problem by fetching the maximum number from each row in a triangle. So far am able to generate a triangle but how do I fetch the max number from each row? Here is my code --------------- `private static Integer solve(Triangle triangle) { //triangle is extending an ArrayList Syst...
2013/07/17
[ "https://Stackoverflow.com/questions/17698053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1257986/" ]
As there is no ordering in your rows and this would lead to O(n) to get the maximum value per row i would look up the maximum value during insertion. Something like that (not tested and you probably have to override the other add methods also, depending on your use case): ``` public class Row extends ArrayList<Integer...
Simple-Solution: 1.Add the static list as here: ``` private static List maxRowVal=new ArrayList(); ``` 2.Replace your generateTriangle() function with this: ``` private static Triangle generateTriangle() { Triangle triangle = new Triangle(); Random random = new Random(); for (int i =...
17,698,053
I am trying to solve a problem by fetching the maximum number from each row in a triangle. So far am able to generate a triangle but how do I fetch the max number from each row? Here is my code --------------- `private static Integer solve(Triangle triangle) { //triangle is extending an ArrayList Syst...
2013/07/17
[ "https://Stackoverflow.com/questions/17698053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1257986/" ]
As there is no ordering in your rows and this would lead to O(n) to get the maximum value per row i would look up the maximum value during insertion. Something like that (not tested and you probably have to override the other add methods also, depending on your use case): ``` public class Row extends ArrayList<Integer...
This is not exactly what you asked for, but I would like to show you a different way to go about this problem. People have done this for me before, and I really appreciated seeing different ways to solve a problems. Good luck with your coding! Below is the code in its entirety, so you can just copy, paste and run it. ...
17,698,053
I am trying to solve a problem by fetching the maximum number from each row in a triangle. So far am able to generate a triangle but how do I fetch the max number from each row? Here is my code --------------- `private static Integer solve(Triangle triangle) { //triangle is extending an ArrayList Syst...
2013/07/17
[ "https://Stackoverflow.com/questions/17698053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1257986/" ]
Here, just change with your `solve()` ``` private static void solve(Triangle triangle) { System.out.println(triangle); ArrayList<Integer> result = new ArrayList<Integer>(); int total = 0; for(Row row : triangle){ Collections.sort(row); total += row.get(row.size()-1); result...
Simple-Solution: 1.Add the static list as here: ``` private static List maxRowVal=new ArrayList(); ``` 2.Replace your generateTriangle() function with this: ``` private static Triangle generateTriangle() { Triangle triangle = new Triangle(); Random random = new Random(); for (int i =...
17,698,053
I am trying to solve a problem by fetching the maximum number from each row in a triangle. So far am able to generate a triangle but how do I fetch the max number from each row? Here is my code --------------- `private static Integer solve(Triangle triangle) { //triangle is extending an ArrayList Syst...
2013/07/17
[ "https://Stackoverflow.com/questions/17698053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1257986/" ]
Here, just change with your `solve()` ``` private static void solve(Triangle triangle) { System.out.println(triangle); ArrayList<Integer> result = new ArrayList<Integer>(); int total = 0; for(Row row : triangle){ Collections.sort(row); total += row.get(row.size()-1); result...
This is not exactly what you asked for, but I would like to show you a different way to go about this problem. People have done this for me before, and I really appreciated seeing different ways to solve a problems. Good luck with your coding! Below is the code in its entirety, so you can just copy, paste and run it. ...
55,041,434
I got an Exception *Got AttributeError when attempting to get a value for field `weight` on serializer `WeightHistorySerializer`. The serializer field might be named incorrectly and not match any attribute or key on the `QuerySet` instance. Original exception text was: 'QuerySet' object has no attribute 'weight'.* Whe...
2019/03/07
[ "https://Stackoverflow.com/questions/55041434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11100610/" ]
``` 'QuerySet' object has no attribute 'weight'. ``` Yes. `QuerySet` is a `Set`, a list of objects. ``` <QuerySet [<Object1>, <Object2>,..]> ``` And that list has no attribute `weight`. Instead, the objects inside the `QuerySet` has the attribute `weight`. ``` weight_history = WeightHistory.objects.filter(user_id...
> > views.py > > > ``` def weight_history_detail(request, user_id): # Retrieve, update or delete a weight_history/detail. try: weight_history = WeightHistory.objects.get(user_id=user_id) #get except WeightHistory.DoesNotExist: return Response(status=status.HTTP_404_NOT_FOUND) i...
56,990,015
Yesterday, I decided to start playing with Python for the first time, so please go easy on me, I have little to no programming experience. As my first little project, I am trying to make a script that shuffles a deck of cards and deals 5-card hands from the shuffled deck. I am trying to store the hands in a 2-dimension...
2019/07/11
[ "https://Stackoverflow.com/questions/56990015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11770349/" ]
You're creating `temp_hand` before you start the first `for` loop. Thereafter, you always end up modifying the same object, and then re-adding it to `many_hands`. In essence, you just added the same object five times. If you're familiar with C, it's like pass-by-reference: python doesn't copy the value of the list befo...
Instead of creating a new list for each hand, you empty & fill `temp_hand` for each hand, so that `many_hands` is a list of 5 references to that same list/hand. If instead of `temp_hand.clear()` you do `temp_hand = list()` (making it a new, empty list), you should get what you expect.
56,990,015
Yesterday, I decided to start playing with Python for the first time, so please go easy on me, I have little to no programming experience. As my first little project, I am trying to make a script that shuffles a deck of cards and deals 5-card hands from the shuffled deck. I am trying to store the hands in a 2-dimension...
2019/07/11
[ "https://Stackoverflow.com/questions/56990015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11770349/" ]
First the fix, make a new list object at each iteration: ``` for draw in range(5): # try avoid single letter variables temp_hand = [] # Make a NEW list object. BTW, [] is nicer and more common syntax than list() temp_deck = shuffle() temp_hand = temp_deck[:5] # Use slicing to get the first 5 elements, not ...
Instead of creating a new list for each hand, you empty & fill `temp_hand` for each hand, so that `many_hands` is a list of 5 references to that same list/hand. If instead of `temp_hand.clear()` you do `temp_hand = list()` (making it a new, empty list), you should get what you expect.
56,639,698
I am trying to classify some numeric data with TensorFlow. I was working on [this](https://www.tensorflow.org/tutorials/eager/custom_training_walkthrough#tensorflow_programming) tutorial, but imported some other data out of a csv instead. Running the line ``` predictions = model(features) ``` causes the error ``` I...
2019/06/17
[ "https://Stackoverflow.com/questions/56639698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236660/" ]
Try: ``` predictions = model.predict(features) ```
Ok, I faced the same type of issue, and tryed the same fix. Your neural network is also very similar to the one I've implemented. At a certaint point I got also an error like this ``` Error when checking input: expected dense_15_input to have shape (1000,) but got array with shape (1,) ``` After 1 day of mumbling I...
10,181,017
The main issue is that I want to audit user behavior (with triggers), but we are currently using connection pooling with our database, so don't have their username/id directly inside the db. 1. I understand that there is an EXECUTE AS LOGIN function in MSSQL Server. Is there something similar in MySQL or Postgres? 2....
2012/04/16
[ "https://Stackoverflow.com/questions/10181017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223478/" ]
In general, don't do that. You're breaking some of the assumptions about how UIViewControllers will be used and it is likely to cause you problems in the future. You're not going to be able to count on the subview's controller receiving all of the UIViewController lifecycle method calls you might expect. Valid solutio...
Try this ``` - (void)viewWillAppear: (BOOL)animated { [super viewWillAppear: animated]; [self.messageViewController viewWillAppear]; } - (void)viewDidAppear: (BOOL)animated { [super viewDidAppear: animated]; [self.messageViewController viewDidAppear]; } ```
10,181,017
The main issue is that I want to audit user behavior (with triggers), but we are currently using connection pooling with our database, so don't have their username/id directly inside the db. 1. I understand that there is an EXECUTE AS LOGIN function in MSSQL Server. Is there something similar in MySQL or Postgres? 2....
2012/04/16
[ "https://Stackoverflow.com/questions/10181017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223478/" ]
You need to create a Container View Controller. While iOS 5 explicitly supports container controllers, you can create container controllers in previous versions. All iOS 5 does is do some automatic forwarding of rotation/appearance events (optional...and personally I find them annoying, sending the events before I'm re...
In general, don't do that. You're breaking some of the assumptions about how UIViewControllers will be used and it is likely to cause you problems in the future. You're not going to be able to count on the subview's controller receiving all of the UIViewController lifecycle method calls you might expect. Valid solutio...
10,181,017
The main issue is that I want to audit user behavior (with triggers), but we are currently using connection pooling with our database, so don't have their username/id directly inside the db. 1. I understand that there is an EXECUTE AS LOGIN function in MSSQL Server. Is there something similar in MySQL or Postgres? 2....
2012/04/16
[ "https://Stackoverflow.com/questions/10181017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223478/" ]
You need to create a Container View Controller. While iOS 5 explicitly supports container controllers, you can create container controllers in previous versions. All iOS 5 does is do some automatic forwarding of rotation/appearance events (optional...and personally I find them annoying, sending the events before I'm re...
Try this ``` - (void)viewWillAppear: (BOOL)animated { [super viewWillAppear: animated]; [self.messageViewController viewWillAppear]; } - (void)viewDidAppear: (BOOL)animated { [super viewDidAppear: animated]; [self.messageViewController viewDidAppear]; } ```
40,681,213
[In dvb](http://www.interactivetvweb.org/tutorials/mhp/tuner_control): > > the receiver has to know which frequency the new transport stream is being broadcast on (and this alone is not trivial). Second, the receiver has to tell the tuner to change to the new frequency. > > > My question is how the receiver knows...
2016/11/18
[ "https://Stackoverflow.com/questions/40681213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6644375/" ]
I suspect ``` sys.path.insert(0, '/home/username/public_html') ``` is an absolute path, but flask application is looking to a relative path respect to flask gateway, and cannot find it. Have you tried to wrap the libraries in the app instance - move the absolute path in the app instance? As an example, see <http:...
I suspect that `fcgi` is not supported on that host. Just because a host lets you run a Python script on the command line does not mean that they have configured mod\_fcgi in Apache. Try this: `apachectl -t -D DUMP_MODULES | grep cgi`. You should see `fcgi_module` or `fastcgi_module`, or possibly a `cgi_module`. If ...
1,822,278
I have been keeping the shift/reduce errors away. Now finally i think i met my match. ``` Int[] a a[0] = 1 ``` The problem is int[] is defined as ``` Type OptSquareBrackets ``` while a[0] is defined as ``` Var | Var '[' expr ']' ``` Var and Type both are defined as VAR which is any valid variable `[a-zA-Z][a-...
2009/11/30
[ "https://Stackoverflow.com/questions/1822278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
something like this might be better: ``` $(function() { $("form").each(function() { $("#Agreement", this).click(function() { $('input:submit', this.form).attr("disabled", this.checked ? "" : "disabled"); }); }); }); ``` It looks like you're re-using `id="Agreement"` within each fo...
I would approach it by having a function disableSubmit(objId, checkState), then actually just coding on each checkbox an attribute onclick="disableSubmite('submit1', this.checked); ``` disableSubmit(objId, checkState) { $(#objId).attr("disabled", checkState ? "" : "disabled"); } ``` Jquery is cool, but sometimes ...
89,532
It seems silly to ask about using two-factor authentication without TLS/SSL but, I have a vendor that is using public IP without TLS and asking for login creds. Would the login be more secure if two-factor authentication was enabled without TLS? Using something like Google Authenticator and, knowing the keys are ephe...
2015/05/18
[ "https://security.stackexchange.com/questions/89532", "https://security.stackexchange.com", "https://security.stackexchange.com/users/39849/" ]
2FA will decrease the chance that an attacker can steal a complete set of login credentials because, as you point out, the second factor is likely limited by lifetime or a once-use policy. But 2FA will not affect snooping or [session hijacking](https://www.owasp.org/index.php/Session_hijacking_attack). So, while an at...
As you have stated yourself: it is *slightly* more secure because it is limited to a < 30 seconds timeframe, but that really doesn't matter much in the grand scheme of things: it is still very insecure and it will mostly just increase the effort legitimate users will have to put in.
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
If you are doing Test Driven Development your code should be hitting at least 70% without trying. Some areas you just can't or is pointless to have test coverage, thats where NoCoverage attributes for NCover come in handy (you can mark classes to be excluded by code coverage). Code coverage shouldn't be adhered to rel...
Visual Studio Team System Developer Edition includes code coverage. This can be included when running unit tests. Open up the .testrunconfig and select which assemblies you want data for.
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
NCover (both the commercial one and the open source one with the same name) and the code coverage tool in Visual Studio are pretty much your main tools in the MS world. Code coverage is a reverse metric. It doesn't really show you what code is adequately tested. Like Nick mentioned, you can have test that cover but do...
If you are doing Test Driven Development your code should be hitting at least 70% without trying. Some areas you just can't or is pointless to have test coverage, thats where NoCoverage attributes for NCover come in handy (you can mark classes to be excluded by code coverage). Code coverage shouldn't be adhered to rel...
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
There are two things to take into account when looking at Code Coverage. 1. Code coverage is a battle of diminishing returns: beyond a certain point each additional percentage yields less value. Some code (like core libraries) should be 100% covered whereas UI code/interaction can be very difficult to cover. - Code co...
I haven't used it personally, but one of my co-workers swears by nCover (<http://www.ncover.com/>). As far as coverage goes, in Ruby at least, 70% is easy, 90% is doable, and 100% is seldom a possibility.
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
If you are doing Test Driven Development your code should be hitting at least 70% without trying. Some areas you just can't or is pointless to have test coverage, thats where NoCoverage attributes for NCover come in handy (you can mark classes to be excluded by code coverage). Code coverage shouldn't be adhered to rel...
I haven't used it personally, but one of my co-workers swears by nCover (<http://www.ncover.com/>). As far as coverage goes, in Ruby at least, 70% is easy, 90% is doable, and 100% is seldom a possibility.
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
There are two things to take into account when looking at Code Coverage. 1. Code coverage is a battle of diminishing returns: beyond a certain point each additional percentage yields less value. Some code (like core libraries) should be 100% covered whereas UI code/interaction can be very difficult to cover. - Code co...
Visual Studio Team System Developer Edition includes code coverage. This can be included when running unit tests. Open up the .testrunconfig and select which assemblies you want data for.
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
[NCover](http://www.ncover.com/) will help show you coverage. Coverage is incredibly useful, unfortunately it can obviously be gamed. If you have bad developers covering code just to get the %age up, yes, it will ultimately be useless and hide uncovered areas. Once you fire those people you can fix it and get back to u...
Visual Studio Team System Developer Edition includes code coverage. This can be included when running unit tests. Open up the .testrunconfig and select which assemblies you want data for.
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
NCover (both the commercial one and the open source one with the same name) and the code coverage tool in Visual Studio are pretty much your main tools in the MS world. Code coverage is a reverse metric. It doesn't really show you what code is adequately tested. Like Nick mentioned, you can have test that cover but do...
I haven't used it personally, but one of my co-workers swears by nCover (<http://www.ncover.com/>). As far as coverage goes, in Ruby at least, 70% is easy, 90% is doable, and 100% is seldom a possibility.
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
NCover (both the commercial one and the open source one with the same name) and the code coverage tool in Visual Studio are pretty much your main tools in the MS world. Code coverage is a reverse metric. It doesn't really show you what code is adequately tested. Like Nick mentioned, you can have test that cover but do...
[NCover](http://www.ncover.com/) will help show you coverage. Coverage is incredibly useful, unfortunately it can obviously be gamed. If you have bad developers covering code just to get the %age up, yes, it will ultimately be useless and hide uncovered areas. Once you fire those people you can fix it and get back to u...
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
[NCover](http://www.ncover.com/) will help show you coverage. Coverage is incredibly useful, unfortunately it can obviously be gamed. If you have bad developers covering code just to get the %age up, yes, it will ultimately be useless and hide uncovered areas. Once you fire those people you can fix it and get back to u...
I haven't used it personally, but one of my co-workers swears by nCover (<http://www.ncover.com/>). As far as coverage goes, in Ruby at least, 70% is easy, 90% is doable, and 100% is seldom a possibility.
663,197
This is about .NET libraries (DLLs). What are the options for measuring code that is covered by unit test cases? Is it actually worth the efforts (measuring the code coverage)? I wonder it might be too easy to cover 70% of code and almost impossible to go beyond 90%. [EDIT] Another interesting question (put up by "E ...
2009/03/19
[ "https://Stackoverflow.com/questions/663197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
NCover (both the commercial one and the open source one with the same name) and the code coverage tool in Visual Studio are pretty much your main tools in the MS world. Code coverage is a reverse metric. It doesn't really show you what code is adequately tested. Like Nick mentioned, you can have test that cover but do...
Visual Studio Team System Developer Edition includes code coverage. This can be included when running unit tests. Open up the .testrunconfig and select which assemblies you want data for.
1,660,558
I am a newbie to Amazon SQS and ruby on rails. And i am working on a project that some XML messages must be send to SQS. How do i do that? Now i have this in the controller after the .save ``` def create @thing = Thing.new(params[:thing]) respond_to do |format| if @thing.save message = @th...
2009/11/02
[ "https://Stackoverflow.com/questions/1660558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/167123/" ]
I'm not sure I understand exactly, but let me try and get this straight. Every time you create a particular model, you'd like to send an XML message off to Amazon SQS? If that's the case, then... keep your controller as so: ``` def create @thing = Thing.new(params[:thing]) if @thing.save #render view/partial...
RightAws::SqsGen2.queue(queue\_name, message) is the right way to go for sending the message.
64,124,298
I have a cumulative sum that I need to reverse. How do I do this in SQL Server? Example: ``` +---+-------------------+-----+ | id| date|value| +---+-------------------+-----+ | J1|2016-10-01 11:45:30| 100| | J1|2016-10-02 11:30:30| 200| | J1|2016-10-05 16:20:00| 400| | J9|2016-10-06 08:35:00| 800| |...
2020/09/29
[ "https://Stackoverflow.com/questions/64124298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4984061/" ]
This no longer works ``` ion-label { white-space: normal !important; } .alert-radio-label.sc-ion-alert-md { white-space: pre-line !important; } ``` The updated answer is ``` .item.sc-ion-label-md-h, .item .sc-ion-label-md-h{ white-space: normal !important; } .item.sc-ion-label-ios-h, .item .sc-ion-label-io...
Try adding ng-deep which will pierce the shadow DOM. ``` ::ng-deep .ionic-selectable-item { overflow-wrap: break-word!important; min-height: 20px; font-size: 10px; } ```
64,124,298
I have a cumulative sum that I need to reverse. How do I do this in SQL Server? Example: ``` +---+-------------------+-----+ | id| date|value| +---+-------------------+-----+ | J1|2016-10-01 11:45:30| 100| | J1|2016-10-02 11:30:30| 200| | J1|2016-10-05 16:20:00| 400| | J9|2016-10-06 08:35:00| 800| |...
2020/09/29
[ "https://Stackoverflow.com/questions/64124298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4984061/" ]
Try adding ng-deep which will pierce the shadow DOM. ``` ::ng-deep .ionic-selectable-item { overflow-wrap: break-word!important; min-height: 20px; font-size: 10px; } ```
Try adding ng-template inside ionic-selectable. [Here](https://stackblitz.com/edit/ionic-selectable-item-template?file=app%2Fpages%2Fhome%2Fhome.html) is the example.
64,124,298
I have a cumulative sum that I need to reverse. How do I do this in SQL Server? Example: ``` +---+-------------------+-----+ | id| date|value| +---+-------------------+-----+ | J1|2016-10-01 11:45:30| 100| | J1|2016-10-02 11:30:30| 200| | J1|2016-10-05 16:20:00| 400| | J9|2016-10-06 08:35:00| 800| |...
2020/09/29
[ "https://Stackoverflow.com/questions/64124298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4984061/" ]
This no longer works ``` ion-label { white-space: normal !important; } .alert-radio-label.sc-ion-alert-md { white-space: pre-line !important; } ``` The updated answer is ``` .item.sc-ion-label-md-h, .item .sc-ion-label-md-h{ white-space: normal !important; } .item.sc-ion-label-ios-h, .item .sc-ion-label-io...
Try adding ng-template inside ionic-selectable. [Here](https://stackblitz.com/edit/ionic-selectable-item-template?file=app%2Fpages%2Fhome%2Fhome.html) is the example.
8,952,353
I am using an XML (HttpPost) on ListView to display a list of items in my application. XML File passes the following sample data: ``` id=5 name=Name2 score=20 ``` The problem I am facing is with the OnItemClick: **public void** onItemClick(AdapterView parent, View view, int position, long id) { lv.getItem...
2012/01/21
[ "https://Stackoverflow.com/questions/8952353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1057263/" ]
I have a feeling that you're using pre C++11. Change this: ``` vector<bitset<8>> bvc; ``` to this: ``` vector<bitset<8> > bvc; ``` Otherwise, the `>>` is parsed as the right-shift operator. This was "fixed" in C++11.
Change `vector<bitset<8>> bvc` to `vector<bitset<8> > bvc`. Note the space. `>>` is an operator. Yes, pretty nasty syntax issue.
5,462,852
I am trying to build CppUnit (first line in ReadMe says version 1.13) with Visual Studio 2010. Following the instructions (found on web forums, couldn't find much in CppUnit documentation); I cannot find a valid file extension. All file extensions end with ",v" what is this weird ",v" extension and what is the purpose ...
2011/03/28
[ "https://Stackoverflow.com/questions/5462852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/677036/" ]
Are you referring to this project? <http://sourceforge.net/projects/cppunit> If so, use TortoiseSVN for example to get the latest code from svn: <https://cppunit.svn.sourceforge.net/svnroot/cppunit> It contains "INSTALL-VS.Net2008.txt" with instructions for Visual Studio 2008 but it can also be applied to Visua...
I've successfully converted CPPUNIT 1.12.1 to be a VS2010 solution. It's described here: <http://blogs.powersoft.ca/erict/archive/2012/02/21/cppunit-in-vs2010ndashwith-a-sample.aspx> and the solution can be downloaded from there.
5,462,852
I am trying to build CppUnit (first line in ReadMe says version 1.13) with Visual Studio 2010. Following the instructions (found on web forums, couldn't find much in CppUnit documentation); I cannot find a valid file extension. All file extensions end with ",v" what is this weird ",v" extension and what is the purpose ...
2011/03/28
[ "https://Stackoverflow.com/questions/5462852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/677036/" ]
Are you referring to this project? <http://sourceforge.net/projects/cppunit> If so, use TortoiseSVN for example to get the latest code from svn: <https://cppunit.svn.sourceforge.net/svnroot/cppunit> It contains "INSTALL-VS.Net2008.txt" with instructions for Visual Studio 2008 but it can also be applied to Visua...
I just found a version which is really easy to build in VS2010(aka push 1 button): <http://www.comp.nus.edu.sg/~cs3215/tools/cppunitAll.html> It's really nice because it has a .sln file which you can open directly. Also it includes a tutorial ;) Found it with google.de It's version 1.12.1 Have fun!
5,462,852
I am trying to build CppUnit (first line in ReadMe says version 1.13) with Visual Studio 2010. Following the instructions (found on web forums, couldn't find much in CppUnit documentation); I cannot find a valid file extension. All file extensions end with ",v" what is this weird ",v" extension and what is the purpose ...
2011/03/28
[ "https://Stackoverflow.com/questions/5462852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/677036/" ]
I've successfully converted CPPUNIT 1.12.1 to be a VS2010 solution. It's described here: <http://blogs.powersoft.ca/erict/archive/2012/02/21/cppunit-in-vs2010ndashwith-a-sample.aspx> and the solution can be downloaded from there.
I just found a version which is really easy to build in VS2010(aka push 1 button): <http://www.comp.nus.edu.sg/~cs3215/tools/cppunitAll.html> It's really nice because it has a .sln file which you can open directly. Also it includes a tutorial ;) Found it with google.de It's version 1.12.1 Have fun!
4,474,041
I'd like to edit the syntax highlighting for PHP in Notepad++: 1. To have variables starting with `$_` in a different color than variables starting with only `$` 2. To have operators like `{} () []` in different colors than operators like `& =` Is it possible to change the highlighting to be this in-depth? How?
2010/12/17
[ "https://Stackoverflow.com/questions/4474041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422039/" ]
This is Possible ---------------- In Notepad++, define a new language by clicking *View* **>** *User-Defined Dialogue...* Give the language a name (e.g. myPHP). Set the ext (file extension abbreviation) to **php**. Define the color coding for the global variables and for the brackets, braces and parentheses, etc. Clo...
To edit the syntax highlighting in `Notepad++`, follow these steps: * Go to `Settings`, then `Style`. The configurator dialog opens. * Select language `php` * Select the style based on your criteria * Save
13,374,336
I have created an android project using eclipse.the default system generated code looked as below ``` package com.rmycustomclass.bengler; import android.app.Activity; import android.os.Bundle; public class RMyCustomClassActivity extends Activity { /** Called when the activity is first created...
2012/11/14
[ "https://Stackoverflow.com/questions/13374336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/352627/" ]
When you create a project in eclipse it links your activity (RMyCustomClassActivity in your case) as the launcher in Android manifest...But since you have changed the activity to a View android runtime cannot find the activity to launch...See your manifest file and you will find your class as the launcher activity
add android:layout\_width="match\_parent" ``` <test.control android:id="@+id/control" android:layout_height="match_parent" android:layout_width="match_parent" > ```
16,238,693
my script creates an empty array and then fill it. But if new arguments come then script is expected to destroy old one and create new one. ``` var Passengers = new Array(); function FillPassengers(count){ for(var i=0;i<count;i++) Passengers[i] = i; } ``` I wanna destroy the old one because new count ma...
2013/04/26
[ "https://Stackoverflow.com/questions/16238693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1706861/" ]
This will create a new empty array `Passengers = []`. Not sure about what you should do. Or just `Passengers.length = 0;`
You can simply do this to empty an array (without changing the array object itself): ``` Passengers.length = 0; ``` Or, with your code: ``` function FillPassengers(count){ for(var i=0;i<count;i++) Passengers[i] = i; Passengers.length = count; } ```
16,238,693
my script creates an empty array and then fill it. But if new arguments come then script is expected to destroy old one and create new one. ``` var Passengers = new Array(); function FillPassengers(count){ for(var i=0;i<count;i++) Passengers[i] = i; } ``` I wanna destroy the old one because new count ma...
2013/04/26
[ "https://Stackoverflow.com/questions/16238693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1706861/" ]
You can simply do this to empty an array (without changing the array object itself): ``` Passengers.length = 0; ``` Or, with your code: ``` function FillPassengers(count){ for(var i=0;i<count;i++) Passengers[i] = i; Passengers.length = count; } ```
You can just re-assign a new *Array* instance ``` Passengers = [ ]; ``` respectively ``` Passengers = new Array(); ``` The garbage collector till take care of the rest.
16,238,693
my script creates an empty array and then fill it. But if new arguments come then script is expected to destroy old one and create new one. ``` var Passengers = new Array(); function FillPassengers(count){ for(var i=0;i<count;i++) Passengers[i] = i; } ``` I wanna destroy the old one because new count ma...
2013/04/26
[ "https://Stackoverflow.com/questions/16238693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1706861/" ]
You can simply do this to empty an array (without changing the array object itself): ``` Passengers.length = 0; ``` Or, with your code: ``` function FillPassengers(count){ for(var i=0;i<count;i++) Passengers[i] = i; Passengers.length = count; } ```
Very Simple ``` riz = []; ``` or ``` riz.length = 0; ```
16,238,693
my script creates an empty array and then fill it. But if new arguments come then script is expected to destroy old one and create new one. ``` var Passengers = new Array(); function FillPassengers(count){ for(var i=0;i<count;i++) Passengers[i] = i; } ``` I wanna destroy the old one because new count ma...
2013/04/26
[ "https://Stackoverflow.com/questions/16238693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1706861/" ]
This will create a new empty array `Passengers = []`. Not sure about what you should do. Or just `Passengers.length = 0;`
You can just re-assign a new *Array* instance ``` Passengers = [ ]; ``` respectively ``` Passengers = new Array(); ``` The garbage collector till take care of the rest.
16,238,693
my script creates an empty array and then fill it. But if new arguments come then script is expected to destroy old one and create new one. ``` var Passengers = new Array(); function FillPassengers(count){ for(var i=0;i<count;i++) Passengers[i] = i; } ``` I wanna destroy the old one because new count ma...
2013/04/26
[ "https://Stackoverflow.com/questions/16238693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1706861/" ]
This will create a new empty array `Passengers = []`. Not sure about what you should do. Or just `Passengers.length = 0;`
Very Simple ``` riz = []; ``` or ``` riz.length = 0; ```
50,969,311
I'm trying to execute a step function that has a task that uses an activity resource. and after running my code i would like to return a `SendTaskSuccess` or `SendTaskFailure` back to the step function. I'm getting the following error sporadically (after less then 10 seconds): ``` An error occurred (TaskTimedOut) ...
2018/06/21
[ "https://Stackoverflow.com/questions/50969311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412317/" ]
You need to first join the tuples in your list ``` >>> boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] >>> ' '.join([''.join(w) for w in boundarylist]) 'eːn ak as' >>> ```
One way: ``` boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] print(' '.join([x+y for x, y in boundarylist])) # eːn ak as ```
50,969,311
I'm trying to execute a step function that has a task that uses an activity resource. and after running my code i would like to return a `SendTaskSuccess` or `SendTaskFailure` back to the step function. I'm getting the following error sporadically (after less then 10 seconds): ``` An error occurred (TaskTimedOut) ...
2018/06/21
[ "https://Stackoverflow.com/questions/50969311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412317/" ]
You need to first join the tuples in your list ``` >>> boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] >>> ' '.join([''.join(w) for w in boundarylist]) 'eːn ak as' >>> ```
here's what I tried, iterated through the list then through the tuple; ``` boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] new_list = [] for tuple_ in boundarylist: for i in tuple_: new_list.append(i) boundarylist = ' '.join(new_list) print(boundarylist) ```
50,969,311
I'm trying to execute a step function that has a task that uses an activity resource. and after running my code i would like to return a `SendTaskSuccess` or `SendTaskFailure` back to the step function. I'm getting the following error sporadically (after less then 10 seconds): ``` An error occurred (TaskTimedOut) ...
2018/06/21
[ "https://Stackoverflow.com/questions/50969311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412317/" ]
You need to first join the tuples in your list ``` >>> boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] >>> ' '.join([''.join(w) for w in boundarylist]) 'eːn ak as' >>> ```
We can use reduce method for it. ``` boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] print reduce(lambda x,y:"".join(x) + " " + "".join(y) , boundarylist) ``` Output ``` 'eːn ak as' ``` How this works -------------- Here we are actually joining the tuple that is inside the list using `.join()` method and t...
50,969,311
I'm trying to execute a step function that has a task that uses an activity resource. and after running my code i would like to return a `SendTaskSuccess` or `SendTaskFailure` back to the step function. I'm getting the following error sporadically (after less then 10 seconds): ``` An error occurred (TaskTimedOut) ...
2018/06/21
[ "https://Stackoverflow.com/questions/50969311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412317/" ]
One way: ``` boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] print(' '.join([x+y for x, y in boundarylist])) # eːn ak as ```
here's what I tried, iterated through the list then through the tuple; ``` boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] new_list = [] for tuple_ in boundarylist: for i in tuple_: new_list.append(i) boundarylist = ' '.join(new_list) print(boundarylist) ```
50,969,311
I'm trying to execute a step function that has a task that uses an activity resource. and after running my code i would like to return a `SendTaskSuccess` or `SendTaskFailure` back to the step function. I'm getting the following error sporadically (after less then 10 seconds): ``` An error occurred (TaskTimedOut) ...
2018/06/21
[ "https://Stackoverflow.com/questions/50969311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412317/" ]
One way: ``` boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] print(' '.join([x+y for x, y in boundarylist])) # eːn ak as ```
We can use reduce method for it. ``` boundarylist = [('eː', 'n'), ('a', 'k'), ('a', 's')] print reduce(lambda x,y:"".join(x) + " " + "".join(y) , boundarylist) ``` Output ``` 'eːn ak as' ``` How this works -------------- Here we are actually joining the tuple that is inside the list using `.join()` method and t...
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
For some people like me this is simply an indication of an error in the JavaScript code. I discovered this to be the case after entering the following command: `npx react-native bundle --entry-file index.js --bundle-output "bundle.bundle"`. Android users would need to specify the platform like so: `npx react-native bun...
Simply cleaning the project in Xcode helped me
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
Comment this line in AppDelegate.m ``` jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; ``` Use this line:- ``` jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; ``` After that run this to make jsbundle:- ...
For some people like me this is simply an indication of an error in the JavaScript code. I discovered this to be the case after entering the following command: `npx react-native bundle --entry-file index.js --bundle-output "bundle.bundle"`. Android users would need to specify the platform like so: `npx react-native bun...
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
This happens when there is no offline bundle file in your project, I had the same problem and this worked for me. I have added the below line to my package.json file, under `scripts` section, so I don't have to type it every time I want to generate an offline bundle. ``` "build:ios": "react-native bundle --entry-file...
PFB the command I ran, which resolves the issue. 1. npm i 2. cd ios 3. pod install
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
This issue take me some days to fixed. I got this issue when run the build on travis-ci. Here is my fix: Add this line to `scripts` in your package.json file. ``` "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'" ``` Now your can run the...
In my case I got this error at archive after updating from RN 0.53.3 to 0.55.4 ``` /Users/<myuser>/Desktop/projects/<myProjectName>mobileapp/index.ios.js: Plugin 0 specified in "/Users/<myUserName>/Desktop/projects/<myProjectName>mobileapp/node_modules/babel-preset-react-native/index.js" provided an invalid property o...
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
I was facing this issue after I ejected from the expo to add in-app purchases. I did the following to get it to work ``` cd <your repo> npx react-native bundle --entry-file ./index.js --dev false --reset-cache --platform ios --bundle-output ios/main.jsbundle --assets-dest ./ios ``` **After the above commands are run...
If properties of config file are changing at run time then make sure there is no error in that as well, if property is not set properly then main.bundlejs would not be generated. For Example : ``` isSent:false, isShow:false ``` this two properties were setting at run time and found that for a particular record isS...
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
**Recommend to use the latest Xcode and React Native versions.** My React Native Version: 0.56 and Xcode 10 ***Step 1:*** **Change AppDelegate.m** file ``` // jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #ifdef DEBUG jsCodeLocation = [[RCTBund...
In my case, it was caused by the javascript code. The error showed at the Metro Bundler(Command Line). Check the Metro Bundler, Does it have an Error or not.
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
In my case I got this error at archive after updating from RN 0.53.3 to 0.55.4 ``` /Users/<myuser>/Desktop/projects/<myProjectName>mobileapp/index.ios.js: Plugin 0 specified in "/Users/<myUserName>/Desktop/projects/<myProjectName>mobileapp/node_modules/babel-preset-react-native/index.js" provided an invalid property o...
In my case this was caused by a space character in my project path: `/users/USER/Projects/Project HousePlants/` That space in `Project Houseplants` the bundle can not handle and therefore can not find your `main.jsbundle` Make sure that you have no whitespace characters in your path and try again. [See this answer](...
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
This issue take me some days to fixed. I got this issue when run the build on travis-ci. Here is my fix: Add this line to `scripts` in your package.json file. ``` "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'" ``` Now your can run the...
This happens when there is no offline bundle file in your project, I had the same problem and this worked for me. I have added the below line to my package.json file, under `scripts` section, so I don't have to type it every time I want to generate an offline bundle. ``` "build:ios": "react-native bundle --entry-file...
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
This commnad works for me. ``` react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle ```
In my case this was caused by a space character in my project path: `/users/USER/Projects/Project HousePlants/` That space in `Project Houseplants` the bundle can not handle and therefore can not find your `main.jsbundle` Make sure that you have no whitespace characters in your path and try again. [See this answer](...
49,505,446
I tried to archive my react native project using **Product** > **Archive** on XCode9.2. But Xcode produce this error: ``` File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with My...
2018/03/27
[ "https://Stackoverflow.com/questions/49505446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7252084/" ]
Comment this line in AppDelegate.m ``` jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; ``` Use this line:- ``` jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; ``` After that run this to make jsbundle:- ...
**Recommend to use the latest Xcode and React Native versions.** My React Native Version: 0.56 and Xcode 10 ***Step 1:*** **Change AppDelegate.m** file ``` // jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #ifdef DEBUG jsCodeLocation = [[RCTBund...
26,822,018
Is there a way to get the use ADB to simulate a Recent App key press? I do not see it in the list of [assigned keys](https://stackoverflow.com/questions/7789826/adb-shell-input-events) and I am not able to select it using `adb input shell tap` despite getting the coordinates from the debugging options. I am trying to...
2014/11/08
[ "https://Stackoverflow.com/questions/26822018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1279884/" ]
*See @SimonMarquis answer below* ``` adb shell input keyevent KEYCODE_APP_SWITCH ``` --- *(OBSOLETE)* I don't think there is a keycode for it. However, I **am** able to open the recent apps menu with `adb shell input tap` (testing on a Nexus 5 with Lollipop). For example: ``` adb shell input tap 800 1890 ```
``` adb shell input keyevent KEYCODE_APP_SWITCH ``` Still works, you don't even have to put its numeric value (187) into the command.
26,822,018
Is there a way to get the use ADB to simulate a Recent App key press? I do not see it in the list of [assigned keys](https://stackoverflow.com/questions/7789826/adb-shell-input-events) and I am not able to select it using `adb input shell tap` despite getting the coordinates from the debugging options. I am trying to...
2014/11/08
[ "https://Stackoverflow.com/questions/26822018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1279884/" ]
The solution is to use the `KEYCODE_APP_SWITCH` KeyEvent: ``` adb shell input keyevent KEYCODE_APP_SWITCH ```
``` adb shell input keyevent KEYCODE_APP_SWITCH ``` Still works, you don't even have to put its numeric value (187) into the command.