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 |
|---|---|---|---|---|---|
18,719 | I'm looking to use the D1N914 diode in a netlist for use with ngspice. Thankfully I've found the model for free here: <http://ppd.fnal.gov/experiments/cdms/old_files/electronics/FLIP/3U/QampDiscrete/proto/schematics_layouts/DIODE.LIB>
Problem is, I don't know how I can add such a model to work with gschem or even ngsp... | 2011/08/29 | [
"https://electronics.stackexchange.com/questions/18719",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/4191/"
] | On the ngspice side of things, you need to include the model in your circuit, using one of various commands.
The simplest is to put the .model into your netlist, and use the name to refer to it, e.g. your model looks like this:
.model D1N914 D(Is=168.1E-21 N=1 Rs=.1 Ikf=0 Xti=3 Eg=1.11 Cjo=4p M=.3333
+ Vj=.75 Fc=.5... | I can't help with the ngspice side of things, unfortunately, but adding a new symbol to gEDA gschem is a doddle.
A .sym file will have to be created for your specific component. This is no different to a schematic file, just named "component.sym" instead of .sch.
Just draw the component using the lines, boxes and arc... |
5,840,875 | I have declared the launch mode of my activity to be singleTask. If I
launch my application, press the home button, go to an email client
(gmail in this case) & preview an attachment using my application, I
am experiencing a security exception on Android versions 2.3 & later,
which says that I do not have the permissio... | 2011/04/30 | [
"https://Stackoverflow.com/questions/5840875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/705627/"
] | I had posted this on Android-developers and got this response from Dianne Hackborn-
"Sorry, this is probably a bug in 2.3 with trying to grant a URI permission to an activity instance that is already running. I'll look in to this. In the mean-time, the only solution may be to not use singleTask for the activity being... | The problem might happen because the called intent's activity in the 2.3 implementation does not fit the `launchMode:"standard"` or `launchMode:"singleTop"` requirement stated in the [android:launchMode description](http://developer.android.com/guide/topics/manifest/activity-element.html#lmode).
But it would be also ... |
17,069,484 | ```
scala> val a = List(1,2)
a: List[Int] = List(1, 2)
scala> val b = List(3,4)
b: List[Int] = List(3, 4)
scala> val c = List(5,6)
c: List[Int] = List(5, 6)
scala> val d = List(7,8)
d: List[Int] = List(7, 8)
scala> (a,b,c).zipped.toList
res6: List[(Int, Int, Int)] = List((1,3,5), (2,4,6))
```
Now:
```
scala> (a... | 2013/06/12 | [
"https://Stackoverflow.com/questions/17069484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/283998/"
] | Short answer:
```
for (List(w,x,y,z) <- List(a,b,c,d).transpose) yield (w,x,y,z)
// List[(Int, Int, Int, Int)] = List((1,3,5,7), (2,4,6,8))
```
Why you want them as tuples, I'm not sure, but a slightly more interesting case would be when your lists are of different types, and for example, you want to combine them ... | found a possible solution, although it's very imperative to my taste:
```
val a = List(1,2)
val b = List(3,4)
val c = List(5,6)
val d = List(7,8)
val g : List[Tuple4[Int,Int,Int,Int]] = {
a.zipWithIndex.map { case (value,index) => (value, b(index), c(index), d(index))}
}
```
zipWithIndex would all... |
17,069,484 | ```
scala> val a = List(1,2)
a: List[Int] = List(1, 2)
scala> val b = List(3,4)
b: List[Int] = List(3, 4)
scala> val c = List(5,6)
c: List[Int] = List(5, 6)
scala> val d = List(7,8)
d: List[Int] = List(7, 8)
scala> (a,b,c).zipped.toList
res6: List[(Int, Int, Int)] = List((1,3,5), (2,4,6))
```
Now:
```
scala> (a... | 2013/06/12 | [
"https://Stackoverflow.com/questions/17069484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/283998/"
] | Shameless plug-- [product-collections](https://github.com/marklister/product-collections) does something similar:
```
a flatZip b flatZip c flatZip d
res0: org.catch22.collections.immutable.CollSeq4[Int,Int,Int,Int] =
CollSeq((1,3,5,7),
(2,4,6,8))
scala> res0(0) //first row
res1: Product4[Int,Int,Int,I... | found a possible solution, although it's very imperative to my taste:
```
val a = List(1,2)
val b = List(3,4)
val c = List(5,6)
val d = List(7,8)
val g : List[Tuple4[Int,Int,Int,Int]] = {
a.zipWithIndex.map { case (value,index) => (value, b(index), c(index), d(index))}
}
```
zipWithIndex would all... |
17,069,484 | ```
scala> val a = List(1,2)
a: List[Int] = List(1, 2)
scala> val b = List(3,4)
b: List[Int] = List(3, 4)
scala> val c = List(5,6)
c: List[Int] = List(5, 6)
scala> val d = List(7,8)
d: List[Int] = List(7, 8)
scala> (a,b,c).zipped.toList
res6: List[(Int, Int, Int)] = List((1,3,5), (2,4,6))
```
Now:
```
scala> (a... | 2013/06/12 | [
"https://Stackoverflow.com/questions/17069484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/283998/"
] | Short answer:
```
for (List(w,x,y,z) <- List(a,b,c,d).transpose) yield (w,x,y,z)
// List[(Int, Int, Int, Int)] = List((1,3,5,7), (2,4,6,8))
```
Why you want them as tuples, I'm not sure, but a slightly more interesting case would be when your lists are of different types, and for example, you want to combine them ... | ```
val g = List(a,b,c,d)
val result = ( g.map(x=>x(0)), g.map(x=>x(1) ) )
```
result : (List(1, 3, 5, 7),List(2, 4, 6, 8))
basic, zipped assit tuple2 , tuple3
<http://www.scala-lang.org/api/current/index.html#scala.runtime.Tuple3Zipped>
so, You want 'tuple4zippped' you make it
gool luck |
17,069,484 | ```
scala> val a = List(1,2)
a: List[Int] = List(1, 2)
scala> val b = List(3,4)
b: List[Int] = List(3, 4)
scala> val c = List(5,6)
c: List[Int] = List(5, 6)
scala> val d = List(7,8)
d: List[Int] = List(7, 8)
scala> (a,b,c).zipped.toList
res6: List[(Int, Int, Int)] = List((1,3,5), (2,4,6))
```
Now:
```
scala> (a... | 2013/06/12 | [
"https://Stackoverflow.com/questions/17069484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/283998/"
] | Shameless plug-- [product-collections](https://github.com/marklister/product-collections) does something similar:
```
a flatZip b flatZip c flatZip d
res0: org.catch22.collections.immutable.CollSeq4[Int,Int,Int,Int] =
CollSeq((1,3,5,7),
(2,4,6,8))
scala> res0(0) //first row
res1: Product4[Int,Int,Int,I... | ```
val g = List(a,b,c,d)
val result = ( g.map(x=>x(0)), g.map(x=>x(1) ) )
```
result : (List(1, 3, 5, 7),List(2, 4, 6, 8))
basic, zipped assit tuple2 , tuple3
<http://www.scala-lang.org/api/current/index.html#scala.runtime.Tuple3Zipped>
so, You want 'tuple4zippped' you make it
gool luck |
17,069,484 | ```
scala> val a = List(1,2)
a: List[Int] = List(1, 2)
scala> val b = List(3,4)
b: List[Int] = List(3, 4)
scala> val c = List(5,6)
c: List[Int] = List(5, 6)
scala> val d = List(7,8)
d: List[Int] = List(7, 8)
scala> (a,b,c).zipped.toList
res6: List[(Int, Int, Int)] = List((1,3,5), (2,4,6))
```
Now:
```
scala> (a... | 2013/06/12 | [
"https://Stackoverflow.com/questions/17069484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/283998/"
] | Short answer:
```
for (List(w,x,y,z) <- List(a,b,c,d).transpose) yield (w,x,y,z)
// List[(Int, Int, Int, Int)] = List((1,3,5,7), (2,4,6,8))
```
Why you want them as tuples, I'm not sure, but a slightly more interesting case would be when your lists are of different types, and for example, you want to combine them ... | Shameless plug-- [product-collections](https://github.com/marklister/product-collections) does something similar:
```
a flatZip b flatZip c flatZip d
res0: org.catch22.collections.immutable.CollSeq4[Int,Int,Int,Int] =
CollSeq((1,3,5,7),
(2,4,6,8))
scala> res0(0) //first row
res1: Product4[Int,Int,Int,I... |
37,589,694 | I have my Json string as
```
string myjson = "[
{
"col1": "1",
"col2": "2",
"col3": "3"
},
{
"col1": "4",
"col2": "5",
"col3": "6"
},
{
"col1": "7",
"col2": "8",
"col3": "9"
}]";
```
Problem is : When i am creating bson document it is showing
>
> Cannot convert BsonArray to Bs... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37589694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5412684/"
] | ```
BsonDocument doc = new BsonDocument();
BsonArray array = BsonSerializer.Deserialize<BsonArray>(myjson);
doc.Add(array);
```
I didn't try it but it should work.
**Edit:**
```
string myjson1 = "{ 'col1': '1', 'col2': '2', 'col3': '3'}";
string myjson2 = "{ 'col1': '4', 'col2': '5', 'col3': '6'}";... | You can try convert BsonArray to array of BsonValue, then iterate through that array:
```
var a = BsonSerializer.Deserialize<BsonArray>(yourjsontext).ToArray();
for (int i = 0; i < a.Length; i++) {
var document = a[i].ToBsonDocument();
// Do whatever necessary
}
``` |
37,589,694 | I have my Json string as
```
string myjson = "[
{
"col1": "1",
"col2": "2",
"col3": "3"
},
{
"col1": "4",
"col2": "5",
"col3": "6"
},
{
"col1": "7",
"col2": "8",
"col3": "9"
}]";
```
Problem is : When i am creating bson document it is showing
>
> Cannot convert BsonArray to Bs... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37589694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5412684/"
] | ```
BsonDocument doc = new BsonDocument();
BsonArray array = BsonSerializer.Deserialize<BsonArray>(myjson);
doc.Add(array);
```
I didn't try it but it should work.
**Edit:**
```
string myjson1 = "{ 'col1': '1', 'col2': '2', 'col3': '3'}";
string myjson2 = "{ 'col1': '4', 'col2': '5', 'col3': '6'}";... | Or a cleaner way :
```
var arrayDocs = BsonSerializer.Deserialize<BsonArray>(myJsonArrayString);
var documents = arrayDocs.Select(val => val.AsBsonDocument);
```
which will give you an `IEnumerable<BsonDocument>` |
37,589,694 | I have my Json string as
```
string myjson = "[
{
"col1": "1",
"col2": "2",
"col3": "3"
},
{
"col1": "4",
"col2": "5",
"col3": "6"
},
{
"col1": "7",
"col2": "8",
"col3": "9"
}]";
```
Problem is : When i am creating bson document it is showing
>
> Cannot convert BsonArray to Bs... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37589694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5412684/"
] | Or a cleaner way :
```
var arrayDocs = BsonSerializer.Deserialize<BsonArray>(myJsonArrayString);
var documents = arrayDocs.Select(val => val.AsBsonDocument);
```
which will give you an `IEnumerable<BsonDocument>` | You can try convert BsonArray to array of BsonValue, then iterate through that array:
```
var a = BsonSerializer.Deserialize<BsonArray>(yourjsontext).ToArray();
for (int i = 0; i < a.Length; i++) {
var document = a[i].ToBsonDocument();
// Do whatever necessary
}
``` |
27,919,075 | I would like to append style to html head with jquery:
```
<script type="text/javascript">
var appendStyle = jQuery('<style type="text/css">body {margin: 0;}</style>');
jQuery('html > head').append(appendStyle);
</script>
```
The problem is that is missing in html. Html source (ctrl + u) will show this:
```
<scri... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27919075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1207443/"
] | ### Appending Entire Stylesheets
If you want to append an entire style sheet use: (Make sure you have your styles in `style.css` already).
```
$('head').append('<link rel="stylesheet" href="style.css" type="text/css"/>');
```
---
### Update single element style
If you only want to update the style for 1 element (... | Load jQuery once the page Document Object Model (DOM) is ready for JavaScript code to execute.
```
$( document ).ready(function() {
var appendStyle = '<style type="text/css">body {margin: 0;}';
$('html > head').append(appendStyle);
});
```
Shorthand:
```
$(function() {
var appendStyle = '<style type="te... |
27,919,075 | I would like to append style to html head with jquery:
```
<script type="text/javascript">
var appendStyle = jQuery('<style type="text/css">body {margin: 0;}</style>');
jQuery('html > head').append(appendStyle);
</script>
```
The problem is that is missing in html. Html source (ctrl + u) will show this:
```
<scri... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27919075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1207443/"
] | ### Appending Entire Stylesheets
If you want to append an entire style sheet use: (Make sure you have your styles in `style.css` already).
```
$('head').append('<link rel="stylesheet" href="style.css" type="text/css"/>');
```
---
### Update single element style
If you only want to update the style for 1 element (... | I just solved the problem. It seems there is some javascript code which cut off any ending tag. Even if I put
```
var example = '</example>'
```
it will cut if off. So what I did is that:
```
<script type="text/javascript">
var appendStyle = jQuery('<style type="text/css">body {margin: 0;}</'+'style>');
jQuer... |
27,919,075 | I would like to append style to html head with jquery:
```
<script type="text/javascript">
var appendStyle = jQuery('<style type="text/css">body {margin: 0;}</style>');
jQuery('html > head').append(appendStyle);
</script>
```
The problem is that is missing in html. Html source (ctrl + u) will show this:
```
<scri... | 2015/01/13 | [
"https://Stackoverflow.com/questions/27919075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1207443/"
] | ### Appending Entire Stylesheets
If you want to append an entire style sheet use: (Make sure you have your styles in `style.css` already).
```
$('head').append('<link rel="stylesheet" href="style.css" type="text/css"/>');
```
---
### Update single element style
If you only want to update the style for 1 element (... | You can simply create a class
```
.body {
margin: 0;
}
```
and include jquery
```
$('body').addClass('body');
``` |
612,145 | The centre of mass of a body can be found using the general formula:
$$
\bar{\boldsymbol{r}} = \frac{1}{M} \int \boldsymbol{r} \ \mathrm{d}M
$$
(RHB, p. 195)\*. When I try to use this method with polar coordinates however, it fails.
Consider a circular disc with radius $a$ and uniform mass per unit area, $\mu$. We k... | 2021/02/03 | [
"https://physics.stackexchange.com/questions/612145",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/226406/"
] | The integral you worte down is wrong. The right one would be
$$
\vec r \_{CM} = \frac \mu M\int\_0^{2\pi}\int\_0^a\begin{pmatrix} r\cos(\phi)\\r\sin(\phi) \end{pmatrix} r \text d r \text d \phi = \begin{pmatrix}0\\0\end{pmatrix},
$$
since
$$
\int\_0 ^{2\pi}\sin\phi\,\text d\phi = \int\_0 ^{2\pi}\cos\phi\,\text d\phi = ... | The 2-d vector $\vec{r}$
$$
\vec{r} = \hat{x} x + \hat{y} y \ne \hat{r} r + \hat{\phi} \phi.
$$
Instead, the vector in polar coordinate:
$$
\vec{r} = \hat{r} r.
$$
Therefore, the center of mass $\vec{r}\_c$:
$$
\vec{r}\_c = \frac{1}{M} \int \vec{r} dM = \frac{\mu}{M} \int\_0^R r dr \int\_0^{2\pi}d\phi \hat{r}.
$... |
44,432,304 | I have a `WooCommerce` webshop, where T-Shirts are being sold. When a person looks at the cart, I'd like to give them the option to change sized on a T-Shirt. Currently, the dropdown menu i made looks like this:
```
<?php
if ( $item->is_type( 'variation' ) ){
?>
<select name="" class="product-size">
<?php
fore... | 2017/06/08 | [
"https://Stackoverflow.com/questions/44432304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7918109/"
] | If you check type of your object, it is of class WC\_Order\_Item\_Product. You can use this
```
$variationId = $item->get_variation_id();
$variableProduct = new WC_Product_Variable($variationId)
$allVariations = $variableProduct->get_available_variations();
```
====================================
Oh I see. You c... | The type name you should be checking for is 'variable', not 'variation':
```
if ($product->is_type( 'variable' ) {
// do code
}
```
[Here's the source code](https://woocommerce.github.io/code-reference/classes/Automattic-WooCommerce-Admin-API-OnboardingProductTypes.html#method_get_product_types) from WooCommerc... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | In my opinion you somehow mixed the index of the counter (values in `A`) and the value of the counter (values in `counter`). So there is no magic in using `A[i]-1` - it is the value `X` from the problem description (adjusted to 0-based index).
My naive approach would be, the way I understood the problem (I hope it mak... | Here's a C# solution that gave me 100% score.
The idea is to simply not update the max counters on the spot but rather do it when you actually get to that counter, and then even out any counters that were not set to the max in another loop.
```
class Solution
{
public int[] solution(int N, int[] A)
{
... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | In my opinion you somehow mixed the index of the counter (values in `A`) and the value of the counter (values in `counter`). So there is no magic in using `A[i]-1` - it is the value `X` from the problem description (adjusted to 0-based index).
My naive approach would be, the way I understood the problem (I hope it mak... | Inspired by Andy's solution, here is a solution in Python that is O(N + M) and gets a score of 100. The key is to avoid the temptation of updating all the counters every time A[K] > 5. Instead you keep track of a global max and reset an individual counter to global max just before you have to increment it. At the end, ... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | Here is my solution in JavaScript.
```
const maxCounters = (N, A) => {
for (let t = 0; t < A.length; t++) {
if (A[t] < 1 || A[t] > N + 1) {
throw new Error('Invalid input array A');
}
}
let lastMaxCounter = 0; // save the last max counter is applied to all counters
let counters = []; // counters ... | Here's a C# solution that gave me 100% score.
The idea is to simply not update the max counters on the spot but rather do it when you actually get to that counter, and then even out any counters that were not set to the max in another loop.
```
class Solution
{
public int[] solution(int N, int[] A)
{
... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | Here is my solution in JavaScript.
```
const maxCounters = (N, A) => {
for (let t = 0; t < A.length; t++) {
if (A[t] < 1 || A[t] > N + 1) {
throw new Error('Invalid input array A');
}
}
let lastMaxCounter = 0; // save the last max counter is applied to all counters
let counters = []; // counters ... | Inspired by Andy's solution, here is a solution in Python that is O(N + M) and gets a score of 100. The key is to avoid the temptation of updating all the counters every time A[K] > 5. Instead you keep track of a global max and reset an individual counter to global max just before you have to increment it. At the end, ... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | In my opinion you somehow mixed the index of the counter (values in `A`) and the value of the counter (values in `counter`). So there is no magic in using `A[i]-1` - it is the value `X` from the problem description (adjusted to 0-based index).
My naive approach would be, the way I understood the problem (I hope it mak... | Here is C# solution give me 100% score
```
public int[] solution(int N, int[] A) {
int[] operation = new int[N];
int max = 0, globalMax = 0;
foreach (var item in A)
{
if (item > N)
{
globalMax = max;
}
... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | Here is C# solution give me 100% score
```
public int[] solution(int N, int[] A) {
int[] operation = new int[N];
int max = 0, globalMax = 0;
foreach (var item in A)
{
if (item > N)
{
globalMax = max;
}
... | Here's a C# solution that gave me 100% score.
The idea is to simply not update the max counters on the spot but rather do it when you actually get to that counter, and then even out any counters that were not set to the max in another loop.
```
class Solution
{
public int[] solution(int N, int[] A)
{
... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | In my opinion you somehow mixed the index of the counter (values in `A`) and the value of the counter (values in `counter`). So there is no magic in using `A[i]-1` - it is the value `X` from the problem description (adjusted to 0-based index).
My naive approach would be, the way I understood the problem (I hope it mak... | Try this Java snippet. Its more readable and neater, you don't need to worry about bounds check and might evacuate your first findings related to the more efficient approach you have found, btw the max is on the main forloop not causing any overhead.
```js
public final int[] solution(int N, int[] A)
{
int conditi... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | In my opinion you somehow mixed the index of the counter (values in `A`) and the value of the counter (values in `counter`). So there is no magic in using `A[i]-1` - it is the value `X` from the problem description (adjusted to 0-based index).
My naive approach would be, the way I understood the problem (I hope it mak... | Here is my solution in JavaScript.
```
const maxCounters = (N, A) => {
for (let t = 0; t < A.length; t++) {
if (A[t] < 1 || A[t] > N + 1) {
throw new Error('Invalid input array A');
}
}
let lastMaxCounter = 0; // save the last max counter is applied to all counters
let counters = []; // counters ... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | In my opinion you somehow mixed the index of the counter (values in `A`) and the value of the counter (values in `counter`). So there is no magic in using `A[i]-1` - it is the value `X` from the problem description (adjusted to 0-based index).
My naive approach would be, the way I understood the problem (I hope it mak... | Here is a pretty elegant soulution in Swift:
```
public func solution(_ N : Int, _ A : inout [Int]) -> [Int] {
var globalMax = 0
var currentMax = 0
var maximums: [Int: Int] = [:]
for x in A {
if x > N {
globalMax = currentMax
continue
}
let newValue = ma... |
38,403,344 | I have wanted to try some challenges on Codility and started from beginning. All assignments were relatively easy up to the one called MaxCounters. I do not believe that this one is especially hard although it is the first one marked as not painless.
I have read the [task](https://codility.com/programmers/task/max_co... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38403344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | Here is C# solution give me 100% score
```
public int[] solution(int N, int[] A) {
int[] operation = new int[N];
int max = 0, globalMax = 0;
foreach (var item in A)
{
if (item > N)
{
globalMax = max;
}
... | Here is a pretty elegant soulution in Swift:
```
public func solution(_ N : Int, _ A : inout [Int]) -> [Int] {
var globalMax = 0
var currentMax = 0
var maximums: [Int: Int] = [:]
for x in A {
if x > N {
globalMax = currentMax
continue
}
let newValue = ma... |
45,152,877 | I want to inject two actors into a Play controller via DI. Injecting one actors works absolutely fine and I can send message to this actor without any problems. However, when injecting a second actor and sending a message, I get the following compilation error:
```
play.sbt.PlayExceptions$CompilationException: Compila... | 2017/07/17 | [
"https://Stackoverflow.com/questions/45152877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7518347/"
] | You define the two actors as implicit parameters. Change the signature like so:
```
class MyController @Inject()(
@Named("FooSupervisor") fooSupervisor: ActorRef,
@Named("BarSupervisor") barSupervisor: ActorRef
)(implicit system: ActorSystem, materializer: Materializer
) extends Controller {
``` | I tried injecting the actorRef into the controller from a provider.
```
import javax.inject._
import akka.actor.ActorRef
import play.api.mvc._
@Singleton
class HomeController @Inject()(@Named("actor1") val actor1: ActorRef, @Named("actor2") val actor2: ActorRef) extends Controller {
def index = Action {
actor1 ... |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | Agree with discoverability issues. Illustrator application for example uses and "Alt" key to reverse the action (e.g. shape builder > click adds shape and alt+click removes shape). So, perhaps, you can consider a modifier key. Although, if your app is not something that your users use frequently and for long periods of... | I can't imagine that ever being a good idea. Assigning inverse actions to the same button can only lead to confusion an mistakes. |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | There are two problems with this:
1. It is not compatible with touch devices.
You may be developing for desktop eviroments, but that doesn't mean that the user doesn't use touch to interact with your application.
2. It is hard to discover.
When you see a button you know you can click it, because it visually tells yo... | Related to the discoverability issue - users don't usually expect right click to do anything but open a contextual menu.
Case in point: recently I did a usability study of Windows 8 and IE 10. In IE10, you have to right click to show the url bar. Very few users (probably 1 in 20) right clicked, and if they did right c... |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | Agree with discoverability issues. Illustrator application for example uses and "Alt" key to reverse the action (e.g. shape builder > click adds shape and alt+click removes shape). So, perhaps, you can consider a modifier key. Although, if your app is not something that your users use frequently and for long periods of... | I have not seen it, and I don't think it aligns to the conventional 'meaning' of right-click.
Normally, the left-click performs a primary action and the right-click opens a dialog offering multiple actions - including the primary one. So, when a user right-clicks on a link in a browser, they have the option to not jus... |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | I have not seen it, and I don't think it aligns to the conventional 'meaning' of right-click.
Normally, the left-click performs a primary action and the right-click opens a dialog offering multiple actions - including the primary one. So, when a user right-clicks on a link in a browser, they have the option to not jus... | Paint.net has a similar design pattern. Not with buttons but with the selected tools. For instance, if you select the Zoom tool, left-clicking somewhere on the canvas will zoom in, while right-clicking will zoom out. Similar to what Photoshop does with Alt+click, as mentioned above.
(And it works great :) ) |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | Related to the discoverability issue - users don't usually expect right click to do anything but open a contextual menu.
Case in point: recently I did a usability study of Windows 8 and IE 10. In IE10, you have to right click to show the url bar. Very few users (probably 1 in 20) right clicked, and if they did right c... | Paint.net has a similar design pattern. Not with buttons but with the selected tools. For instance, if you select the Zoom tool, left-clicking somewhere on the canvas will zoom in, while right-clicking will zoom out. Similar to what Photoshop does with Alt+click, as mentioned above.
(And it works great :) ) |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | Agree with discoverability issues. Illustrator application for example uses and "Alt" key to reverse the action (e.g. shape builder > click adds shape and alt+click removes shape). So, perhaps, you can consider a modifier key. Although, if your app is not something that your users use frequently and for long periods of... | Related to the discoverability issue - users don't usually expect right click to do anything but open a contextual menu.
Case in point: recently I did a usability study of Windows 8 and IE 10. In IE10, you have to right click to show the url bar. Very few users (probably 1 in 20) right clicked, and if they did right c... |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | There are two problems with this:
1. It is not compatible with touch devices.
You may be developing for desktop eviroments, but that doesn't mean that the user doesn't use touch to interact with your application.
2. It is hard to discover.
When you see a button you know you can click it, because it visually tells yo... | Paint.net has a similar design pattern. Not with buttons but with the selected tools. For instance, if you select the Zoom tool, left-clicking somewhere on the canvas will zoom in, while right-clicking will zoom out. Similar to what Photoshop does with Alt+click, as mentioned above.
(And it works great :) ) |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | Agree with discoverability issues. Illustrator application for example uses and "Alt" key to reverse the action (e.g. shape builder > click adds shape and alt+click removes shape). So, perhaps, you can consider a modifier key. Although, if your app is not something that your users use frequently and for long periods of... | Paint.net has a similar design pattern. Not with buttons but with the selected tools. For instance, if you select the Zoom tool, left-clicking somewhere on the canvas will zoom in, while right-clicking will zoom out. Similar to what Photoshop does with Alt+click, as mentioned above.
(And it works great :) ) |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | There are two problems with this:
1. It is not compatible with touch devices.
You may be developing for desktop eviroments, but that doesn't mean that the user doesn't use touch to interact with your application.
2. It is hard to discover.
When you see a button you know you can click it, because it visually tells yo... | Agree with discoverability issues. Illustrator application for example uses and "Alt" key to reverse the action (e.g. shape builder > click adds shape and alt+click removes shape). So, perhaps, you can consider a modifier key. Although, if your app is not something that your users use frequently and for long periods of... |
26,607 | Has anyone ever seen the following design pattern in use, and if so, is there ever a good time to use it?
```
(Button) labeled "Do Something"
[User] left-clicks on (Button)
[System] action A (Add) is performed
[User] right-clicks on (Button)
[System] action B (Subtract; inverse of A) is performed
``` | 2012/10/09 | [
"https://ux.stackexchange.com/questions/26607",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/19536/"
] | I have not seen it, and I don't think it aligns to the conventional 'meaning' of right-click.
Normally, the left-click performs a primary action and the right-click opens a dialog offering multiple actions - including the primary one. So, when a user right-clicks on a link in a browser, they have the option to not jus... | I can't imagine that ever being a good idea. Assigning inverse actions to the same button can only lead to confusion an mistakes. |
46,671,424 | I'm have trouble with lists and dictionaries. I have a list of dictionaries of skiers. Similar to below:
```
skier_1 = {'id': 123,
'first_name': 'John',
'last_name': 'Smith',
'times': [('race_1', 32.25), ('race_2', 33.5), ('race_3', 44)]}
skier_2 = {'id': 234,
'first_name':... | 2017/10/10 | [
"https://Stackoverflow.com/questions/46671424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8753430/"
] | You could use the [ternary operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator).
```
string_toggle = (string_toggle === "CAT") ? "ESP" : "CAT";
```
This effectively translates to:
```
if (string_toggle === "CAT") {
string_toggle = "ESP";
} else {
string_tog... | If you are a heavy user,why not to make some class?`overkill`
Here im using [this](http://es6-features.org/#ClassDefinition) javascript syntax.
You should check ECMAScript 6,you will like it!
```js
class ToggleValue {
constructor(value1,value2){
this.values = [value1,value2]
this.pointer = 0
}
... |
169,608 | Specifically with the following sentence, which is more suitable/correct?
>
> You don't count on humans **to not do** things they're used to doing.
>
>
> You don't count on humans **not to do** things they're used to doing.
>
>
> | 2018/06/15 | [
"https://ell.stackexchange.com/questions/169608",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/18916/"
] | Traditional answer
------------------
>
> You don't count on humans **not to do** things they're used to doing.
>
>
>
Modern answer
-------------
Either are okay.
Reason
------
One "textbook" (possibly outdated) rule is never to break up an infinitive (or to never break up an infinitive). However, at least in ... | Nowadays 'to not do' is acceptable in less formal contexts, but 'not to do' is still the first choice in more formal ones.
Google Ngram Viewer shows that, even now, 'not to do' is hundreds of times more common than 'to not do'. The use of 'to not do' is growing, but the use of 'not to do' is growing even faster.
[![n... |
24,641,569 | I have openshift with wordpress cartridge.
I need to edit/write php files, and have done so via Wordpress theme editor page.
( i have confirmed by sftp that it did edit the files)
Also I have also edited php files localy, then uploaded them by sftp.
( I do not use git, because by default it does not include all the re... | 2014/07/08 | [
"https://Stackoverflow.com/questions/24641569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3818103/"
] | Try restarting your app with `rhc app restart -a <yourappname>` | For other people having problems with openshift and editing php files.
It seems all PHP Files are cached/compiled, and even deleting a info.php file, still serves a old output webpage.
recomended solution is: use git so it can restart your webserver ( while also it deletes your wp-content directory ffs)
Actually wor... |
22,362,903 | I am creating my first game (Card Game) with THREE.js for Firefox and Chrome and I am currently stuck with an intermittent error that makes some of my textures invisible.
My object with this post is to understand why this is happening so I can work on a solution. I will be adding my questions at the end of the post.
... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22362903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1988747/"
] | I would try using callbacks with the onLoad event to control the timing and execution of your code. For instance change
```
DBZCCG.Card.backTexture = THREE.ImageUtils.loadTexture(
"images/DBZCCG/back.jpg");
```
to
```
DBZCCG.Card.backTexture = THREE.ImageUtils.loadTexture(
"images/DBZCCG/back.jpg", new T... | I did something that made the error never happen again.
I'm editing my question, since I desire to understand why it happened. |
4,489,942 | I have an encrypted string in visual basic. NET 2008, the functions to encrypt and decrypt are the following:
```
Imports System.Security.Cryptography
Public Shared Function Encriptar(ByVal strValor As String) As String
Dim strEncrKey As String = "key12345"
Dim byKey() As Byte = {}
Dim IV() As Byte = {&... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4489942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518657/"
] | Using Apache Commons Codec for hex and base64 encoding/decoding, you can use the following code:
```
KeySpec ks = new DESKeySpec("key12345".getBytes("UTF-8"));
SecretKey key = SecretKeyFactory.getInstance("DES").generateSecret(ks);
IvParameterSpec iv = new IvParameterSpec(
Hex.decodeHex("1234567890ABCDEF".toC... | You're using DES encryption.
Here is an example on how to [encrypt and decrypt with DES](http://www.exampledepot.com/egs/javax.crypto/desstring.html).
The main point is to create a [SecretKey](http://download.oracle.com/javase/1.4.2/docs/api/javax/crypto/SecretKey.html), a [Cipher](http://download.oracle.com/javase/1... |
4,489,942 | I have an encrypted string in visual basic. NET 2008, the functions to encrypt and decrypt are the following:
```
Imports System.Security.Cryptography
Public Shared Function Encriptar(ByVal strValor As String) As String
Dim strEncrKey As String = "key12345"
Dim byKey() As Byte = {}
Dim IV() As Byte = {&... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4489942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518657/"
] | You're using DES encryption.
Here is an example on how to [encrypt and decrypt with DES](http://www.exampledepot.com/egs/javax.crypto/desstring.html).
The main point is to create a [SecretKey](http://download.oracle.com/javase/1.4.2/docs/api/javax/crypto/SecretKey.html), a [Cipher](http://download.oracle.com/javase/1... | The closest Java classes to .NET's `CryptoStream` class are the [`CipherInputStream`](http://download.oracle.com/javase/6/docs/api/javax/crypto/CipherInputStream.html) and [`CipherOutputStream`](http://download.oracle.com/javase/6/docs/api/javax/crypto/CipherOutputStream.html) classes. |
4,489,942 | I have an encrypted string in visual basic. NET 2008, the functions to encrypt and decrypt are the following:
```
Imports System.Security.Cryptography
Public Shared Function Encriptar(ByVal strValor As String) As String
Dim strEncrKey As String = "key12345"
Dim byKey() As Byte = {}
Dim IV() As Byte = {&... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4489942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518657/"
] | Using Apache Commons Codec for hex and base64 encoding/decoding, you can use the following code:
```
KeySpec ks = new DESKeySpec("key12345".getBytes("UTF-8"));
SecretKey key = SecretKeyFactory.getInstance("DES").generateSecret(ks);
IvParameterSpec iv = new IvParameterSpec(
Hex.decodeHex("1234567890ABCDEF".toC... | The closest Java classes to .NET's `CryptoStream` class are the [`CipherInputStream`](http://download.oracle.com/javase/6/docs/api/javax/crypto/CipherInputStream.html) and [`CipherOutputStream`](http://download.oracle.com/javase/6/docs/api/javax/crypto/CipherOutputStream.html) classes. |
4,489,942 | I have an encrypted string in visual basic. NET 2008, the functions to encrypt and decrypt are the following:
```
Imports System.Security.Cryptography
Public Shared Function Encriptar(ByVal strValor As String) As String
Dim strEncrKey As String = "key12345"
Dim byKey() As Byte = {}
Dim IV() As Byte = {&... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4489942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518657/"
] | Using Apache Commons Codec for hex and base64 encoding/decoding, you can use the following code:
```
KeySpec ks = new DESKeySpec("key12345".getBytes("UTF-8"));
SecretKey key = SecretKeyFactory.getInstance("DES").generateSecret(ks);
IvParameterSpec iv = new IvParameterSpec(
Hex.decodeHex("1234567890ABCDEF".toC... | ```
public String encryptText(String cipherText) throws Exception {
String plainKey = "key12345";
String plainIV = "1234567890ABCDEF";
KeySpec ks = new DESKeySpec(plainKey.getBytes(encodingType));
SecretKey key = SecretKeyFactory.getInstance(keyDes).generateSecret(ks);
IvParameterSpec iv = new I... |
4,489,942 | I have an encrypted string in visual basic. NET 2008, the functions to encrypt and decrypt are the following:
```
Imports System.Security.Cryptography
Public Shared Function Encriptar(ByVal strValor As String) As String
Dim strEncrKey As String = "key12345"
Dim byKey() As Byte = {}
Dim IV() As Byte = {&... | 2010/12/20 | [
"https://Stackoverflow.com/questions/4489942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518657/"
] | ```
public String encryptText(String cipherText) throws Exception {
String plainKey = "key12345";
String plainIV = "1234567890ABCDEF";
KeySpec ks = new DESKeySpec(plainKey.getBytes(encodingType));
SecretKey key = SecretKeyFactory.getInstance(keyDes).generateSecret(ks);
IvParameterSpec iv = new I... | The closest Java classes to .NET's `CryptoStream` class are the [`CipherInputStream`](http://download.oracle.com/javase/6/docs/api/javax/crypto/CipherInputStream.html) and [`CipherOutputStream`](http://download.oracle.com/javase/6/docs/api/javax/crypto/CipherOutputStream.html) classes. |
121,909 | According to Wikipedia, `.book` is an existing top level domain. However, it apparently is not yet available for registration. I've been able to learn that Amazon bought the rights in 2014, but I can find no information on when the landrush will begin.
>
> Is there any way to know when the landrush for `.book` will ... | 2019/03/28 | [
"https://webmasters.stackexchange.com/questions/121909",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/99359/"
] | You need to understand two important concepts for internationalization.
For proper international targeting you need to use both hreflang attribute and google search console international targeting feature.
Using Hreflang attribute you can target people on their language basis.
Using Google search console internatio... | Are you using the `hreflang` attribute on your pages as mentioned here:
<https://support.google.com/webmasters/answer/189077>? |
56,660,850 | So I have a HTML/CSS problem I cannot seem to figure out. I am trying to align 3 images and text, all vertically in the following pattern: image text image text image text. I managed to do it on my own and it displays properly on my 13" MacBook. However, as soon as I shrink the window everything gets messed up. So, I w... | 2019/06/19 | [
"https://Stackoverflow.com/questions/56660850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10724436/"
] | Please check the below:-
1. RegEx to fetch all values
[](https://i.stack.imgur.com/Uwcum.png)
2. JSR223 post processor with below code:-
>
>
> ```
> List<Integer> var_OrderAr = new ArrayList()
>
> for (def i = 1; i <= ${var_Order_matchNr}; i++) {
... | I did it with the below groovy code in JSR223 PostProcessor
```
def str = prev.getResponseDataAsString()
log.info("Previous response is "+str);
def pat = /\/order\/(.*)\"/
def mm = str =~ pat
if (mm){
//log.info("order regex" + mm[0][1]);
def ss = mm.size()
def finList = []
mm.each{
finList.pus... |
56,660,850 | So I have a HTML/CSS problem I cannot seem to figure out. I am trying to align 3 images and text, all vertically in the following pattern: image text image text image text. I managed to do it on my own and it displays properly on my 13" MacBook. However, as soon as I shrink the window everything gets messed up. So, I w... | 2019/06/19 | [
"https://Stackoverflow.com/questions/56660850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10724436/"
] | Please check the below:-
1. RegEx to fetch all values
[](https://i.stack.imgur.com/Uwcum.png)
2. JSR223 post processor with below code:-
>
>
> ```
> List<Integer> var_OrderAr = new ArrayList()
>
> for (def i = 1; i <= ${var_Order_matchNr}; i++) {
... | 1. Use Regex as below describe in below image.
[Regex](https://i.stack.imgur.com/6zDnx.png)
2. Add Debug sampler.
3. Run the script.
4. Open Debug sampler in View result tree
5. you can observe that "order\_1\_g1" contain the 1st order id, "order\_2\_g1" contain the 2nd order id and so on.
6. Now you can use these vari... |
998,707 | W7 64 bit 4 GB Ram, i5 750@2.67 GHz. I watch a lot of movies (bluray) and need a better card. The other specs on these cards are identical except the RAM, Processor 730 MHz, Memory Speed 900 MHz. The price difference is about $15, which is not an issue, but I don't want to spend money on something that won't make any d... | 2015/11/10 | [
"https://superuser.com/questions/998707",
"https://superuser.com",
"https://superuser.com/users/520165/"
] | For watching blu-Ray movies this difference in VRAM will make no difference | You don't need 4GB VRAM to watch blu-ray disks perfectly, 2GB VRAM is perfectly fine. VRAM is used more in games. So the 2GB VRAM is fine, but i don't think you need one since old cards will also be good enough. GPU does affect watching videos since there's video players that use hardware acceleration.
The CPU is als... |
15,628,163 | I have this in my code:
```
int x = 4;
char* array = malloc(x*sizeof(char));
size_t arraysize = sizeof (array);
printf("arraysize: %zu\n", arraysize);
```
This code prints out,
>
> arraysize: 8
>
>
>
Why is it 8 and not 4? (Since 4\*sizeof(char) = 4 \* 1) | 2013/03/26 | [
"https://Stackoverflow.com/questions/15628163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774513/"
] | `array` is a pointer in your code. `sizeof(array)` therefore returns the size of that pointer in C bytes (reminder: C's bytes can have more than 8 bits in them).
So, 8 is your pointer size.
Also, the correct type specifier for `size_t` in printf()'s format strings is `%zu`. | `array` is a pointer, hence it will be size of a pointer(`sizeof(void *)` or `sizeof(char *)`), and not `sizeof(char)` as you might expect. It seems that you are using 64bit computer. |
15,628,163 | I have this in my code:
```
int x = 4;
char* array = malloc(x*sizeof(char));
size_t arraysize = sizeof (array);
printf("arraysize: %zu\n", arraysize);
```
This code prints out,
>
> arraysize: 8
>
>
>
Why is it 8 and not 4? (Since 4\*sizeof(char) = 4 \* 1) | 2013/03/26 | [
"https://Stackoverflow.com/questions/15628163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774513/"
] | `array` is a pointer, hence it will be size of a pointer(`sizeof(void *)` or `sizeof(char *)`), and not `sizeof(char)` as you might expect. It seems that you are using 64bit computer. | You are calculating the size of the full array (4\*sizeof(char))
But you spect to know the number of items on the array (4).
You can do
>
> size\_t arraysize = sizeof (array)/sizeof(char);
>
>
>
It will return 8/2 = 4 |
15,628,163 | I have this in my code:
```
int x = 4;
char* array = malloc(x*sizeof(char));
size_t arraysize = sizeof (array);
printf("arraysize: %zu\n", arraysize);
```
This code prints out,
>
> arraysize: 8
>
>
>
Why is it 8 and not 4? (Since 4\*sizeof(char) = 4 \* 1) | 2013/03/26 | [
"https://Stackoverflow.com/questions/15628163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774513/"
] | `array` is a pointer in your code. `sizeof(array)` therefore returns the size of that pointer in C bytes (reminder: C's bytes can have more than 8 bits in them).
So, 8 is your pointer size.
Also, the correct type specifier for `size_t` in printf()'s format strings is `%zu`. | `sizeof(array)` returns the size of a pointer. |
15,628,163 | I have this in my code:
```
int x = 4;
char* array = malloc(x*sizeof(char));
size_t arraysize = sizeof (array);
printf("arraysize: %zu\n", arraysize);
```
This code prints out,
>
> arraysize: 8
>
>
>
Why is it 8 and not 4? (Since 4\*sizeof(char) = 4 \* 1) | 2013/03/26 | [
"https://Stackoverflow.com/questions/15628163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774513/"
] | `sizeof(array)` returns the size of a pointer. | You are calculating the size of the full array (4\*sizeof(char))
But you spect to know the number of items on the array (4).
You can do
>
> size\_t arraysize = sizeof (array)/sizeof(char);
>
>
>
It will return 8/2 = 4 |
15,628,163 | I have this in my code:
```
int x = 4;
char* array = malloc(x*sizeof(char));
size_t arraysize = sizeof (array);
printf("arraysize: %zu\n", arraysize);
```
This code prints out,
>
> arraysize: 8
>
>
>
Why is it 8 and not 4? (Since 4\*sizeof(char) = 4 \* 1) | 2013/03/26 | [
"https://Stackoverflow.com/questions/15628163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774513/"
] | `array` is a pointer in your code. `sizeof(array)` therefore returns the size of that pointer in C bytes (reminder: C's bytes can have more than 8 bits in them).
So, 8 is your pointer size.
Also, the correct type specifier for `size_t` in printf()'s format strings is `%zu`. | You are calculating the size of the full array (4\*sizeof(char))
But you spect to know the number of items on the array (4).
You can do
>
> size\_t arraysize = sizeof (array)/sizeof(char);
>
>
>
It will return 8/2 = 4 |
15,628,163 | I have this in my code:
```
int x = 4;
char* array = malloc(x*sizeof(char));
size_t arraysize = sizeof (array);
printf("arraysize: %zu\n", arraysize);
```
This code prints out,
>
> arraysize: 8
>
>
>
Why is it 8 and not 4? (Since 4\*sizeof(char) = 4 \* 1) | 2013/03/26 | [
"https://Stackoverflow.com/questions/15628163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774513/"
] | `array` is a pointer in your code. `sizeof(array)` therefore returns the size of that pointer in C bytes (reminder: C's bytes can have more than 8 bits in them).
So, 8 is your pointer size.
Also, the correct type specifier for `size_t` in printf()'s format strings is `%zu`. | `sizeof` doesn't have a return value because it isn't a function, it's a C language construct -- consider the fact that you can write `sizeof array` without the parentheses. As a C language construct, its value is based entirely on compile-time information. It has no idea how big your array is, only how big the `array`... |
15,628,163 | I have this in my code:
```
int x = 4;
char* array = malloc(x*sizeof(char));
size_t arraysize = sizeof (array);
printf("arraysize: %zu\n", arraysize);
```
This code prints out,
>
> arraysize: 8
>
>
>
Why is it 8 and not 4? (Since 4\*sizeof(char) = 4 \* 1) | 2013/03/26 | [
"https://Stackoverflow.com/questions/15628163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774513/"
] | `sizeof` doesn't have a return value because it isn't a function, it's a C language construct -- consider the fact that you can write `sizeof array` without the parentheses. As a C language construct, its value is based entirely on compile-time information. It has no idea how big your array is, only how big the `array`... | You are calculating the size of the full array (4\*sizeof(char))
But you spect to know the number of items on the array (4).
You can do
>
> size\_t arraysize = sizeof (array)/sizeof(char);
>
>
>
It will return 8/2 = 4 |
74,296 | We are trying to decide on the main navigation structure for our app.
I have read all there is about the disadvantages of the hamburger menu (aka side-menu, drawer).
The use of a visible navigation bar (instead of the hamburger menu) makes sense and it can fit our design since we don't many screens to navigate.
F... | 2015/03/02 | [
"https://ux.stackexchange.com/questions/74296",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/63122/"
] | On Android this is also very common pattern but with few differences.
* On Android you position this tabs on top of the screen (mainly
because of hardware buttons on the bottom of the phone)
You can use scrollable or fixed tabs (for more info: <http://developer.android.com/design/building-blocks/tabs.html>) | This is a very intuitive navigation and shouldn't be any issue. I can't give you any examples of top apps that are using this, but it doesn't mean that the user won't easily understand it. I'd suggest just going with your gut and doing what makes sense for you.
I'd also suggest doing user testing on your app in wire f... |
74,296 | We are trying to decide on the main navigation structure for our app.
I have read all there is about the disadvantages of the hamburger menu (aka side-menu, drawer).
The use of a visible navigation bar (instead of the hamburger menu) makes sense and it can fit our design since we don't many screens to navigate.
F... | 2015/03/02 | [
"https://ux.stackexchange.com/questions/74296",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/63122/"
] | There's no many apps using them on Android because Google **explicitly discourage** on its design guidelines. Each platform has their own visual language, so I completely disagree with implementing this on Android.
More: <http://developer.android.com/design/patterns/pure-android.html> | This is a very intuitive navigation and shouldn't be any issue. I can't give you any examples of top apps that are using this, but it doesn't mean that the user won't easily understand it. I'd suggest just going with your gut and doing what makes sense for you.
I'd also suggest doing user testing on your app in wire f... |
74,296 | We are trying to decide on the main navigation structure for our app.
I have read all there is about the disadvantages of the hamburger menu (aka side-menu, drawer).
The use of a visible navigation bar (instead of the hamburger menu) makes sense and it can fit our design since we don't many screens to navigate.
F... | 2015/03/02 | [
"https://ux.stackexchange.com/questions/74296",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/63122/"
] | On Android this is also very common pattern but with few differences.
* On Android you position this tabs on top of the screen (mainly
because of hardware buttons on the bottom of the phone)
You can use scrollable or fixed tabs (for more info: <http://developer.android.com/design/building-blocks/tabs.html>) | There's no many apps using them on Android because Google **explicitly discourage** on its design guidelines. Each platform has their own visual language, so I completely disagree with implementing this on Android.
More: <http://developer.android.com/design/patterns/pure-android.html> |
74,296 | We are trying to decide on the main navigation structure for our app.
I have read all there is about the disadvantages of the hamburger menu (aka side-menu, drawer).
The use of a visible navigation bar (instead of the hamburger menu) makes sense and it can fit our design since we don't many screens to navigate.
F... | 2015/03/02 | [
"https://ux.stackexchange.com/questions/74296",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/63122/"
] | On Android this is also very common pattern but with few differences.
* On Android you position this tabs on top of the screen (mainly
because of hardware buttons on the bottom of the phone)
You can use scrollable or fixed tabs (for more info: <http://developer.android.com/design/building-blocks/tabs.html>) | Look to future proof and understand the Google Material design guidance.
(**TL;DR**: icon buttons on top page for navigation is in line with the Material design )
Explicitly "Top-level view strategies section" in [Material Design - UI regions and guidance section](http://www.google.com/design/spec/layout/structure.h... |
74,296 | We are trying to decide on the main navigation structure for our app.
I have read all there is about the disadvantages of the hamburger menu (aka side-menu, drawer).
The use of a visible navigation bar (instead of the hamburger menu) makes sense and it can fit our design since we don't many screens to navigate.
F... | 2015/03/02 | [
"https://ux.stackexchange.com/questions/74296",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/63122/"
] | On Android this is also very common pattern but with few differences.
* On Android you position this tabs on top of the screen (mainly
because of hardware buttons on the bottom of the phone)
You can use scrollable or fixed tabs (for more info: <http://developer.android.com/design/building-blocks/tabs.html>) | Instagram actually uses this design pattern in their android app.
I would go back to the basics and understand what is best for your user.
Android and iOS users have different expectations when it comes to using apps based on muscle memory from common design patterns.
If something looks good in iOS it will most l... |
74,296 | We are trying to decide on the main navigation structure for our app.
I have read all there is about the disadvantages of the hamburger menu (aka side-menu, drawer).
The use of a visible navigation bar (instead of the hamburger menu) makes sense and it can fit our design since we don't many screens to navigate.
F... | 2015/03/02 | [
"https://ux.stackexchange.com/questions/74296",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/63122/"
] | There's no many apps using them on Android because Google **explicitly discourage** on its design guidelines. Each platform has their own visual language, so I completely disagree with implementing this on Android.
More: <http://developer.android.com/design/patterns/pure-android.html> | Look to future proof and understand the Google Material design guidance.
(**TL;DR**: icon buttons on top page for navigation is in line with the Material design )
Explicitly "Top-level view strategies section" in [Material Design - UI regions and guidance section](http://www.google.com/design/spec/layout/structure.h... |
74,296 | We are trying to decide on the main navigation structure for our app.
I have read all there is about the disadvantages of the hamburger menu (aka side-menu, drawer).
The use of a visible navigation bar (instead of the hamburger menu) makes sense and it can fit our design since we don't many screens to navigate.
F... | 2015/03/02 | [
"https://ux.stackexchange.com/questions/74296",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/63122/"
] | There's no many apps using them on Android because Google **explicitly discourage** on its design guidelines. Each platform has their own visual language, so I completely disagree with implementing this on Android.
More: <http://developer.android.com/design/patterns/pure-android.html> | Instagram actually uses this design pattern in their android app.
I would go back to the basics and understand what is best for your user.
Android and iOS users have different expectations when it comes to using apps based on muscle memory from common design patterns.
If something looks good in iOS it will most l... |
33,790,078 | I was given a problem to create a recursive function that prints out even numbers from 0 to the passed number. My problem? It can only have one parameter: `int counting(int n)`. I can't figure out how to do this. There are no loops in the main. You have to start at 0, but somehow get it to the value you're passing.
An... | 2015/11/18 | [
"https://Stackoverflow.com/questions/33790078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5318931/"
] | With recursion, you want to think of the base case (the case at which the recursion will stop and you'll start returning up the call stack). In this case, your method needs to keep calling itself until it gets down to 0. This implies that you'd need to keep calling it after reducing the parameter by 1 until the value r... | Make the recursive call before the printing - it will do the trick.
In Java:
```
int counting(int n) {
if (n == 0)
return n;
int res = counting(n - 1);
if (n % 2 == 0)
System.out.println(n);
return res;
}
``` |
33,790,078 | I was given a problem to create a recursive function that prints out even numbers from 0 to the passed number. My problem? It can only have one parameter: `int counting(int n)`. I can't figure out how to do this. There are no loops in the main. You have to start at 0, but somehow get it to the value you're passing.
An... | 2015/11/18 | [
"https://Stackoverflow.com/questions/33790078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5318931/"
] | With recursion, you want to think of the base case (the case at which the recursion will stop and you'll start returning up the call stack). In this case, your method needs to keep calling itself until it gets down to 0. This implies that you'd need to keep calling it after reducing the parameter by 1 until the value r... | The codes everyone gave is the same including this one in `c`.
```
int counting(int n) {
if(n)
counting(n-1);
if(!(n%2))
printf("%d\n", n);
}
```
The trick is to keep recursing until the parameter reaches `0`, then start printing the number before returning to the caller. |
9,650,089 | I have a very special work to do, here is my input
```none
Period End Date 12/30/ 12/31/ 12/29/ 12/28/ 12/31/2007
2011 2010 2009 2008
```
You can see this is a wrong input file:
1. year is on the second line
2. but last date is correct
So I want to dig out... | 2012/03/10 | [
"https://Stackoverflow.com/questions/9650089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1257574/"
] | I am going to presume that the number of dates varies, but always consists of N day-month entries, followed by a complete day-month-year entry, followed by N year entries:
```
def getHeadings(s):
head = s.split()
num_dates = (len(head) - 4)/2
return [dm+y for dm,y in zip(head[3:3+num_dates], head[4+num_dat... | it works
```
>>> temp_line = " ".join(line.split())
>>> temp_line
'12/30/ 12/31/ 12/29/ 12/28/ 12/31/2007'
>>> temp_line.split(" ")
['12/30/', '12/31/', '12/29/', '12/28/', '12/31/2007']
```
if you are iterating over each item in `temp_line` then you will get '1','2','/'... etc.
Also, may I suggest some pythonic ad... |
9,650,089 | I have a very special work to do, here is my input
```none
Period End Date 12/30/ 12/31/ 12/29/ 12/28/ 12/31/2007
2011 2010 2009 2008
```
You can see this is a wrong input file:
1. year is on the second line
2. but last date is correct
So I want to dig out... | 2012/03/10 | [
"https://Stackoverflow.com/questions/9650089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1257574/"
] | Let's look at your code:
```
temp_line = " ".join(line.split())
```
This replaces multiple whitespace with one single space. So far, so okay. Next line:
```
temp_line.split(" ")
```
Now what? Splitting it again at single space? This only reverses the join you've done before. Why didn't you just stick with `line.s... | it works
```
>>> temp_line = " ".join(line.split())
>>> temp_line
'12/30/ 12/31/ 12/29/ 12/28/ 12/31/2007'
>>> temp_line.split(" ")
['12/30/', '12/31/', '12/29/', '12/28/', '12/31/2007']
```
if you are iterating over each item in `temp_line` then you will get '1','2','/'... etc.
Also, may I suggest some pythonic ad... |
9,650,089 | I have a very special work to do, here is my input
```none
Period End Date 12/30/ 12/31/ 12/29/ 12/28/ 12/31/2007
2011 2010 2009 2008
```
You can see this is a wrong input file:
1. year is on the second line
2. but last date is correct
So I want to dig out... | 2012/03/10 | [
"https://Stackoverflow.com/questions/9650089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1257574/"
] | Let's look at your code:
```
temp_line = " ".join(line.split())
```
This replaces multiple whitespace with one single space. So far, so okay. Next line:
```
temp_line.split(" ")
```
Now what? Splitting it again at single space? This only reverses the join you've done before. Why didn't you just stick with `line.s... | I am going to presume that the number of dates varies, but always consists of N day-month entries, followed by a complete day-month-year entry, followed by N year entries:
```
def getHeadings(s):
head = s.split()
num_dates = (len(head) - 4)/2
return [dm+y for dm,y in zip(head[3:3+num_dates], head[4+num_dat... |
1,205,869 | Today, while idly glancing at my expansive list of Firefox addons, I saw something called "Shield Recipe Client" that I do *not* remember installing - or even hearing about.
A quick web search gave me nothing useful - a few conversations about viruses that may or may not have had any relevance at all, [a Mozilla wiki ... | 2017/05/04 | [
"https://superuser.com/questions/1205869",
"https://superuser.com",
"https://superuser.com/users/219325/"
] | You should look at the links provided at the bottom of the Mozilla wiki page you cite. Seems like a Firefox "system addon" under development. Those addons are installed by Mozilla, and are not user-controllable. The Shield Recipe Client purpose appears to be to give Mozilla a further means of snooping around in your br... | >
> Shield is a system that addresses user attrition and satisfaction in
> Firefox by providing a fast and powerful way for Firefox to interact
> with our users.
>
>
> User-facing products powered by Shield include:
>
>
> [Shield Studies](https://wiki.mozilla.org/Firefox/Shield/Shield_Studies)
>
> Recruits u... |
1,205,869 | Today, while idly glancing at my expansive list of Firefox addons, I saw something called "Shield Recipe Client" that I do *not* remember installing - or even hearing about.
A quick web search gave me nothing useful - a few conversations about viruses that may or may not have had any relevance at all, [a Mozilla wiki ... | 2017/05/04 | [
"https://superuser.com/questions/1205869",
"https://superuser.com",
"https://superuser.com/users/219325/"
] | You should look at the links provided at the bottom of the Mozilla wiki page you cite. Seems like a Firefox "system addon" under development. Those addons are installed by Mozilla, and are not user-controllable. The Shield Recipe Client purpose appears to be to give Mozilla a further means of snooping around in your br... | >
> Can it be removed?
>
>
>
Ccleaner > Tools > Browser Plugins
* NOTE: this *had* to be an answer, I need 50 reputation to comment, I posted because I thought was very relevant. |
1,205,869 | Today, while idly glancing at my expansive list of Firefox addons, I saw something called "Shield Recipe Client" that I do *not* remember installing - or even hearing about.
A quick web search gave me nothing useful - a few conversations about viruses that may or may not have had any relevance at all, [a Mozilla wiki ... | 2017/05/04 | [
"https://superuser.com/questions/1205869",
"https://superuser.com",
"https://superuser.com/users/219325/"
] | >
> Shield is a system that addresses user attrition and satisfaction in
> Firefox by providing a fast and powerful way for Firefox to interact
> with our users.
>
>
> User-facing products powered by Shield include:
>
>
> [Shield Studies](https://wiki.mozilla.org/Firefox/Shield/Shield_Studies)
>
> Recruits u... | >
> Can it be removed?
>
>
>
Ccleaner > Tools > Browser Plugins
* NOTE: this *had* to be an answer, I need 50 reputation to comment, I posted because I thought was very relevant. |
42,049,660 | I have install Android Studio 2.2.3 but I cant install haxm, in the Android SDK manager I get "installer not compatible with windows" and when I try to use AVD i get:
"cannot launch avd in emulator. output: emulator: warning: userdata partition is resized from 550 m to 800 m error: resizing partition e2fsck failed with... | 2017/02/05 | [
"https://Stackoverflow.com/questions/42049660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7516818/"
] | If you are trying to avoid creating separate `TextView`, then you might need to use `SpannableString`.
I think, the solution is demonstrated [here](https://stackoverflow.com/a/14521010/6155248)
You might get more idea through [this link](http://android-dev-examples.blogspot.com/2015/04/android-spannablestring-part-2... | Using two textViews will give you the results:
Here's an example:
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_conte... |
42,049,660 | I have install Android Studio 2.2.3 but I cant install haxm, in the Android SDK manager I get "installer not compatible with windows" and when I try to use AVD i get:
"cannot launch avd in emulator. output: emulator: warning: userdata partition is resized from 550 m to 800 m error: resizing partition e2fsck failed with... | 2017/02/05 | [
"https://Stackoverflow.com/questions/42049660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7516818/"
] | If you are trying to avoid creating separate `TextView`, then you might need to use `SpannableString`.
I think, the solution is demonstrated [here](https://stackoverflow.com/a/14521010/6155248)
You might get more idea through [this link](http://android-dev-examples.blogspot.com/2015/04/android-spannablestring-part-2... | This is how look after using SpannableString. And this is what I want. Thank you!
[](https://i.stack.imgur.com/uqwMF.png)
And final code is :
```
PackageInfo packageInfo = (PackageInfo) getItem(position);
Drawable appIcon = packageManager.getApplica... |
3,415,955 | Is there any way to make persistence of business objects with data from a database in Delphi 7?
Is it possible without using components. | 2010/08/05 | [
"https://Stackoverflow.com/questions/3415955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359706/"
] | You can use our Open Source ORM framework, using SQLite3 database. Full RESTful framework, works locally (i.e. in process), or remotely via HTTP/1.1, Named pipes or GDI messages. No external dll required. Works with Delphi 7 up to 2010.
All is done without any component, directly from source code. All database SQL is ... | hcOPF works with Delphi 7. In fact it was developed with Delphi 7 and as a result does not use some of the newer language features. Check it out on sourceforge. |
57,589,432 | In the example from the tutorial, it shows up.
```
Route::group([
'prefix' => 'admin',
'as' => 'admin.'
], function () {}
```
Can someone tells me what 'as' does? Also, is the dot next to the 'admin' neccessary?
Thank you. | 2019/08/21 | [
"https://Stackoverflow.com/questions/57589432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9522456/"
] | Let's say, for example, that you have this route:
```
Route::get('admin', [
'as' => 'admin', 'uses' => 'AdminController@index'
]);
```
By using *as* you assign custom name to your route. So now, Laravel will allow you to reference said route by using:
```
$route = route('admin');
```
So you don't have to bui... | you may specify an as keyword in the route group attribute array, allowing you to set a **common route name prefix** for all routes within the group.
>
> For Example
>
>
>
```
Route::group(['as' => 'admin::'], function () {
// Route named "admin::"
});
```
>
> UseRoute Name *like* **{{route(admin::)}}** o... |
57,589,432 | In the example from the tutorial, it shows up.
```
Route::group([
'prefix' => 'admin',
'as' => 'admin.'
], function () {}
```
Can someone tells me what 'as' does? Also, is the dot next to the 'admin' neccessary?
Thank you. | 2019/08/21 | [
"https://Stackoverflow.com/questions/57589432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9522456/"
] | Let's say, for example, that you have this route:
```
Route::get('admin', [
'as' => 'admin', 'uses' => 'AdminController@index'
]);
```
By using *as* you assign custom name to your route. So now, Laravel will allow you to reference said route by using:
```
$route = route('admin');
```
So you don't have to bui... | you can use an 'as' as a named route. if you do not prefix your route name in group route than you may add custom route name like this.
Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'roles'], 'roles' => ['2']], function () {
```
Route::post('/changeProfile', ['uses' => 'UserController@changeProfile',
... |
57,589,432 | In the example from the tutorial, it shows up.
```
Route::group([
'prefix' => 'admin',
'as' => 'admin.'
], function () {}
```
Can someone tells me what 'as' does? Also, is the dot next to the 'admin' neccessary?
Thank you. | 2019/08/21 | [
"https://Stackoverflow.com/questions/57589432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9522456/"
] | you may specify an as keyword in the route group attribute array, allowing you to set a **common route name prefix** for all routes within the group.
>
> For Example
>
>
>
```
Route::group(['as' => 'admin::'], function () {
// Route named "admin::"
});
```
>
> UseRoute Name *like* **{{route(admin::)}}** o... | you can use an 'as' as a named route. if you do not prefix your route name in group route than you may add custom route name like this.
Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'roles'], 'roles' => ['2']], function () {
```
Route::post('/changeProfile', ['uses' => 'UserController@changeProfile',
... |
13,510,406 | In Vim's folder viewing mode I can't enter the : state for I get error:
>
> Error detected while processing BufWinEnter Auto commands for "\*"
>
>
> E32: No file name
>
>
>
How do I fix that error?
[Here's my vimrc.](http://synodins.com/unix/vim/vimrc)
Except I now have commented out the BufWin's.
I've sto... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13510406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322537/"
] | You seem to have copied an autocmd into your configuration that is too simple and doesn't handle situations like unnamed buffers well.
If this is related to your [other question](https://stackoverflow.com/questions/13509533/vim-file-direction-e739), I'd suggest you have a look at <http://vim.wikia.com/wiki/Make_views_... | You should be able to get out of this by doing:
```
:q
```
in the same way as you would quit from a file? Perhaps you need to add '!' |
48,239,613 | I'm trying to catch a "click on a link" inside a bootstrap modal, but for some reason it is not working.
```js
$(document).ready(function() {
$('#menu-mobile a').click(function() {
alert();
});
});
```
```html
<div class="modal fade" id="menu" tabindex="-1" role="dialog" id="menu-mobile">
<div class="m... | 2018/01/13 | [
"https://Stackoverflow.com/questions/48239613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/776264/"
] | You could use event delegation `.on()` like :
```
$(function(){
$('body').on('click', '#menu-mobile a', function() {
alert();
});
});
```
**NOTE:** You should remove one of the id's in your modal since you've two now `id="menu" & id="menu-mobile"`. | First of all you have id attribute twice on your modal element:
```
<div class="modal fade" id="menu" tabindex="-1" role="dialog" id="menu-mobile">
```
assuming you'll change it to
```
<div class="modal fade" tabindex="-1" role="dialog" id="menu-mobile">
```
then to access even dynamically generated content with... |
61,619,643 | **Is there a way in which you can get a screenshot of another websites pages?**
e.g: you introduce a url in an input, hit enter, and a script gives you a screenshot of the site you put in. I manage to do it with headless browsers, but I fear that could take too much resources and time, to launch. let's say phantomjs e... | 2020/05/05 | [
"https://Stackoverflow.com/questions/61619643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10925686/"
] | Do you want a print screen of your page or someone else's?
Own page
--------
Use puppeteer or phantomJS with Beverly build of your site, this way you will only run it when it changes, and have a screenshot ready at any time.
Foreign page
------------
### You have access to it (the owner runs your script)
Either tr... | You can make this with [puppeteer](https://pptr.dev/)
install with: `npm i puppeteer`
save the following code to `example.js`
```
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
aw... |
52,685,614 | I am new at SQL and am having a little of trouble
**This is my code**
```
CREATE TABLE dataType(
Charater CHAR(250),
VariaChar VARCHAR(250),
STRING TEXT,
interger INT(50),
Floating FLOAT(50, 3),
fractions DECIMAL(50, 3),
today DATETIME("2018-10-07 12:55:20"),
watch TIME("12:55:20"),
... | 2018/10/07 | [
"https://Stackoverflow.com/questions/52685614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6209497/"
] | As [thebluephantom](https://stackoverflow.com/a/52687695/6664872 "thebluephantom") has already said union is the way to go. I'm just answering your question to give you a pyspark example:
```py
# if not already created automatically, instantiate Sparkcontext
spark = SparkSession.builder.getOrCreate()
columns = ['id',... | From something I did, using **union**, showing a block partial coding - you need to adapt of course to your own situation:
```
val dummySchema = StructType(
StructField("phrase", StringType, true) :: Nil)
var dfPostsNGrams2 = spark.createDataFrame(sc.emptyRDD[Row], dummySchema)
for (i <- i_grams_Cols) {
val nameCo... |
52,685,614 | I am new at SQL and am having a little of trouble
**This is my code**
```
CREATE TABLE dataType(
Charater CHAR(250),
VariaChar VARCHAR(250),
STRING TEXT,
interger INT(50),
Floating FLOAT(50, 3),
fractions DECIMAL(50, 3),
today DATETIME("2018-10-07 12:55:20"),
watch TIME("12:55:20"),
... | 2018/10/07 | [
"https://Stackoverflow.com/questions/52685614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6209497/"
] | From something I did, using **union**, showing a block partial coding - you need to adapt of course to your own situation:
```
val dummySchema = StructType(
StructField("phrase", StringType, true) :: Nil)
var dfPostsNGrams2 = spark.createDataFrame(sc.emptyRDD[Row], dummySchema)
for (i <- i_grams_Cols) {
val nameCo... | Another alternative would be to utilize the partitioned parquet format, and add an extra parquet file for each dataframe you want to append. This way you can create (hundreds, thousands, millions) of parquet files, and spark will just read them all as a union when you read the directory later.
This example uses pyarro... |
52,685,614 | I am new at SQL and am having a little of trouble
**This is my code**
```
CREATE TABLE dataType(
Charater CHAR(250),
VariaChar VARCHAR(250),
STRING TEXT,
interger INT(50),
Floating FLOAT(50, 3),
fractions DECIMAL(50, 3),
today DATETIME("2018-10-07 12:55:20"),
watch TIME("12:55:20"),
... | 2018/10/07 | [
"https://Stackoverflow.com/questions/52685614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6209497/"
] | As [thebluephantom](https://stackoverflow.com/a/52687695/6664872 "thebluephantom") has already said union is the way to go. I'm just answering your question to give you a pyspark example:
```py
# if not already created automatically, instantiate Sparkcontext
spark = SparkSession.builder.getOrCreate()
columns = ['id',... | Another alternative would be to utilize the partitioned parquet format, and add an extra parquet file for each dataframe you want to append. This way you can create (hundreds, thousands, millions) of parquet files, and spark will just read them all as a union when you read the directory later.
This example uses pyarro... |
52,685,614 | I am new at SQL and am having a little of trouble
**This is my code**
```
CREATE TABLE dataType(
Charater CHAR(250),
VariaChar VARCHAR(250),
STRING TEXT,
interger INT(50),
Floating FLOAT(50, 3),
fractions DECIMAL(50, 3),
today DATETIME("2018-10-07 12:55:20"),
watch TIME("12:55:20"),
... | 2018/10/07 | [
"https://Stackoverflow.com/questions/52685614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6209497/"
] | As [thebluephantom](https://stackoverflow.com/a/52687695/6664872 "thebluephantom") has already said union is the way to go. I'm just answering your question to give you a pyspark example:
```py
# if not already created automatically, instantiate Sparkcontext
spark = SparkSession.builder.getOrCreate()
columns = ['id',... | To append row to dataframe one can use **collect** method also. collect() function converts dataframe to list and you can directly append data to list and again convert list to dataframe.
my spark dataframe called **df** is like
```
+---+----+------+
| id|name|gender|
+---+----+------+
| 1| A| M|
| 2| B| ... |
52,685,614 | I am new at SQL and am having a little of trouble
**This is my code**
```
CREATE TABLE dataType(
Charater CHAR(250),
VariaChar VARCHAR(250),
STRING TEXT,
interger INT(50),
Floating FLOAT(50, 3),
fractions DECIMAL(50, 3),
today DATETIME("2018-10-07 12:55:20"),
watch TIME("12:55:20"),
... | 2018/10/07 | [
"https://Stackoverflow.com/questions/52685614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6209497/"
] | To append row to dataframe one can use **collect** method also. collect() function converts dataframe to list and you can directly append data to list and again convert list to dataframe.
my spark dataframe called **df** is like
```
+---+----+------+
| id|name|gender|
+---+----+------+
| 1| A| M|
| 2| B| ... | Another alternative would be to utilize the partitioned parquet format, and add an extra parquet file for each dataframe you want to append. This way you can create (hundreds, thousands, millions) of parquet files, and spark will just read them all as a union when you read the directory later.
This example uses pyarro... |
13,487,185 | ```
select count(*) FROM antecedente_delito WHERE rut_polichile = NEW.rut_polichile
```
this statement is giving de value 0, when it should give me 18 :/ ive been trying a lot to find any bug in it. | 2012/11/21 | [
"https://Stackoverflow.com/questions/13487185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1840929/"
] | Here's the working solution that I mocked up using/changing your code in SqlFiddle. <http://sqlfiddle.com/#!2/ac2e9/1> | The SELECT privilege for the subject table if references to table columns occur via OLD.col\_name or NEW.col\_name in the trigger definition.
but in your trigger i can't see any trigger definition. so try without NEW.
for more info: <http://www.sqlinfo.net/mysqldocs/v51/triggers.html> or
<http://bugs.mysql.com/bug.... |
13,487,185 | ```
select count(*) FROM antecedente_delito WHERE rut_polichile = NEW.rut_polichile
```
this statement is giving de value 0, when it should give me 18 :/ ive been trying a lot to find any bug in it. | 2012/11/21 | [
"https://Stackoverflow.com/questions/13487185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1840929/"
] | To trouble shoot this, I would view your actual values and verify that NEW. is returning what you think it should. Sometimes it may be doing some trims or removal of special characters, especially the \_ and % signs are likely to stripped in subprocedures.
I would start with the query:
```
select top 50 rut_polichile... | The SELECT privilege for the subject table if references to table columns occur via OLD.col\_name or NEW.col\_name in the trigger definition.
but in your trigger i can't see any trigger definition. so try without NEW.
for more info: <http://www.sqlinfo.net/mysqldocs/v51/triggers.html> or
<http://bugs.mysql.com/bug.... |
71,115,438 | how to make validation form in flutter with null safety,
there is a problem, but I can't select in formkey or filed and I try alot of ways, you can see this code and try to help me to use null safty, thank
I have the following code to class
```
import 'package:flutter/cupertino.dart';
import 'package:flutter/mate... | 2022/02/14 | [
"https://Stackoverflow.com/questions/71115438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18205844/"
] | This regex will validate your password must contain only one numeric number and min attribute validate minimum length of the password.
```
$request->validate(['password'=>'required|min:10|regex:/^[^\d\n]*\d[^\d\n]*$/']);
``` | You can try digits\_between like below ->
-----------------------------------------
```
$request->validate(['password' => 'required|min:10|digits_between:2,5]);
``` |
71,115,438 | how to make validation form in flutter with null safety,
there is a problem, but I can't select in formkey or filed and I try alot of ways, you can see this code and try to help me to use null safty, thank
I have the following code to class
```
import 'package:flutter/cupertino.dart';
import 'package:flutter/mate... | 2022/02/14 | [
"https://Stackoverflow.com/questions/71115438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18205844/"
] | This regex will validate your password must contain only one numeric number and min attribute validate minimum length of the password.
```
$request->validate(['password'=>'required|min:10|regex:/^[^\d\n]*\d[^\d\n]*$/']);
``` | Use the [Password](https://laravel.com/docs/8.x/validation#validating-passwords) rule object that requires at least one number.
```
Password::min(10)->numbers();
```
This is the validation you are looking for.
```
$request->validate([
'password' => [
'required',
'string',
Password::min(1... |
71,115,438 | how to make validation form in flutter with null safety,
there is a problem, but I can't select in formkey or filed and I try alot of ways, you can see this code and try to help me to use null safty, thank
I have the following code to class
```
import 'package:flutter/cupertino.dart';
import 'package:flutter/mate... | 2022/02/14 | [
"https://Stackoverflow.com/questions/71115438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18205844/"
] | This regex will validate your password must contain only one numeric number and min attribute validate minimum length of the password.
```
$request->validate(['password'=>'required|min:10|regex:/^[^\d\n]*\d[^\d\n]*$/']);
``` | You can do a combination of regex and min validation:
```
$request->validate([
'password' => [ 'required', 'min:10', 'regex:/^[a-z]*\d[a-z]*$/i' ];
]);
```
This requires a min length of 10 and exactly 1 number. If you allow other characters you can put them in the `[a-z]` groups |
71,115,438 | how to make validation form in flutter with null safety,
there is a problem, but I can't select in formkey or filed and I try alot of ways, you can see this code and try to help me to use null safty, thank
I have the following code to class
```
import 'package:flutter/cupertino.dart';
import 'package:flutter/mate... | 2022/02/14 | [
"https://Stackoverflow.com/questions/71115438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18205844/"
] | This regex will validate your password must contain only one numeric number and min attribute validate minimum length of the password.
```
$request->validate(['password'=>'required|min:10|regex:/^[^\d\n]*\d[^\d\n]*$/']);
``` | This regex will give you the strongest password.
Password must contain at least one uppercase letter, lowercase letter and at least 1 number
```
'password' => ['required', 'string', 'min:10', 'regex:/(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{10,}/']
``` |
65,593,170 | ```
Module not found: Can't resolve 'components/layout's Codes\nextjs-blog\pages\posts'
> 1 | import Layout from 'components/layout'
2 | import Link from 'next/link'
3 | import Head from 'next/head'
```
Ok so this is the error message I'm getting what's going anyone have an idea
I have my components folder under... | 2021/01/06 | [
"https://Stackoverflow.com/questions/65593170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8888733/"
] | It should be
```
import Layout from '../../components/layout'
```
Thanks to juliomalves for the answer | You need to use relative path to import components i.e. `../components/layout`.
To use absolute imports like `components/layout`, we setup aliases like below in `jsconfig.json`.
```
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/components/*": ["components/*"]
}
}
}
```
and use like this... |
29,665,300 | How do I make `<div A>` and `<div C>` to have same height as `<div B>` in javascript/jquery?
```
<div id="wrapper">
<div id="divA"></div>
<div id="divB"></div>
<div id="divC"></div>
</div>
<script>
$('#divA').css('height', $('#divB').innerHeight());
$('#divC').css('height', $('#divB').innerHeight());
</script... | 2015/04/16 | [
"https://Stackoverflow.com/questions/29665300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4739628/"
] | Try
```
$("#divA, #divC").height($("#divB").height());
```
```js
$("#divA, #divC").height($("#divB").height());
```
```css
#divA, #divC {
height: 50px;
width:50px;
background:gold;
}
#divB {
height: 100px;
width:50px;
background:red;
}
div {
display:inline-block;
}
```
```html
<script s... | Try this demo : [fiddle](http://jsfiddle.net/stanze/sL403xr7/)
```
var selDivB = $('#divB').height();
$('#divA, #divC').height(selDivB);
``` |
53,478,491 | I'm trying to deploy a Laravel 5.6 application on a shared hosting package. This package uses DirectAdmin with PHP 7.2.
Because of other applications living in sub directories in the `public_html` directory, I'm forced to also host the application in a subdirectory.
After some doing some research to hosting a Laravel... | 2018/11/26 | [
"https://Stackoverflow.com/questions/53478491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2989034/"
] | For errors you might want to look in Apache2/Nginx error logs if the laravel.log is empty.
You still might need to change the public path according to your file structure (taken from [here](https://stackoverflow.com/questions/31758901/laravel-5-change-public-path)). Add the following to `public/index.php`:
`$app->bin... | For testing give storage/ files permissions 777.
```
chmod -R 777 storage/
``` |
53,478,491 | I'm trying to deploy a Laravel 5.6 application on a shared hosting package. This package uses DirectAdmin with PHP 7.2.
Because of other applications living in sub directories in the `public_html` directory, I'm forced to also host the application in a subdirectory.
After some doing some research to hosting a Laravel... | 2018/11/26 | [
"https://Stackoverflow.com/questions/53478491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2989034/"
] | You can see in official documantation how is it working error handling
<https://laravel.com/docs/5.7/errors>
You can put on public/index.php this code and catch problem
```
try {
$app->run();
} catch(\Exception $e) {
echo "<pre>";
echo $e;
echo "</pre>";
}
``` | For testing give storage/ files permissions 777.
```
chmod -R 777 storage/
``` |
53,478,491 | I'm trying to deploy a Laravel 5.6 application on a shared hosting package. This package uses DirectAdmin with PHP 7.2.
Because of other applications living in sub directories in the `public_html` directory, I'm forced to also host the application in a subdirectory.
After some doing some research to hosting a Laravel... | 2018/11/26 | [
"https://Stackoverflow.com/questions/53478491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2989034/"
] | For errors you might want to look in Apache2/Nginx error logs if the laravel.log is empty.
You still might need to change the public path according to your file structure (taken from [here](https://stackoverflow.com/questions/31758901/laravel-5-change-public-path)). Add the following to `public/index.php`:
`$app->bin... | I had the same problem. I used this trick to deploy laravel application on shared hosting.
[Reference Lik](https://gist.github.com/liaotzukai/8e61a3f6dd82c267e05270b505eb6d5a)
In Laravel 5.6 create .htacess file in your root directory and placed the following code:
```
<IfModule mod_rewrite.c>
<IfModule mod_negotiati... |
53,478,491 | I'm trying to deploy a Laravel 5.6 application on a shared hosting package. This package uses DirectAdmin with PHP 7.2.
Because of other applications living in sub directories in the `public_html` directory, I'm forced to also host the application in a subdirectory.
After some doing some research to hosting a Laravel... | 2018/11/26 | [
"https://Stackoverflow.com/questions/53478491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2989034/"
] | You can see in official documantation how is it working error handling
<https://laravel.com/docs/5.7/errors>
You can put on public/index.php this code and catch problem
```
try {
$app->run();
} catch(\Exception $e) {
echo "<pre>";
echo $e;
echo "</pre>";
}
``` | I had the same problem. I used this trick to deploy laravel application on shared hosting.
[Reference Lik](https://gist.github.com/liaotzukai/8e61a3f6dd82c267e05270b505eb6d5a)
In Laravel 5.6 create .htacess file in your root directory and placed the following code:
```
<IfModule mod_rewrite.c>
<IfModule mod_negotiati... |
53,478,491 | I'm trying to deploy a Laravel 5.6 application on a shared hosting package. This package uses DirectAdmin with PHP 7.2.
Because of other applications living in sub directories in the `public_html` directory, I'm forced to also host the application in a subdirectory.
After some doing some research to hosting a Laravel... | 2018/11/26 | [
"https://Stackoverflow.com/questions/53478491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2989034/"
] | For errors you might want to look in Apache2/Nginx error logs if the laravel.log is empty.
You still might need to change the public path according to your file structure (taken from [here](https://stackoverflow.com/questions/31758901/laravel-5-change-public-path)). Add the following to `public/index.php`:
`$app->bin... | I have the same issue, after trying every solution from answers above, no one of them works. then i tryed to run the code inside Tinker, i found the problem was a infinity loop inside my code. so laravel error handler cannot be work or catch any error. |
53,478,491 | I'm trying to deploy a Laravel 5.6 application on a shared hosting package. This package uses DirectAdmin with PHP 7.2.
Because of other applications living in sub directories in the `public_html` directory, I'm forced to also host the application in a subdirectory.
After some doing some research to hosting a Laravel... | 2018/11/26 | [
"https://Stackoverflow.com/questions/53478491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2989034/"
] | You can see in official documantation how is it working error handling
<https://laravel.com/docs/5.7/errors>
You can put on public/index.php this code and catch problem
```
try {
$app->run();
} catch(\Exception $e) {
echo "<pre>";
echo $e;
echo "</pre>";
}
``` | I have the same issue, after trying every solution from answers above, no one of them works. then i tryed to run the code inside Tinker, i found the problem was a infinity loop inside my code. so laravel error handler cannot be work or catch any error. |
14,086,192 | I have this UserControl of a listBox:
```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Lightnings_Extractor
{
public partial class ListBoxControl : UserControl
{... | 2012/12/29 | [
"https://Stackoverflow.com/questions/14086192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196715/"
] | Just declare a property as you normally would:
```
[Browsable(true)] //so it appears in object explorer
public Color MyListColor
{
get { return m_MyListColor;}
set
{
m_MyListColor = value;
Refresh();//or Update
}
}
```
Once you set property to new value, it calls Refresh() that repaints control incl... | Simply add a new property.
```
public Brush Fill {get;set;}
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.