qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
31,241,308
I have an `Activity` which extends `ActionBarActivity`. Whenever I try to create an `AlertDialog` in it, crashes at the the line where dialog is created giving this error ``` java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. ``` But I'm already using `Appcom...
2015/07/06
[ "https://Stackoverflow.com/questions/31241308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4460846/" ]
I couldn't reproduce the same exact error. However, I think that the problem is the context passed to AlertDialog.Builder constructor. In fact, an activity Context should be passed to it. Try replacing this line ``` alertDialog = new AlertDialog.Builder(getApplicationContext()).create(); ``` with t...
Add this line to your `<application>` in the `AndroidManifest.xml` file ``` android:theme="@style/Theme.AppCompat.Light" ```
56,142,466
[![enter image description here](https://i.stack.imgur.com/gAHt8.png)](https://i.stack.imgur.com/gAHt8.png) I have one list named IdleList which have multiple dates like shown in the image, a list contains date can be more than 5 and I want the sum of date like 0:0:11 + 0:0:14 = 0:0:25. This is my list ``` List<str...
2019/05/15
[ "https://Stackoverflow.com/questions/56142466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10753256/" ]
I strongly suggest you to store a list of `TimeSpan`s instead of a list of `string`s, and just work with `TimeSpan`s all the time. Only convert to strings when you need to output them to the user. If you have no control of the list of strings, then you can convert it to a bunch of time spans like this: ``` var timeSp...
You will firstly need to convert them to DateTime like this: ``` DateTime myDate = DateTime.Parse(dateString); ``` Then after you can do something like: ``` long ticks=myDate.Ticks; ``` then you can add all the ticks and convert back to datetime: ``` DateTime datetime= new DateTime(ticks); ``` Otherwise if yo...
56,142,466
[![enter image description here](https://i.stack.imgur.com/gAHt8.png)](https://i.stack.imgur.com/gAHt8.png) I have one list named IdleList which have multiple dates like shown in the image, a list contains date can be more than 5 and I want the sum of date like 0:0:11 + 0:0:14 = 0:0:25. This is my list ``` List<str...
2019/05/15
[ "https://Stackoverflow.com/questions/56142466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10753256/" ]
Please try this one. ``` List<string> objList = new List<string>(); objList.Add("0:0:10"); objList.Add("0:0:10"); objList.Add("1:1:10"); objList.Add("0:3:10"); TimeSpan CurrTime; DateTime CurrDate = new DateTime(); foreach (var item in objList) { ...
You will firstly need to convert them to DateTime like this: ``` DateTime myDate = DateTime.Parse(dateString); ``` Then after you can do something like: ``` long ticks=myDate.Ticks; ``` then you can add all the ticks and convert back to datetime: ``` DateTime datetime= new DateTime(ticks); ``` Otherwise if yo...
56,142,466
[![enter image description here](https://i.stack.imgur.com/gAHt8.png)](https://i.stack.imgur.com/gAHt8.png) I have one list named IdleList which have multiple dates like shown in the image, a list contains date can be more than 5 and I want the sum of date like 0:0:11 + 0:0:14 = 0:0:25. This is my list ``` List<str...
2019/05/15
[ "https://Stackoverflow.com/questions/56142466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10753256/" ]
It is better to store the items in a TimeSpan List. But if you need the values as a string, you can use the following code to convert the string to TimeSpan and calculate the sum: ``` TimeSpan sum = new TimeSpan(); for (int i=0;i< IdleList.Count; i++) { sum += TimeSpan.Parse(IdleLis...
You will firstly need to convert them to DateTime like this: ``` DateTime myDate = DateTime.Parse(dateString); ``` Then after you can do something like: ``` long ticks=myDate.Ticks; ``` then you can add all the ticks and convert back to datetime: ``` DateTime datetime= new DateTime(ticks); ``` Otherwise if yo...
56,142,466
[![enter image description here](https://i.stack.imgur.com/gAHt8.png)](https://i.stack.imgur.com/gAHt8.png) I have one list named IdleList which have multiple dates like shown in the image, a list contains date can be more than 5 and I want the sum of date like 0:0:11 + 0:0:14 = 0:0:25. This is my list ``` List<str...
2019/05/15
[ "https://Stackoverflow.com/questions/56142466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10753256/" ]
Convert all string items to TimeSpan and Aggregate them. Like this. ``` var timeSpan = new List<string> {"0:0:14", "0:0:2", "0:0:4"}.Select(TimeSpan.Parse).Aggregate((k, v) => k + v); ```
You will firstly need to convert them to DateTime like this: ``` DateTime myDate = DateTime.Parse(dateString); ``` Then after you can do something like: ``` long ticks=myDate.Ticks; ``` then you can add all the ticks and convert back to datetime: ``` DateTime datetime= new DateTime(ticks); ``` Otherwise if yo...
56,142,466
[![enter image description here](https://i.stack.imgur.com/gAHt8.png)](https://i.stack.imgur.com/gAHt8.png) I have one list named IdleList which have multiple dates like shown in the image, a list contains date can be more than 5 and I want the sum of date like 0:0:11 + 0:0:14 = 0:0:25. This is my list ``` List<str...
2019/05/15
[ "https://Stackoverflow.com/questions/56142466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10753256/" ]
I strongly suggest you to store a list of `TimeSpan`s instead of a list of `string`s, and just work with `TimeSpan`s all the time. Only convert to strings when you need to output them to the user. If you have no control of the list of strings, then you can convert it to a bunch of time spans like this: ``` var timeSp...
Please try this one. ``` List<string> objList = new List<string>(); objList.Add("0:0:10"); objList.Add("0:0:10"); objList.Add("1:1:10"); objList.Add("0:3:10"); TimeSpan CurrTime; DateTime CurrDate = new DateTime(); foreach (var item in objList) { ...
56,142,466
[![enter image description here](https://i.stack.imgur.com/gAHt8.png)](https://i.stack.imgur.com/gAHt8.png) I have one list named IdleList which have multiple dates like shown in the image, a list contains date can be more than 5 and I want the sum of date like 0:0:11 + 0:0:14 = 0:0:25. This is my list ``` List<str...
2019/05/15
[ "https://Stackoverflow.com/questions/56142466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10753256/" ]
I strongly suggest you to store a list of `TimeSpan`s instead of a list of `string`s, and just work with `TimeSpan`s all the time. Only convert to strings when you need to output them to the user. If you have no control of the list of strings, then you can convert it to a bunch of time spans like this: ``` var timeSp...
Convert all string items to TimeSpan and Aggregate them. Like this. ``` var timeSpan = new List<string> {"0:0:14", "0:0:2", "0:0:4"}.Select(TimeSpan.Parse).Aggregate((k, v) => k + v); ```
56,142,466
[![enter image description here](https://i.stack.imgur.com/gAHt8.png)](https://i.stack.imgur.com/gAHt8.png) I have one list named IdleList which have multiple dates like shown in the image, a list contains date can be more than 5 and I want the sum of date like 0:0:11 + 0:0:14 = 0:0:25. This is my list ``` List<str...
2019/05/15
[ "https://Stackoverflow.com/questions/56142466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10753256/" ]
It is better to store the items in a TimeSpan List. But if you need the values as a string, you can use the following code to convert the string to TimeSpan and calculate the sum: ``` TimeSpan sum = new TimeSpan(); for (int i=0;i< IdleList.Count; i++) { sum += TimeSpan.Parse(IdleLis...
Please try this one. ``` List<string> objList = new List<string>(); objList.Add("0:0:10"); objList.Add("0:0:10"); objList.Add("1:1:10"); objList.Add("0:3:10"); TimeSpan CurrTime; DateTime CurrDate = new DateTime(); foreach (var item in objList) { ...
56,142,466
[![enter image description here](https://i.stack.imgur.com/gAHt8.png)](https://i.stack.imgur.com/gAHt8.png) I have one list named IdleList which have multiple dates like shown in the image, a list contains date can be more than 5 and I want the sum of date like 0:0:11 + 0:0:14 = 0:0:25. This is my list ``` List<str...
2019/05/15
[ "https://Stackoverflow.com/questions/56142466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10753256/" ]
It is better to store the items in a TimeSpan List. But if you need the values as a string, you can use the following code to convert the string to TimeSpan and calculate the sum: ``` TimeSpan sum = new TimeSpan(); for (int i=0;i< IdleList.Count; i++) { sum += TimeSpan.Parse(IdleLis...
Convert all string items to TimeSpan and Aggregate them. Like this. ``` var timeSpan = new List<string> {"0:0:14", "0:0:2", "0:0:4"}.Select(TimeSpan.Parse).Aggregate((k, v) => k + v); ```
718,473
find the maximum value of the function $$y = 15 \sin x -8 \cos x $$ attempt at a solution: deriving: $y' = 15\cos x +8\sin x $ equating to zero and doubling by $ 1/\cos x$ (Im not sure this is allowed since if $x$ is $\pi/2 $ we might find ourselves in a bit of a trouble) : $$0 = 15 +8\tan x $$ a few steps forward...
2014/03/19
[ "https://math.stackexchange.com/questions/718473", "https://math.stackexchange.com", "https://math.stackexchange.com/users/90230/" ]
$$y' = 15\cos x +8\sin x = 0 \iff 8\sin x = -15\cos x \implies \frac{\sin x}{\cos x} = -\frac {15}{8}, $$ $$\iff \tan x = -\frac{15}{8},\;\text{provided } \;\cos x \neq 0$$ Since $\cos x = 0$ does not solve the equation, we can divide by $\cos x$ without problems. Now, determine when $\tan x = -\frac{15}{8}$, by usin...
Your approach is essentially correct, except that in order to maximize the function you want $\sin x$ to be positive and $\cos x$ to be negative. So you want a solution for $\tan x = -15/8$ in the range $(\pi/2, \pi)$.
718,473
find the maximum value of the function $$y = 15 \sin x -8 \cos x $$ attempt at a solution: deriving: $y' = 15\cos x +8\sin x $ equating to zero and doubling by $ 1/\cos x$ (Im not sure this is allowed since if $x$ is $\pi/2 $ we might find ourselves in a bit of a trouble) : $$0 = 15 +8\tan x $$ a few steps forward...
2014/03/19
[ "https://math.stackexchange.com/questions/718473", "https://math.stackexchange.com", "https://math.stackexchange.com/users/90230/" ]
Your equation is $$y = 15 \sin x -8 \cos x \\=17\{ \frac{15}{17} \sin x -\frac{8}{17} \cos x\} \\=17\{ \sin x \cos\theta- \cos x\sin\theta\} \\=17\sin (x-\theta)$$Then the maximum value is 17
Your approach is essentially correct, except that in order to maximize the function you want $\sin x$ to be positive and $\cos x$ to be negative. So you want a solution for $\tan x = -15/8$ in the range $(\pi/2, \pi)$.
718,473
find the maximum value of the function $$y = 15 \sin x -8 \cos x $$ attempt at a solution: deriving: $y' = 15\cos x +8\sin x $ equating to zero and doubling by $ 1/\cos x$ (Im not sure this is allowed since if $x$ is $\pi/2 $ we might find ourselves in a bit of a trouble) : $$0 = 15 +8\tan x $$ a few steps forward...
2014/03/19
[ "https://math.stackexchange.com/questions/718473", "https://math.stackexchange.com", "https://math.stackexchange.com/users/90230/" ]
$$y' = 15\cos x +8\sin x = 0 \iff 8\sin x = -15\cos x \implies \frac{\sin x}{\cos x} = -\frac {15}{8}, $$ $$\iff \tan x = -\frac{15}{8},\;\text{provided } \;\cos x \neq 0$$ Since $\cos x = 0$ does not solve the equation, we can divide by $\cos x$ without problems. Now, determine when $\tan x = -\frac{15}{8}$, by usin...
Your equation is $$y = 15 \sin x -8 \cos x \\=17\{ \frac{15}{17} \sin x -\frac{8}{17} \cos x\} \\=17\{ \sin x \cos\theta- \cos x\sin\theta\} \\=17\sin (x-\theta)$$Then the maximum value is 17
77,263
Here is the actual question: $A$ is random variable representing the lifespan of a component. It is an exponential law with an average of 10. Considering a system with $n$ components $A$, what is the minimum value of $n$ so that the system has a fiability of 0.999 for a 4 year period? I thought about approximating it ...
2011/10/30
[ "https://math.stackexchange.com/questions/77263", "https://math.stackexchange.com", "https://math.stackexchange.com/users/18536/" ]
If (and this is a big if) what you mean is that the $n$ components all start at time zero, that each component has a lifetime exponentially distributed with mean $10=1/\lambda$ and if the question is to know for which minimal value of $n$ one has $p\_n\leqslant\varepsilon$ where $\varepsilon=1/1'000$ and $p\_n$ is the ...
For a continuous random variable: $$P(Y\le 3) \neq P(Y<4) \; ,$$ therefore use $$P(Y\ge 4) = 1 - P(Y < 4) \; .$$
50,171,259
I have three tables: * WorkOrder that contains all of the Work Orders that have been done on MaintItems, (A MaintItem will occur multiple times in the WorkOrder Table) * MaintItems that contains a list of Unique MaintItems, * LastOccu to store the Last Occurrence details from the WorkOrder table of the MaintItem. To ...
2018/05/04
[ "https://Stackoverflow.com/questions/50171259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9739928/" ]
Here is an extension that returns an array of dropped elements: ``` extension Array { mutating func dropWhere(_ isIncluded: (Element) throws -> Bool) -> [Element] { do { let reverseArray = try filter { try isIncluded($0) } self = try filter { try !isIncluded($0) } retur...
you can use `Split` on condition will slice your array ``` var typeList = [Type1, Type1, Type1, Type1, Type1, Type1, Type2] var slicedArray:[ArraySlice] = typeList.split { (value) -> Bool in return value == YourCondition } print(slicedArray) ```
50,171,259
I have three tables: * WorkOrder that contains all of the Work Orders that have been done on MaintItems, (A MaintItem will occur multiple times in the WorkOrder Table) * MaintItems that contains a list of Unique MaintItems, * LastOccu to store the Last Occurrence details from the WorkOrder table of the MaintItem. To ...
2018/05/04
[ "https://Stackoverflow.com/questions/50171259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9739928/" ]
**Code I've finished with:** ``` extension Array { mutating func popFirstElementWith(_ predicate:(Element)->(Bool)) -> Element? { for (idx, element) in enumerated() { if predicate(element) { remove(at: idx) return element } } return nil } } ```
you can use `Split` on condition will slice your array ``` var typeList = [Type1, Type1, Type1, Type1, Type1, Type1, Type2] var slicedArray:[ArraySlice] = typeList.split { (value) -> Bool in return value == YourCondition } print(slicedArray) ```
50,171,259
I have three tables: * WorkOrder that contains all of the Work Orders that have been done on MaintItems, (A MaintItem will occur multiple times in the WorkOrder Table) * MaintItems that contains a list of Unique MaintItems, * LastOccu to store the Last Occurrence details from the WorkOrder table of the MaintItem. To ...
2018/05/04
[ "https://Stackoverflow.com/questions/50171259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9739928/" ]
Swift 5 has `removeAll(where)` ``` @inlinable public mutating func removeAll(where shouldBeRemoved: (Element) throws -> Bool) rethrows ``` You can use it like this - ``` var array = [1,2,3] array.removeAll(where: { $0 == 2}) print(array) // [1,3] ``` [Apple Docs](https://developer.apple.com/documentation/swift/ar...
you can use `Split` on condition will slice your array ``` var typeList = [Type1, Type1, Type1, Type1, Type1, Type1, Type2] var slicedArray:[ArraySlice] = typeList.split { (value) -> Bool in return value == YourCondition } print(slicedArray) ```
50,171,259
I have three tables: * WorkOrder that contains all of the Work Orders that have been done on MaintItems, (A MaintItem will occur multiple times in the WorkOrder Table) * MaintItems that contains a list of Unique MaintItems, * LastOccu to store the Last Occurrence details from the WorkOrder table of the MaintItem. To ...
2018/05/04
[ "https://Stackoverflow.com/questions/50171259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9739928/" ]
Here is an extension that returns an array of dropped elements: ``` extension Array { mutating func dropWhere(_ isIncluded: (Element) throws -> Bool) -> [Element] { do { let reverseArray = try filter { try isIncluded($0) } self = try filter { try !isIncluded($0) } retur...
This extension takes a predicate and returns the element if it matches the predicate. Also, removes the element from the array. ``` extension Array { mutating func popFirstElementWith(_ predicate:(Element)->(Bool)) -> Element? { var firstElement:Element? self = self.compactMap({ (element:Element...
50,171,259
I have three tables: * WorkOrder that contains all of the Work Orders that have been done on MaintItems, (A MaintItem will occur multiple times in the WorkOrder Table) * MaintItems that contains a list of Unique MaintItems, * LastOccu to store the Last Occurrence details from the WorkOrder table of the MaintItem. To ...
2018/05/04
[ "https://Stackoverflow.com/questions/50171259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9739928/" ]
Swift 5 has `removeAll(where)` ``` @inlinable public mutating func removeAll(where shouldBeRemoved: (Element) throws -> Bool) rethrows ``` You can use it like this - ``` var array = [1,2,3] array.removeAll(where: { $0 == 2}) print(array) // [1,3] ``` [Apple Docs](https://developer.apple.com/documentation/swift/ar...
Here is an extension that returns an array of dropped elements: ``` extension Array { mutating func dropWhere(_ isIncluded: (Element) throws -> Bool) -> [Element] { do { let reverseArray = try filter { try isIncluded($0) } self = try filter { try !isIncluded($0) } retur...
50,171,259
I have three tables: * WorkOrder that contains all of the Work Orders that have been done on MaintItems, (A MaintItem will occur multiple times in the WorkOrder Table) * MaintItems that contains a list of Unique MaintItems, * LastOccu to store the Last Occurrence details from the WorkOrder table of the MaintItem. To ...
2018/05/04
[ "https://Stackoverflow.com/questions/50171259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9739928/" ]
**Code I've finished with:** ``` extension Array { mutating func popFirstElementWith(_ predicate:(Element)->(Bool)) -> Element? { for (idx, element) in enumerated() { if predicate(element) { remove(at: idx) return element } } return nil } } ```
This extension takes a predicate and returns the element if it matches the predicate. Also, removes the element from the array. ``` extension Array { mutating func popFirstElementWith(_ predicate:(Element)->(Bool)) -> Element? { var firstElement:Element? self = self.compactMap({ (element:Element...
50,171,259
I have three tables: * WorkOrder that contains all of the Work Orders that have been done on MaintItems, (A MaintItem will occur multiple times in the WorkOrder Table) * MaintItems that contains a list of Unique MaintItems, * LastOccu to store the Last Occurrence details from the WorkOrder table of the MaintItem. To ...
2018/05/04
[ "https://Stackoverflow.com/questions/50171259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9739928/" ]
Swift 5 has `removeAll(where)` ``` @inlinable public mutating func removeAll(where shouldBeRemoved: (Element) throws -> Bool) rethrows ``` You can use it like this - ``` var array = [1,2,3] array.removeAll(where: { $0 == 2}) print(array) // [1,3] ``` [Apple Docs](https://developer.apple.com/documentation/swift/ar...
This extension takes a predicate and returns the element if it matches the predicate. Also, removes the element from the array. ``` extension Array { mutating func popFirstElementWith(_ predicate:(Element)->(Bool)) -> Element? { var firstElement:Element? self = self.compactMap({ (element:Element...
50,171,259
I have three tables: * WorkOrder that contains all of the Work Orders that have been done on MaintItems, (A MaintItem will occur multiple times in the WorkOrder Table) * MaintItems that contains a list of Unique MaintItems, * LastOccu to store the Last Occurrence details from the WorkOrder table of the MaintItem. To ...
2018/05/04
[ "https://Stackoverflow.com/questions/50171259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9739928/" ]
Swift 5 has `removeAll(where)` ``` @inlinable public mutating func removeAll(where shouldBeRemoved: (Element) throws -> Bool) rethrows ``` You can use it like this - ``` var array = [1,2,3] array.removeAll(where: { $0 == 2}) print(array) // [1,3] ``` [Apple Docs](https://developer.apple.com/documentation/swift/ar...
**Code I've finished with:** ``` extension Array { mutating func popFirstElementWith(_ predicate:(Element)->(Bool)) -> Element? { for (idx, element) in enumerated() { if predicate(element) { remove(at: idx) return element } } return nil } } ```
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Say you want to present a choice of interactive games ``` out.println("Which game (...) ?"); Game game; switch (in.nextLine()) { case "HI-LO" : game = new HighLowGame(); break; case "Riddle" : game = new RiddleGame(); break; ... } ``` Here you are. You...
Bearing in mind that the only good analogy or example or metaphor of a computer thing is the computer thing, because computer things are not really like anything else (or they would just be that thing anyway): I created an example for my students using a Tic Tac Toe game, which can be played by a human against the com...
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Almost any popular library such as Boost will have tons and tons of code with polymorphism examples. For instance, look at [Polymorphism models write up](https://www.boost.org/doc/libs/1_70_0/doc/html/poly_collection/reference.html) in Boost. I'm sure, you used them a lot too, e.g. iterators in containers, streams and ...
Bearing in mind that the only good analogy or example or metaphor of a computer thing is the computer thing, because computer things are not really like anything else (or they would just be that thing anyway): I created an example for my students using a Tic Tac Toe game, which can be played by a human against the com...
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Let me give some background that will, I hope, change a few minds about polymorphism and how it should be used and when its use should be avoided. The essence of it is that too many of the examples are naive and incorrect. They may serve as metaphors, but are, in practice, unworkable. Let me try to show why and also sh...
Bearing in mind that the only good analogy or example or metaphor of a computer thing is the computer thing, because computer things are not really like anything else (or they would just be that thing anyway): I created an example for my students using a Tic Tac Toe game, which can be played by a human against the com...
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Say you want to present a choice of interactive games ``` out.println("Which game (...) ?"); Game game; switch (in.nextLine()) { case "HI-LO" : game = new HighLowGame(); break; case "Riddle" : game = new RiddleGame(); break; ... } ``` Here you are. You...
As a professional software engineer, I used polymorphism all of the time. Here are a few examples. * Printer driver, is inherited by different printer drivers. * Window: different types: vertical packing, horizontal packing, stackable, free. Are all types of window, they all contain other displayables. Window also inh...
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Say you want to present a choice of interactive games ``` out.println("Which game (...) ?"); Game game; switch (in.nextLine()) { case "HI-LO" : game = new HighLowGame(); break; case "Riddle" : game = new RiddleGame(); break; ... } ``` Here you are. You...
One of the most used examples of polymorphism in real code would be `sort`. You don't write a comparison sort method for each type of object: you write one comparison sort method and then either implement a comparator for the type or make your objects implement a `Comparable` interface. I hope this example convinces y...
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Almost any popular library such as Boost will have tons and tons of code with polymorphism examples. For instance, look at [Polymorphism models write up](https://www.boost.org/doc/libs/1_70_0/doc/html/poly_collection/reference.html) in Boost. I'm sure, you used them a lot too, e.g. iterators in containers, streams and ...
As a professional software engineer, I used polymorphism all of the time. Here are a few examples. * Printer driver, is inherited by different printer drivers. * Window: different types: vertical packing, horizontal packing, stackable, free. Are all types of window, they all contain other displayables. Window also inh...
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Let me give some background that will, I hope, change a few minds about polymorphism and how it should be used and when its use should be avoided. The essence of it is that too many of the examples are naive and incorrect. They may serve as metaphors, but are, in practice, unworkable. Let me try to show why and also sh...
As a professional software engineer, I used polymorphism all of the time. Here are a few examples. * Printer driver, is inherited by different printer drivers. * Window: different types: vertical packing, horizontal packing, stackable, free. Are all types of window, they all contain other displayables. Window also inh...
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Almost any popular library such as Boost will have tons and tons of code with polymorphism examples. For instance, look at [Polymorphism models write up](https://www.boost.org/doc/libs/1_70_0/doc/html/poly_collection/reference.html) in Boost. I'm sure, you used them a lot too, e.g. iterators in containers, streams and ...
One of the most used examples of polymorphism in real code would be `sort`. You don't write a comparison sort method for each type of object: you write one comparison sort method and then either implement a comparator for the type or make your objects implement a `Comparable` interface. I hope this example convinces y...
5,558
I am preparing a lesson about polymorphism in C++ and I would like to give an original example other than animals and shapes and I am really struggling with it because I realize polymorphism is not that useful for real concrete applications. Can someone suggest a good example of polymorphism use?
2019/04/20
[ "https://cseducators.stackexchange.com/questions/5558", "https://cseducators.stackexchange.com", "https://cseducators.stackexchange.com/users/6890/" ]
Let me give some background that will, I hope, change a few minds about polymorphism and how it should be used and when its use should be avoided. The essence of it is that too many of the examples are naive and incorrect. They may serve as metaphors, but are, in practice, unworkable. Let me try to show why and also sh...
One of the most used examples of polymorphism in real code would be `sort`. You don't write a comparison sort method for each type of object: you write one comparison sort method and then either implement a comparator for the type or make your objects implement a `Comparable` interface. I hope this example convinces y...
20,239,054
I'm trying to make square images from rectangular in css. They also need to be centered. I've read a lot of questions here, but the answers, good as they might be, always use constant sizes in pixels whereas I need tem to be in percents so the theme can remain responsive. Basically I need to change this: ![original]...
2013/11/27
[ "https://Stackoverflow.com/questions/20239054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118293/" ]
The problem is, that it is just not possible to change the height relative to the width. So your problem is not the image itself (using overflow: hidden or background-size: cover will do that) but having the square size of your container with dynamic width and then the same height. A very strange way would be to use ...
Just use `img{max-width:100% !important; margin:0 auto !important;}` and I think it will help you.
20,239,054
I'm trying to make square images from rectangular in css. They also need to be centered. I've read a lot of questions here, but the answers, good as they might be, always use constant sizes in pixels whereas I need tem to be in percents so the theme can remain responsive. Basically I need to change this: ![original]...
2013/11/27
[ "https://Stackoverflow.com/questions/20239054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118293/" ]
The problem is, that it is just not possible to change the height relative to the width. So your problem is not the image itself (using overflow: hidden or background-size: cover will do that) but having the square size of your container with dynamic width and then the same height. A very strange way would be to use ...
have you tried this ``` img { width: 80%; } ``` make sure there is no height for img in your css file. Also make sure not to set something like height="500px" width="500px" in your html/php file. also to be centered just do ``` img { margin: auto; } ```
20,239,054
I'm trying to make square images from rectangular in css. They also need to be centered. I've read a lot of questions here, but the answers, good as they might be, always use constant sizes in pixels whereas I need tem to be in percents so the theme can remain responsive. Basically I need to change this: ![original]...
2013/11/27
[ "https://Stackoverflow.com/questions/20239054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118293/" ]
The problem is, that it is just not possible to change the height relative to the width. So your problem is not the image itself (using overflow: hidden or background-size: cover will do that) but having the square size of your container with dynamic width and then the same height. A very strange way would be to use ...
Nice picture ;) If you have an image you want centred—but covers—a parent element, using CSS only, then you’ll need two wrappers: This works only for wide images. Portrait images will just centre themselves within the container. ``` <!DOCTYPE html> <html> <head> <style> * { ma...
20,239,054
I'm trying to make square images from rectangular in css. They also need to be centered. I've read a lot of questions here, but the answers, good as they might be, always use constant sizes in pixels whereas I need tem to be in percents so the theme can remain responsive. Basically I need to change this: ![original]...
2013/11/27
[ "https://Stackoverflow.com/questions/20239054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118293/" ]
The problem is, that it is just not possible to change the height relative to the width. So your problem is not the image itself (using overflow: hidden or background-size: cover will do that) but having the square size of your container with dynamic width and then the same height. A very strange way would be to use ...
Try following css for your image. It won't break the pixels/dimensions for the image. ``` .imageClass img { width: 50%; height: auto; } .imageClass img { width: auto; height: 50%; } <img src="image_path" alt="" class="imageClass" /> ```
4,504,141
In machine learning, I'm optimizing a parameter matrix $W$. The loss function is$$L=f(y),$$where $L$ is a scalar, $y=Wx$, $x\in \mathbb{R}^n$, $y\in \mathbb{R}^m$ and the order of $W$ is $m\times n$. In all math textbooks, it is usually$$\frac{\partial L}{\partial x} = \frac{\partial L}{\partial y}\frac{\partial y}{\...
2022/08/01
[ "https://math.stackexchange.com/questions/4504141", "https://math.stackexchange.com", "https://math.stackexchange.com/users/859242/" ]
First, it is important to keep track of what functions you are differentiating. You have an $m$-vector $y$ with component functions $y\_i$ ($i=1,...,m$), and you are differentiating by an $(m\times n)$-matrix $W$. Therefore, your derivative should depend on three separate functional indices, i.e., it should be a third-...
For this computation, a coordinate based approach is not difficult. You can simply think of $\frac{\partial{y}}{\partial W}$ as being represented by the coordinates $\frac{\partial y\_k}{\partial w\_{ij}}$ for $k \in [m], i \in [m], j \in [n]$. We have $$y\_k = \sum\_{i = 1}^{n} w\_{ki}x\_i$$ so $$\frac{\partial y\_{k}...
56,881,787
I am trying to click a details about an element and I just want the details of that particular details to show and hide other element details. “This is Angular 7. I’ve tried on using \*ngIf and failed in it. I am using parent and child component communication technique. Parent HTML ``` <h4>2 Days Bangalo...
2019/07/04
[ "https://Stackoverflow.com/questions/56881787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11636772/" ]
[Both operands of `<<` will undergo **integer promotions**](https://port70.net/~nsz/c/c11/n1570.html#6.5.7p3), i.e. [C11 6.3.11p2](https://port70.net/~nsz/c/c11/n1570.html#6.3.1.1p2): > > 2 The following may be used in an expression wherever an int or unsigned int may be used: > > > * An object or expression with a...
There is no difference because of **Integer Promotions** You should really go through this excellent post on the subject [Implicit type promotion rules](https://stackoverflow.com/questions/46073295/implicit-type-promotion-rules) Assuming 4 byte `int`, before any arithmetic operation an `uint16_t` is converted to a si...
456,713
When I write C++ code for a class using templates and split the code between a source (CPP) file and a header (H) file, I get a whole lot of "unresolved external symbol" errors when it comes to linking the final executible, despite the object file being correctly built and included in the linking. What's happening here...
2009/01/19
[ "https://Stackoverflow.com/questions/456713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10247/" ]
Templated classes and functions are not instantiated until they are used, typically in a separate .cpp file (e.g. the program source). When the template is used, the compiler needs the full code for that function to be able to build the correct function with the appropriate type. However, in this case the code for that...
Another option is to put the code in the cpp file and in the same cpp file add explicit instantiations of the template with the types you expect to be using. This is useful if you know you're only going to be using it for a couple of types you know in advance.
456,713
When I write C++ code for a class using templates and split the code between a source (CPP) file and a header (H) file, I get a whole lot of "unresolved external symbol" errors when it comes to linking the final executible, despite the object file being correctly built and included in the linking. What's happening here...
2009/01/19
[ "https://Stackoverflow.com/questions/456713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10247/" ]
Templated classes and functions are not instantiated until they are used, typically in a separate .cpp file (e.g. the program source). When the template is used, the compiler needs the full code for that function to be able to build the correct function with the appropriate type. However, in this case the code for that...
For each file that include the .h file you should be to insert both lines: ``` #include "MyfileWithTemplatesDeclaration.h" #include "MyfileWithTemplatesDefinition.cpp" ``` --- sample ``` #include "list.h" #include "list.cpp" //<---for to fix bug link err 2019 int main(int argc, _TCHAR* argv[]) { ...
456,713
When I write C++ code for a class using templates and split the code between a source (CPP) file and a header (H) file, I get a whole lot of "unresolved external symbol" errors when it comes to linking the final executible, despite the object file being correctly built and included in the linking. What's happening here...
2009/01/19
[ "https://Stackoverflow.com/questions/456713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10247/" ]
Another option is to put the code in the cpp file and in the same cpp file add explicit instantiations of the template with the types you expect to be using. This is useful if you know you're only going to be using it for a couple of types you know in advance.
For each file that include the .h file you should be to insert both lines: ``` #include "MyfileWithTemplatesDeclaration.h" #include "MyfileWithTemplatesDefinition.cpp" ``` --- sample ``` #include "list.h" #include "list.cpp" //<---for to fix bug link err 2019 int main(int argc, _TCHAR* argv[]) { ...
2,743,888
I was randomly playing around on Desmos, and I realized that this series seems to evidently converge to $\frac{1}{2}$. Is there any reason why this converges to such a nice number? Please note that I am in high school, so if this is requires an incredibly complex solution I may not understand it (but if it would be of...
2018/04/19
[ "https://math.stackexchange.com/questions/2743888", "https://math.stackexchange.com", "https://math.stackexchange.com/users/409778/" ]
**Because this is the [Fourier series](https://en.wikipedia.org/wiki/Fourier_series) for a simple function.** Given *any* sufficiently nicely-behaved function with period $L$ (this means that for all $x$, $f(x+L)=f(x)$), it is possible to write it as an infinite sum of other periodic functions: in this case, $\sin{(2\...
There are two issues here: We have to prove that the series converges, and then that the sum is ${1\over2}$. We need the imaginary part of the series $$\sum\_{n=1}^\infty(-1)^{n-1}{e^{in}\over n}\ .\tag{1}$$ The general term of $(1)$ is the product of ${1\over n}$, which converges monotonically to $0$, and $(-e^i)^n$....
34,422,842
I'm trying to come up with a regex to extract time out of a string to build an application. Here's what I've got so far. Not sure what am I doing wrong here. <https://regex101.com/r/fC0lI5/1> I can get some the string but not all of the different variations. ``` ([01]?[0-9]*:?[0-9]*[AP]M?)-([01]?[0-9]*:?[0-9]*[A...
2015/12/22
[ "https://Stackoverflow.com/questions/34422842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/635162/" ]
``` ([01]?[0-9]+:?[0-9]*(?:[AP]M)?)-([01]?[0-9]+:?[0-9]*(?:[AP]M)?) ^^ ^^ ^^ ^^ ``` Just make `AM` component optional.See demo.Also make first part `+` or else it will match empty strings. <https://regex101.com/r/fC0lI5/2>
The AM/PM in either capture group is not optional ``` ([01]?[0-9]+:?[0-9]*(?:[AP]M)?)-([01]?[0-9]+:?[0-9]*(?:[AP]M)?) ``` I think mine is more valid than the others because the others will allow (they've since fixed theirs) ``` 8M-9M, which is not valid. ```
34,422,842
I'm trying to come up with a regex to extract time out of a string to build an application. Here's what I've got so far. Not sure what am I doing wrong here. <https://regex101.com/r/fC0lI5/1> I can get some the string but not all of the different variations. ``` ([01]?[0-9]*:?[0-9]*[AP]M?)-([01]?[0-9]*:?[0-9]*[A...
2015/12/22
[ "https://Stackoverflow.com/questions/34422842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/635162/" ]
``` ([01]?[0-9]+:?[0-9]*(?:[AP]M)?)-([01]?[0-9]+:?[0-9]*(?:[AP]M)?) ^^ ^^ ^^ ^^ ``` Just make `AM` component optional.See demo.Also make first part `+` or else it will match empty strings. <https://regex101.com/r/fC0lI5/2>
As pointed by other answers, the A and P are not optional. Furthermore, your regex will match other strings (like ":A-:A" or "98387899A-A"). This works and will be stricter that yours: ``` ((?:[01]?[0-9]:)?[0-9]{1,2}(?:AM|PM)?)-((?:[01]?[0-9]:)?[0-9]{1,2}(?:AM|PM)?) ``` See [the Python manual](https://docs.python.o...
34,422,842
I'm trying to come up with a regex to extract time out of a string to build an application. Here's what I've got so far. Not sure what am I doing wrong here. <https://regex101.com/r/fC0lI5/1> I can get some the string but not all of the different variations. ``` ([01]?[0-9]*:?[0-9]*[AP]M?)-([01]?[0-9]*:?[0-9]*[A...
2015/12/22
[ "https://Stackoverflow.com/questions/34422842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/635162/" ]
The AM/PM in either capture group is not optional ``` ([01]?[0-9]+:?[0-9]*(?:[AP]M)?)-([01]?[0-9]+:?[0-9]*(?:[AP]M)?) ``` I think mine is more valid than the others because the others will allow (they've since fixed theirs) ``` 8M-9M, which is not valid. ```
As pointed by other answers, the A and P are not optional. Furthermore, your regex will match other strings (like ":A-:A" or "98387899A-A"). This works and will be stricter that yours: ``` ((?:[01]?[0-9]:)?[0-9]{1,2}(?:AM|PM)?)-((?:[01]?[0-9]:)?[0-9]{1,2}(?:AM|PM)?) ``` See [the Python manual](https://docs.python.o...
44,545,081
Firstly, let me explain the app structure of how it is maintained I have here two applications First, a native objective-c based iOS application which is working perfectly, the task of the native application is to launch the camera once the application is launched, capture image and do some OpenGL processing, displa...
2017/06/14
[ "https://Stackoverflow.com/questions/44545081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5169367/" ]
*firebaser here* We've been able to confirm this behavior with `signInWithRedirect()`. This is indeed a bug. We'll fix it in an upcoming version. **Update**: This should be fixed in [version 4.1.3](https://firebase.google.com/support/release-notes/js#4.1.3).
This issue appears to take place on Firebase JavaScript SDK 9.5.0 (and potentially with earlier recent releases). The steps to reproduce are the same as described above. A few additional observations: * If the first call is made to signInWithRedirect, and it fails due to network connection, subsequent calls both to s...
35,390,234
I have a problem in my controller(AlbumController) , I want to use one of my model(Album) in this controller but I got the error Class 'Album' not found AlbumController.php : ``` <?php namespace App\Http\Controllers; use Illuminate\Routing\Controller as BaseController; class AlbumController extends BaseController { p...
2016/02/14
[ "https://Stackoverflow.com/questions/35390234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5165116/" ]
you can use chain from itertools to merge the lists and then search in the returned list. ``` >>> sample=[[1,[1,0]],[1,1]] >>> from itertools import chain >>> print [1,0] in chain(*sample) True ```
I don't know how to solve this completely without a loop. But in Python you should never write `for i in range(len(sample))`. So the answer to your question: Yes there is a better and faster way you could loop your list `for i in sample` The way Python handles the loops is really fast and works also very well with a...
35,390,234
I have a problem in my controller(AlbumController) , I want to use one of my model(Album) in this controller but I got the error Class 'Album' not found AlbumController.php : ``` <?php namespace App\Http\Controllers; use Illuminate\Routing\Controller as BaseController; class AlbumController extends BaseController { p...
2016/02/14
[ "https://Stackoverflow.com/questions/35390234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5165116/" ]
A recursive solution that would work for arbitrary (max recursion depth aside) deep nesting. Also works if any elements of the outermost list are not iterables themselves. ``` from functools import partial def contains_nested(some_iterable, elmnt): try: if elmnt in some_iterable: return True ...
I don't know how to solve this completely without a loop. But in Python you should never write `for i in range(len(sample))`. So the answer to your question: Yes there is a better and faster way you could loop your list `for i in sample` The way Python handles the loops is really fast and works also very well with a...
35,390,234
I have a problem in my controller(AlbumController) , I want to use one of my model(Album) in this controller but I got the error Class 'Album' not found AlbumController.php : ``` <?php namespace App\Http\Controllers; use Illuminate\Routing\Controller as BaseController; class AlbumController extends BaseController { p...
2016/02/14
[ "https://Stackoverflow.com/questions/35390234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5165116/" ]
you can use chain from itertools to merge the lists and then search in the returned list. ``` >>> sample=[[1,[1,0]],[1,1]] >>> from itertools import chain >>> print [1,0] in chain(*sample) True ```
You can [flatten](https://stackoverflow.com/a/952952/5276734) your `sample` list and then search in that flattened list: ``` > sample = [[1, [1, 0]], [1, 1]] > [1, 0] in [item for sublist in sample for item in sublist] > True ```
35,390,234
I have a problem in my controller(AlbumController) , I want to use one of my model(Album) in this controller but I got the error Class 'Album' not found AlbumController.php : ``` <?php namespace App\Http\Controllers; use Illuminate\Routing\Controller as BaseController; class AlbumController extends BaseController { p...
2016/02/14
[ "https://Stackoverflow.com/questions/35390234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5165116/" ]
A recursive solution that would work for arbitrary (max recursion depth aside) deep nesting. Also works if any elements of the outermost list are not iterables themselves. ``` from functools import partial def contains_nested(some_iterable, elmnt): try: if elmnt in some_iterable: return True ...
You can [flatten](https://stackoverflow.com/a/952952/5276734) your `sample` list and then search in that flattened list: ``` > sample = [[1, [1, 0]], [1, 1]] > [1, 0] in [item for sublist in sample for item in sublist] > True ```
35,390,234
I have a problem in my controller(AlbumController) , I want to use one of my model(Album) in this controller but I got the error Class 'Album' not found AlbumController.php : ``` <?php namespace App\Http\Controllers; use Illuminate\Routing\Controller as BaseController; class AlbumController extends BaseController { p...
2016/02/14
[ "https://Stackoverflow.com/questions/35390234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5165116/" ]
you can use chain from itertools to merge the lists and then search in the returned list. ``` >>> sample=[[1,[1,0]],[1,1]] >>> from itertools import chain >>> print [1,0] in chain(*sample) True ```
A recursive solution that would work for arbitrary (max recursion depth aside) deep nesting. Also works if any elements of the outermost list are not iterables themselves. ``` from functools import partial def contains_nested(some_iterable, elmnt): try: if elmnt in some_iterable: return True ...
50,458,856
I have data frame with a column ('A') as: ``` A E19 V17 23.12 23.4 23 42 48 ``` like this, there are more than a 100k records. I want to replace all the occurrences starting with `E` and `V` with a number like `300` and replace numbers `(23.4,23.12,...)` with `23`. The code that I am using: ``` def clean(x): x...
2018/05/22
[ "https://Stackoverflow.com/questions/50458856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9825767/" ]
Firstly, it is perfectly fine to deploy them on different servers/cloud. Can you give the URL ? I feel it is not issue of different clouds but configuration issue. Can you first put a simple html file on same S3 bucket and see if you can access that via your domain name. Suppose you have your react app example.com ho...
have you tried making setting S3 bucket to “public”? you can either set a policy for the entire bucket or to to make certain objects available publicly. [here’s an AWS manual](https://aws.amazon.com/premiumsupport/knowledge-center/read-access-objects-s3-bucket/) chances are, your react app needs something like that
50,458,856
I have data frame with a column ('A') as: ``` A E19 V17 23.12 23.4 23 42 48 ``` like this, there are more than a 100k records. I want to replace all the occurrences starting with `E` and `V` with a number like `300` and replace numbers `(23.4,23.12,...)` with `23`. The code that I am using: ``` def clean(x): x...
2018/05/22
[ "https://Stackoverflow.com/questions/50458856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9825767/" ]
I have experienced similar issues trying to run a react.js app through cloudront, here are a few things you should check: * Make sure that your s3 hosting bucket has public read access, or that you have set up your cloudfront origin access policy with the s3 bucket by first creating an origin access identity in cloudf...
have you tried making setting S3 bucket to “public”? you can either set a policy for the entire bucket or to to make certain objects available publicly. [here’s an AWS manual](https://aws.amazon.com/premiumsupport/knowledge-center/read-access-objects-s3-bucket/) chances are, your react app needs something like that
25,847,240
I have a search bar and beside that i want a button with the same background color as the one in search bar. Does anyone know this color? ![enter image description here](https://i.stack.imgur.com/25UJo.png)
2014/09/15
[ "https://Stackoverflow.com/questions/25847240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1366083/" ]
You can iterate over all the choices until you find the 'end of input': ``` read -p "Enter choice: " ch for choice in $ch; do [ "$choice" == 'e' ] && break eval function_$choice done ``` NOTE: `eval` will assemble a command from the arguments and then execute it through the shell
You should iterate over your string ch until "e" appears: ``` #!/bin/bash #Functions are defined here 1 2 3 4 5 echo "choice" echo echo "[1] one" echo "[2] two" echo "[3] three" echo "[4] four" echo "[5] five" echo read -p "Enter choice: " ch for i in ${ch} do if [ "$i" == "1" ]; then function_1 else if [ ...
25,847,240
I have a search bar and beside that i want a button with the same background color as the one in search bar. Does anyone know this color? ![enter image description here](https://i.stack.imgur.com/25UJo.png)
2014/09/15
[ "https://Stackoverflow.com/questions/25847240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1366083/" ]
You can iterate over all the choices until you find the 'end of input': ``` read -p "Enter choice: " ch for choice in $ch; do [ "$choice" == 'e' ] && break eval function_$choice done ``` NOTE: `eval` will assemble a command from the arguments and then execute it through the shell
It would be better if you made each input parameter an option and used getopts ie ``` myProg.sh -a aArg -b bArg -c cArg ``` Inside myProg.sh: ``` while getopts "a:b:c" option do case $option in a) function_1;; b) function_2;; c) function_3;; *) exitFunc "Incorrect argument";; # You need to wri...
25,847,240
I have a search bar and beside that i want a button with the same background color as the one in search bar. Does anyone know this color? ![enter image description here](https://i.stack.imgur.com/25UJo.png)
2014/09/15
[ "https://Stackoverflow.com/questions/25847240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1366083/" ]
You should iterate over your string ch until "e" appears: ``` #!/bin/bash #Functions are defined here 1 2 3 4 5 echo "choice" echo echo "[1] one" echo "[2] two" echo "[3] three" echo "[4] four" echo "[5] five" echo read -p "Enter choice: " ch for i in ${ch} do if [ "$i" == "1" ]; then function_1 else if [ ...
It would be better if you made each input parameter an option and used getopts ie ``` myProg.sh -a aArg -b bArg -c cArg ``` Inside myProg.sh: ``` while getopts "a:b:c" option do case $option in a) function_1;; b) function_2;; c) function_3;; *) exitFunc "Incorrect argument";; # You need to wri...
426,824
I'm trying to fix a problem with my webcam in Wheezy, and I need some information about the drive with the command `udevinfo`. The problem is: where is this executable? if I run `sudo udevinfo` the result is: > > udevinfo: command not found > > > Any suggestion?
2012/05/21
[ "https://superuser.com/questions/426824", "https://superuser.com", "https://superuser.com/users/91873/" ]
Debian web infrastructure supports [searching packages by their contents](http://www.debian.org/distrib/packages#search_contents). The same result can be achieved using the [`apt-file`](https://packages.debian.org/source/stretch/apt-file) tool. **Update:** I was too confident you just don't know how to find a relevan...
`udevadm info` **is the new command**. that replaces udevinfo The arguments are same as `udevinfo`.
426,824
I'm trying to fix a problem with my webcam in Wheezy, and I need some information about the drive with the command `udevinfo`. The problem is: where is this executable? if I run `sudo udevinfo` the result is: > > udevinfo: command not found > > > Any suggestion?
2012/05/21
[ "https://superuser.com/questions/426824", "https://superuser.com", "https://superuser.com/users/91873/" ]
Debian web infrastructure supports [searching packages by their contents](http://www.debian.org/distrib/packages#search_contents). The same result can be achieved using the [`apt-file`](https://packages.debian.org/source/stretch/apt-file) tool. **Update:** I was too confident you just don't know how to find a relevan...
The answer above is incomplete: if you're like me, you're here because you have found yourself using some script (perhaps a "configure" script) that parses the output of udevinfo to ensure that udev is recent enough. In that case, the arguments to "udevadm info" and "udevinfo" might be the same, but the output isn't. ...
426,824
I'm trying to fix a problem with my webcam in Wheezy, and I need some information about the drive with the command `udevinfo`. The problem is: where is this executable? if I run `sudo udevinfo` the result is: > > udevinfo: command not found > > > Any suggestion?
2012/05/21
[ "https://superuser.com/questions/426824", "https://superuser.com", "https://superuser.com/users/91873/" ]
Debian web infrastructure supports [searching packages by their contents](http://www.debian.org/distrib/packages#search_contents). The same result can be achieved using the [`apt-file`](https://packages.debian.org/source/stretch/apt-file) tool. **Update:** I was too confident you just don't know how to find a relevan...
``` udevadm info -a ``` Does what `udevinfo -a -p` used to do
426,824
I'm trying to fix a problem with my webcam in Wheezy, and I need some information about the drive with the command `udevinfo`. The problem is: where is this executable? if I run `sudo udevinfo` the result is: > > udevinfo: command not found > > > Any suggestion?
2012/05/21
[ "https://superuser.com/questions/426824", "https://superuser.com", "https://superuser.com/users/91873/" ]
`udevadm info` **is the new command**. that replaces udevinfo The arguments are same as `udevinfo`.
The answer above is incomplete: if you're like me, you're here because you have found yourself using some script (perhaps a "configure" script) that parses the output of udevinfo to ensure that udev is recent enough. In that case, the arguments to "udevadm info" and "udevinfo" might be the same, but the output isn't. ...
426,824
I'm trying to fix a problem with my webcam in Wheezy, and I need some information about the drive with the command `udevinfo`. The problem is: where is this executable? if I run `sudo udevinfo` the result is: > > udevinfo: command not found > > > Any suggestion?
2012/05/21
[ "https://superuser.com/questions/426824", "https://superuser.com", "https://superuser.com/users/91873/" ]
`udevadm info` **is the new command**. that replaces udevinfo The arguments are same as `udevinfo`.
``` udevadm info -a ``` Does what `udevinfo -a -p` used to do
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
To keep the aspect ratio of an img, add: ``` img { height: auto; width: 100%; } ```
Try this ``` img { width: 100%; height: auto; } ``` Hope it works
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
@Hassan Baig, You should avoid to mention both 'width' and 'height' attributes otherwise the image will get stretch like this. For this case, you should remove the 'height' property from the image in HTML or you can add 'height: auto !important' in CSS to override the inline style. '!important' will override the exi...
You have hardcoded height in your IMG tag (html), thats making a problem. Just remove the height parameter from IMG tag and the image will auto adjust.
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
For responsive image. ``` img{ display: block; height: auto; margin-left: auto; /* For center the image */ margin-right: auto; /* For center the image */ max-width: 100%; } ```
Try this ``` img { width: 100%; height: auto; } ``` Hope it works
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
To keep the aspect ratio of an img, add: ``` img { height: auto; width: 100%; } ```
Try to change div's max-width to see it responsive ```css div { display: table; max-width: 100px; } img { display: table; margin: 0 auto; width: 100%; } label { display: table; margin: 0 auto; } ``` ```html <div><img src="https://upload.wikimedia.org/wikipedia/commons/e/e1/Bauhaus.JPG"/><l...
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
@Hassan Baig, You should avoid to mention both 'width' and 'height' attributes otherwise the image will get stretch like this. For this case, you should remove the 'height' property from the image in HTML or you can add 'height: auto !important' in CSS to override the inline style. '!important' will override the exi...
Try this ``` img { width: 100%; height: auto; } ``` Hope it works
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
To keep the aspect ratio of an img, add: ``` img { height: auto; width: 100%; } ```
For responsive image. ``` img{ display: block; height: auto; margin-left: auto; /* For center the image */ margin-right: auto; /* For center the image */ max-width: 100%; } ```
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
To keep the aspect ratio of an img, add: ``` img { height: auto; width: 100%; } ```
@Hassan Baig, You should avoid to mention both 'width' and 'height' attributes otherwise the image will get stretch like this. For this case, you should remove the 'height' property from the image in HTML or you can add 'height: auto !important' in CSS to override the inline style. '!important' will override the exi...
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
To keep the aspect ratio of an img, add: ``` img { height: auto; width: 100%; } ```
You should remove te inline height and width of the image and set the image width and height in your CSS to: ``` img { height: auto; width: 100%; } ```
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
For responsive image. ``` img{ display: block; height: auto; margin-left: auto; /* For center the image */ margin-right: auto; /* For center the image */ max-width: 100%; } ```
Try to change div's max-width to see it responsive ```css div { display: table; max-width: 100px; } img { display: table; margin: 0 auto; width: 100%; } label { display: table; margin: 0 auto; } ``` ```html <div><img src="https://upload.wikimedia.org/wikipedia/commons/e/e1/Bauhaus.JPG"/><l...
47,010,736
I run a Django-based instagram clone where users share photos with others. Photos appear with styling that makes them look like polaroids. Moreover, captions are added within the polaroid styling, not outside it. Here's an example: [![enter image description here](https://i.stack.imgur.com/jIGBy.png)](https://i.stack....
2017/10/30
[ "https://Stackoverflow.com/questions/47010736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936905/" ]
@Hassan Baig, You should avoid to mention both 'width' and 'height' attributes otherwise the image will get stretch like this. For this case, you should remove the 'height' property from the image in HTML or you can add 'height: auto !important' in CSS to override the inline style. '!important' will override the exi...
You should remove te inline height and width of the image and set the image width and height in your CSS to: ``` img { height: auto; width: 100%; } ```
313,929
I'm tearing my hair out here. Please can someone assist me. I have users on a terminal server and they all use the same programs - Office and an Accounting package, yet certain processes are slower to load for userB & userC, while userA gets an immediate prompt from the process. It takes userB/C 30s for the prompt to a...
2011/09/21
[ "https://serverfault.com/questions/313929", "https://serverfault.com", "https://serverfault.com/users/95440/" ]
I believe (I've never used it, and found it through the iptables man page) --timestart and --timestop will accomplish this. `iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED -m tcp -p tcp --source 1.2.3.4 --dport 3306 --timestart 13:00 --timestop 14:00 -j ACCEPT` Would allow you between 1 and 2pm. > > Thi...
Alternative solution that does not require iptables time module supported. ``` ( iptables -I INPUT -p tcp -s 1.2.3.4 --dport 3306 -j ACCEPT ; sleep 1h; iptables -D INPUT -p tcp -s 1.2.3.4 --dport 3306 -j ACCEPT ) & ``` This won't close the connections after hour, it will simply return to whatever policy was before a...
9,868,319
I have this button which is not working correctly for hold button for a period (but it works like click only). Where i was trying to do if the button is `hold` for greater/equal then 2 seconds then `callfunction1`, if the button was pressed less then 2 seconds then `callfuntion2`. ``` var clickDisabled = false; fun...
2012/03/26
[ "https://Stackoverflow.com/questions/9868319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Listen for both events, mousedown and mouseup, measuring the time between both: ``` var timeDown; var timeUp; $('.button').live("mousedown",function(){ timeDown = event.timeStamp; }); $('.button').live("mouseup",function(){ timeUp = event.timeStamp; time = t...
That was a great suggestion from slash. This is how you can do this ``` var clickstart; var clickstop; $("a").on('mousedown', function(e) { clickstart = e.timeStamp; }).on('mouseup', function(e) { clickstop = e.timeStamp- clickstart if(clickstop >= 2000) two() else one(); }); ``` ### [Demo](http:...
9,868,319
I have this button which is not working correctly for hold button for a period (but it works like click only). Where i was trying to do if the button is `hold` for greater/equal then 2 seconds then `callfunction1`, if the button was pressed less then 2 seconds then `callfuntion2`. ``` var clickDisabled = false; fun...
2012/03/26
[ "https://Stackoverflow.com/questions/9868319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I think this solution should work. I have not tested it but it should give you the right idea. ``` var startTime; function callfunction1() { // you have hold he button for greater then or equal 2 second } function callfunction2() { // you have hold the button less then 2 second } function buttonDownEvent() { va...
Listen for both events, mousedown and mouseup, measuring the time between both: ``` var timeDown; var timeUp; $('.button').live("mousedown",function(){ timeDown = event.timeStamp; }); $('.button').live("mouseup",function(){ timeUp = event.timeStamp; time = t...
9,868,319
I have this button which is not working correctly for hold button for a period (but it works like click only). Where i was trying to do if the button is `hold` for greater/equal then 2 seconds then `callfunction1`, if the button was pressed less then 2 seconds then `callfuntion2`. ``` var clickDisabled = false; fun...
2012/03/26
[ "https://Stackoverflow.com/questions/9868319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can do this using events to the mouseup and mousedown events and timing the difference between them. Also, you need to remember which element caused the click - if the user released the mouse on a different element then it should just do the "non 2-second hold" function. A JSFiddle showing this working is available...
That was a great suggestion from slash. This is how you can do this ``` var clickstart; var clickstop; $("a").on('mousedown', function(e) { clickstart = e.timeStamp; }).on('mouseup', function(e) { clickstop = e.timeStamp- clickstart if(clickstop >= 2000) two() else one(); }); ``` ### [Demo](http:...
9,868,319
I have this button which is not working correctly for hold button for a period (but it works like click only). Where i was trying to do if the button is `hold` for greater/equal then 2 seconds then `callfunction1`, if the button was pressed less then 2 seconds then `callfuntion2`. ``` var clickDisabled = false; fun...
2012/03/26
[ "https://Stackoverflow.com/questions/9868319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I think this solution should work. I have not tested it but it should give you the right idea. ``` var startTime; function callfunction1() { // you have hold he button for greater then or equal 2 second } function callfunction2() { // you have hold the button less then 2 second } function buttonDownEvent() { va...
You can do this using events to the mouseup and mousedown events and timing the difference between them. Also, you need to remember which element caused the click - if the user released the mouse on a different element then it should just do the "non 2-second hold" function. A JSFiddle showing this working is available...
9,868,319
I have this button which is not working correctly for hold button for a period (but it works like click only). Where i was trying to do if the button is `hold` for greater/equal then 2 seconds then `callfunction1`, if the button was pressed less then 2 seconds then `callfuntion2`. ``` var clickDisabled = false; fun...
2012/03/26
[ "https://Stackoverflow.com/questions/9868319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I think this solution should work. I have not tested it but it should give you the right idea. ``` var startTime; function callfunction1() { // you have hold he button for greater then or equal 2 second } function callfunction2() { // you have hold the button less then 2 second } function buttonDownEvent() { va...
That was a great suggestion from slash. This is how you can do this ``` var clickstart; var clickstop; $("a").on('mousedown', function(e) { clickstart = e.timeStamp; }).on('mouseup', function(e) { clickstop = e.timeStamp- clickstart if(clickstop >= 2000) two() else one(); }); ``` ### [Demo](http:...
4,418,069
u gave a problem in this code it gives me $(this).fadeIn() is not a function, any thoughts ? ``` $('img').hide().each(function(){ $(this).load(function(){ $(this).fadeIn(); }); }); ```
2010/12/11
[ "https://Stackoverflow.com/questions/4418069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223130/" ]
If you meant fixing the outer $(this) in inner function, you can do: ``` $('img').hide().each(function(){ var outer = $(this); outer.load(function(){ outer.fadeIn(); }); }); ```
The value of `this` changes inside of nested functions — its value isn't "captured" the way other variables are. To avoid this, you can assign `this` to another variable! ``` $('img').hide().each(function(){ var that = $(this); that.load(function(){ that.fadeIn(); }); }); ```
4,418,069
u gave a problem in this code it gives me $(this).fadeIn() is not a function, any thoughts ? ``` $('img').hide().each(function(){ $(this).load(function(){ $(this).fadeIn(); }); }); ```
2010/12/11
[ "https://Stackoverflow.com/questions/4418069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223130/" ]
If you meant fixing the outer $(this) in inner function, you can do: ``` $('img').hide().each(function(){ var outer = $(this); outer.load(function(){ outer.fadeIn(); }); }); ```
Your code is correct. Not sure what the issue would be. In the [`.load()`](http://api.jquery.com/load-event/) event handler, `this` references the element that received the event, so there should be no reason to close around the outer `this`. If you're not doing anything else in the `.each()`, you could get rid of tha...
4,418,069
u gave a problem in this code it gives me $(this).fadeIn() is not a function, any thoughts ? ``` $('img').hide().each(function(){ $(this).load(function(){ $(this).fadeIn(); }); }); ```
2010/12/11
[ "https://Stackoverflow.com/questions/4418069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223130/" ]
The value of `this` changes inside of nested functions — its value isn't "captured" the way other variables are. To avoid this, you can assign `this` to another variable! ``` $('img').hide().each(function(){ var that = $(this); that.load(function(){ that.fadeIn(); }); }); ```
Your code is correct. Not sure what the issue would be. In the [`.load()`](http://api.jquery.com/load-event/) event handler, `this` references the element that received the event, so there should be no reason to close around the outer `this`. If you're not doing anything else in the `.each()`, you could get rid of tha...
40,247
I'm looking for the title of a book-series - I'm pretty sure it was a trilogy when I ran into it, but books may have been added. It's possible I may mix in details from other books/series I've read, but most should be correct. I think the main-character is a teenage girl/young woman. She becomes the leader/alpha of a ...
2013/09/03
[ "https://scifi.stackexchange.com/questions/40247", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/12214/" ]
I think the Series you are looking for is: [Women of the Underworld](http://en.wikipedia.org/wiki/Women_of_the_Otherworld) by [Kelly Armstrong](http://en.wikipedia.org/wiki/Kelley_Armstrong) and your description of the Novel description matches the first book in the series: Bitten Link: [ISFDB](https://www.isfdb.or...
[Raised by wolves](http://www.goodreads.com/series/40852-raised-by-wolves) by Jennifer Lynn Barnes? Its a trilogy. > > Adopted by the Alpha of a werewolf pack after a rogue wolf brutally > killed her parents right before her eyes, fifteen-year-old Bryn knows > only pack life, and the rigid social hierarchy that con...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
Script file arguments ===================== The below example provides the syntax needed to pass a Azure DevOps yaml boolean and an array to a PowerShell script file via arguments. boolean -> Switch object -> Array Powershell Script ----------------- ``` [CmdletBinding()] param ( [Parameter()] [switch] ...
> > How to pass complex DevOps pipeline template parameter to script > > > I am afraid we could not pass complex DevOps pipeline template parameters to a PowerShell script. Currently, the task of Azure devops only supports the transfer of one-dimensional arrays. It cannot accept and transfer two-dimensional arra...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
Based on convertToJson idea by @ed-randall, together with ConvertFrom-Json Powershell function, we can use a JSON 'contract' to pass values between yaml and PS script: ``` - powershell: | $myArray = '${{ convertToJson(parameters.myArray) }}' | ConvertFrom-Json ... ```
Script file arguments ===================== The below example provides the syntax needed to pass a Azure DevOps yaml boolean and an array to a PowerShell script file via arguments. boolean -> Switch object -> Array Powershell Script ----------------- ``` [CmdletBinding()] param ( [Parameter()] [switch] ...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
You can now convert these types of parameters to String using the `convertToJson` function in an ADO pipeline: ``` parameters: - name: myParameter type: object default: name1: value1 name2: value2 ... - task: Bash@3 inputs: targetType: inline script: | echo "${{ convertToJso...
As [@Leo Liu MSFT](https://stackoverflow.com/users/7460777/leo-liu-msft) [mentioned in its answer](https://stackoverflow.com/a/59987335/2242485), this is indeed not supported right now but someone already [opened an issue for this improvement](https://github.com/microsoft/azure-pipelines-yaml/issues/427) . This issue ...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
Based on convertToJson idea by @ed-randall, together with ConvertFrom-Json Powershell function, we can use a JSON 'contract' to pass values between yaml and PS script: ``` - powershell: | $myArray = '${{ convertToJson(parameters.myArray) }}' | ConvertFrom-Json ... ```
As [@Leo Liu MSFT](https://stackoverflow.com/users/7460777/leo-liu-msft) [mentioned in its answer](https://stackoverflow.com/a/59987335/2242485), this is indeed not supported right now but someone already [opened an issue for this improvement](https://github.com/microsoft/azure-pipelines-yaml/issues/427) . This issue ...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
Based on convertToJson idea by @ed-randall, together with ConvertFrom-Json Powershell function, we can use a JSON 'contract' to pass values between yaml and PS script: ``` - powershell: | $myArray = '${{ convertToJson(parameters.myArray) }}' | ConvertFrom-Json ... ```
> > How to pass complex DevOps pipeline template parameter to script > > > I am afraid we could not pass complex DevOps pipeline template parameters to a PowerShell script. Currently, the task of Azure devops only supports the transfer of one-dimensional arrays. It cannot accept and transfer two-dimensional arra...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
I'm also facing a similar problem, my workaround is to flatten the array in a string using different separator for different dimensions. For example I want to make some parameters required and fail the build if these parameters are not passed, instead of add a task for every parameter to check, I want to do this in a ...
Script file arguments ===================== The below example provides the syntax needed to pass a Azure DevOps yaml boolean and an array to a PowerShell script file via arguments. boolean -> Switch object -> Array Powershell Script ----------------- ``` [CmdletBinding()] param ( [Parameter()] [switch] ...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
You can now convert these types of parameters to String using the `convertToJson` function in an ADO pipeline: ``` parameters: - name: myParameter type: object default: name1: value1 name2: value2 ... - task: Bash@3 inputs: targetType: inline script: | echo "${{ convertToJso...
I'm also facing a similar problem, my workaround is to flatten the array in a string using different separator for different dimensions. For example I want to make some parameters required and fail the build if these parameters are not passed, instead of add a task for every parameter to check, I want to do this in a ...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
I'm also facing a similar problem, my workaround is to flatten the array in a string using different separator for different dimensions. For example I want to make some parameters required and fail the build if these parameters are not passed, instead of add a task for every parameter to check, I want to do this in a ...
As [@Leo Liu MSFT](https://stackoverflow.com/users/7460777/leo-liu-msft) [mentioned in its answer](https://stackoverflow.com/a/59987335/2242485), this is indeed not supported right now but someone already [opened an issue for this improvement](https://github.com/microsoft/azure-pipelines-yaml/issues/427) . This issue ...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
You can now convert these types of parameters to String using the `convertToJson` function in an ADO pipeline: ``` parameters: - name: myParameter type: object default: name1: value1 name2: value2 ... - task: Bash@3 inputs: targetType: inline script: | echo "${{ convertToJso...
Script file arguments ===================== The below example provides the syntax needed to pass a Azure DevOps yaml boolean and an array to a PowerShell script file via arguments. boolean -> Switch object -> Array Powershell Script ----------------- ``` [CmdletBinding()] param ( [Parameter()] [switch] ...
59,972,330
trying to make this tutorial work <https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-voice.html> . * current blocking issue: I'm facing this exception: ``` Caused by: java.net.UnknownHostException: sms-voice.pinpoint.us-east-1.amazonaws.com: No address associated with hostname ``` * another t...
2020/01/29
[ "https://Stackoverflow.com/questions/59972330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1611358/" ]
You can now convert these types of parameters to String using the `convertToJson` function in an ADO pipeline: ``` parameters: - name: myParameter type: object default: name1: value1 name2: value2 ... - task: Bash@3 inputs: targetType: inline script: | echo "${{ convertToJso...
Based on convertToJson idea by @ed-randall, together with ConvertFrom-Json Powershell function, we can use a JSON 'contract' to pass values between yaml and PS script: ``` - powershell: | $myArray = '${{ convertToJson(parameters.myArray) }}' | ConvertFrom-Json ... ```
47,356,760
I have a table that aggregate items and their categories. An item can have multiple categories. Here is the simplified schema and example data: Table name: xref, (itemID, catID) defined as primary key ``` itemID | catID -------+------- 4059 | 159 4059 | 219 ``` I also have a category merge function. When doing ...
2017/11/17
[ "https://Stackoverflow.com/questions/47356760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/328078/" ]
I can't use @JNevill's approach because I don't know to-be-affected itemID's beforehand. But that give me an idea for this 2 step solution. ``` UPDATE IGNORE `xref` SET `catID` = 219 WHERE `catID` = 159 DELETE FROM `xref` WHERE `catID` = 159 ``` Thanks for the all other answers/comments.
Try following query: ``` UPDATE `xref` SET `catID` = 219 WHERE `catID` = 159 and `itemID` not in (select 'itemID' from (select *from 'xref') x where 'catID' = 219) ; ``` Hope it helps!
47,356,760
I have a table that aggregate items and their categories. An item can have multiple categories. Here is the simplified schema and example data: Table name: xref, (itemID, catID) defined as primary key ``` itemID | catID -------+------- 4059 | 159 4059 | 219 ``` I also have a category merge function. When doing ...
2017/11/17
[ "https://Stackoverflow.com/questions/47356760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/328078/" ]
I can't use @JNevill's approach because I don't know to-be-affected itemID's beforehand. But that give me an idea for this 2 step solution. ``` UPDATE IGNORE `xref` SET `catID` = 219 WHERE `catID` = 159 DELETE FROM `xref` WHERE `catID` = 159 ``` Thanks for the all other answers/comments.
This way temporarily removes your constraints to allow the update and then puts them back at the end. If your database is a production database **TEST ON A COPY!** ``` # set up tables for the purpose of this example CREATE TABLE Item ( ItemId INT, ItemName VARCHAR(255), PRIMARY KEY (ItemId) ); CREATE Ta...
27,011,540
HEy i have problems to set up a list view ... the app has an navigation drawler menu and the first fragment of this menu shoud show a list of my json array... the query work but now : HOW I CAN DISPLAY THE RESULT.... **MyTickets.java** package de.hoell.jobcontrol; ``` /** * Created by Hoell on 16.10.2014. */ imp...
2014/11/19
[ "https://Stackoverflow.com/questions/27011540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4144914/" ]
I'm going to keep it short. You should learn the basics of subnetting by Googling for information, I can suggest Cisco for excellent learning material. Your network, 198.16.0.0 /16, offers you 16 bits to use as subnet/host bits. This entire network offers a bit more than 65.000 hosts. **Step 1** - Sort your subnets, s...
To start with, all the requests are rounded up to a power of two. The starting address, ending address, and mask are as follows [1](https://academic.csuohio.edu/zhao_w/teaching/Old/EEC682-S05/lecture18.pdf): A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20 B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/2...
27,011,540
HEy i have problems to set up a list view ... the app has an navigation drawler menu and the first fragment of this menu shoud show a list of my json array... the query work but now : HOW I CAN DISPLAY THE RESULT.... **MyTickets.java** package de.hoell.jobcontrol; ``` /** * Created by Hoell on 16.10.2014. */ imp...
2014/11/19
[ "https://Stackoverflow.com/questions/27011540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4144914/" ]
Now, a few years after this question was asked I was struggling with the same task. Actually it is a problem from Andrew Tanenbaums Computer Networks Book and you are not allowed to sort stuff :) To solve this one you need to do as follows: You are starting with 198.16.0.0 Now company A requests 4000 IPs. You have to...
To start with, all the requests are rounded up to a power of two. The starting address, ending address, and mask are as follows [1](https://academic.csuohio.edu/zhao_w/teaching/Old/EEC682-S05/lecture18.pdf): A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20 B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/2...
38,035,679
I am working on a jQuery function that scrolls to the div on click. Right now it will scroll to the top, I was wondering if their was a way to make it scroll to the center of `$('.scrollit')` instead of top, or possibly a way to offset it by some pixel amount? ``` $(".playbox").on('click', function () { $('.scroll...
2016/06/26
[ "https://Stackoverflow.com/questions/38035679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4682815/" ]
You can use the height of the element. ``` scrollTop: $(this).offset().top + $(this).height() / 2; ``` Add the half of the height of the element to the scrollTop to scroll to the center of the element.
There are two major difference to the other answer. Its relevant if you add or remove offset, so I exchange the plus with a **minus**. And I use the **screen size** as reference and not the element. To animate the scrolling and wrap in a function is optional. ``` function scrollTo (id) { $('html,body').animate({ ...
55,212,737
I want to scrape the data of websitses using Beautiful Soup and requests, and I've come so far that I've got the data I want but now I want to filter it: ``` from bs4 import BeautifulSoup import requests url = "website.com" keyword = "22222" r = requests.get(url) data = r.text soup = BeautifulSoup(data, 'lxml') for a...
2019/03/17
[ "https://Stackoverflow.com/questions/55212737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11217937/" ]
Using `list` comprehensions this can be done quite simply ``` In [106]: img_ids = [{d['id']: d['image_uris']['large']} for d in prod_dict] In [107]: img_ids Out[107]: [{'1744556-ghh56h-4633': 'https://bobswidgets.com/large/best_widget_lg.jpg'}, {'0956786-dje596-3904': 'https://bobswidgets.com/large/best_widget2_lg.j...
Your edits to the `product.json` file still don't make it valid JSON, so I used the following instead, which is: ```json [ { "product_type": "widget", "id": "1744556-ghh56h-4633", "manufacture_id": "AAB4567", "store_ids": [ 416835, 456145 ], "name": "Best Widget", "origin": "U...
31,985,977
I want to pass data from my Controller to a JavaScript that handles a Google Bar Chart. composer ======== ``` $tmp = 6; return view('pages.template', ['tmp' => $tmp]); ``` from my `template.blade.php` I call the Google Chart ``` <div id="chart_div"></div> ``` .js file: ``` var tmp = 6; var tmp2 = parseInt('{!! ...
2015/08/13
[ "https://Stackoverflow.com/questions/31985977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4733079/" ]
You are trying to use **Blade** syntax in your **JS** file. In order for that to work, this file would need to be processed by Blade compiler. It means that instead of including JS file in your website directly, you need to include a URL that will be processed by Laravel and output Javascript code. It is possible, but ...
The variable `$tmp` seems not be parsed successfully in `.js` file. why not you put the code in `.js` file into `template.blade.php`?
31,985,977
I want to pass data from my Controller to a JavaScript that handles a Google Bar Chart. composer ======== ``` $tmp = 6; return view('pages.template', ['tmp' => $tmp]); ``` from my `template.blade.php` I call the Google Chart ``` <div id="chart_div"></div> ``` .js file: ``` var tmp = 6; var tmp2 = parseInt('{!! ...
2015/08/13
[ "https://Stackoverflow.com/questions/31985977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4733079/" ]
Just replace : ``` var tmp2 = parseInt('{!! $tmp !!}'); ``` By : ``` var tmp2 = parseInt(<?php echo $tmp; ?>); ``` And it should work.
You are trying to use **Blade** syntax in your **JS** file. In order for that to work, this file would need to be processed by Blade compiler. It means that instead of including JS file in your website directly, you need to include a URL that will be processed by Laravel and output Javascript code. It is possible, but ...
31,985,977
I want to pass data from my Controller to a JavaScript that handles a Google Bar Chart. composer ======== ``` $tmp = 6; return view('pages.template', ['tmp' => $tmp]); ``` from my `template.blade.php` I call the Google Chart ``` <div id="chart_div"></div> ``` .js file: ``` var tmp = 6; var tmp2 = parseInt('{!! ...
2015/08/13
[ "https://Stackoverflow.com/questions/31985977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4733079/" ]
Just replace : ``` var tmp2 = parseInt('{!! $tmp !!}'); ``` By : ``` var tmp2 = parseInt(<?php echo $tmp; ?>); ``` And it should work.
The variable `$tmp` seems not be parsed successfully in `.js` file. why not you put the code in `.js` file into `template.blade.php`?
31,985,977
I want to pass data from my Controller to a JavaScript that handles a Google Bar Chart. composer ======== ``` $tmp = 6; return view('pages.template', ['tmp' => $tmp]); ``` from my `template.blade.php` I call the Google Chart ``` <div id="chart_div"></div> ``` .js file: ``` var tmp = 6; var tmp2 = parseInt('{!! ...
2015/08/13
[ "https://Stackoverflow.com/questions/31985977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4733079/" ]
This worked for me ``` <script type="text/javascript"> var tmp = {!! json_encode($tmp->toArray()) !!}; console.log(tmp); </script> ``` In Your controller, you could do the following ``` public function index() { $tmp = Tmp::get(); return view('tmp.index', compact('tmp')); } ```
The variable `$tmp` seems not be parsed successfully in `.js` file. why not you put the code in `.js` file into `template.blade.php`?
31,985,977
I want to pass data from my Controller to a JavaScript that handles a Google Bar Chart. composer ======== ``` $tmp = 6; return view('pages.template', ['tmp' => $tmp]); ``` from my `template.blade.php` I call the Google Chart ``` <div id="chart_div"></div> ``` .js file: ``` var tmp = 6; var tmp2 = parseInt('{!! ...
2015/08/13
[ "https://Stackoverflow.com/questions/31985977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4733079/" ]
Just replace : ``` var tmp2 = parseInt('{!! $tmp !!}'); ``` By : ``` var tmp2 = parseInt(<?php echo $tmp; ?>); ``` And it should work.
This worked for me ``` <script type="text/javascript"> var tmp = {!! json_encode($tmp->toArray()) !!}; console.log(tmp); </script> ``` In Your controller, you could do the following ``` public function index() { $tmp = Tmp::get(); return view('tmp.index', compact('tmp')); } ```