qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
70,925,248
So, I was working on commerce.js API. But when I press add to cart, it takes a bit of time to update the cart items number (from API) so I thought I should add a loading button until the cart items load. I found LoadingButton from **@mui/lab** so I used it. but the problem is even though that button is inside the loop ...
2022/01/31
[ "https://Stackoverflow.com/questions/70925248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12328282/" ]
It is not possible to use the value of a non-static member as default argument. You can use an overload instead: ``` struct S { int a; int func(int b) { // do something } int func() { return func(a); } }; ```
Another alternative is to use [`std::optional`](https://en.cppreference.com/w/cpp/utility/optional): ``` struct S { int a; int func(std::optional<int> ob = std::nullopt) { int b = ob.value_or(a); // do something } }; ```
42,805,018
I want to use SSL with varnish on my magento store, with nginx I did a proxy pass to the port 80 (varnish listen it). But when I do that the ESI block returns 404. If I bypass varnish (change proxy port to 8080 for nginx) it works. Varnish config : ``` C{ #include <stdlib.h> #include <stdio.h> #include <time.h> #in...
2017/03/15
[ "https://Stackoverflow.com/questions/42805018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343313/" ]
You should **always** explicitly add the columns you want to update in a table, it's good practice, your need for shortening the query notwithstanding. That being said, try inserting "null" and checking if it works. No guarantee here, haven't tried so myself.
I've never seen an `UPDATE` written the way you have it in MySQL. A typical `UPDATE` along the lines of what you want you want would look something like this: ``` UPDATE tbl SET f1 = 'new-f1-val', f2 = 'new-f2-val', f4 = 'new-f4-val' WHERE <some condition> ``` If you don't want to modify the `f3` column, the...
42,805,018
I want to use SSL with varnish on my magento store, with nginx I did a proxy pass to the port 80 (varnish listen it). But when I do that the ESI block returns 404. If I bypass varnish (change proxy port to 8080 for nginx) it works. Varnish config : ``` C{ #include <stdlib.h> #include <stdio.h> #include <time.h> #in...
2017/03/15
[ "https://Stackoverflow.com/questions/42805018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343313/" ]
You should **always** explicitly add the columns you want to update in a table, it's good practice, your need for shortening the query notwithstanding. That being said, try inserting "null" and checking if it works. No guarantee here, haven't tried so myself.
Check out for update query syntax. <https://dev.mysql.com/doc/refman/5.7/en/update.html> ``` Update tbl set f1=new-f1-val, f2=new-f2-val, f4=new-f4-val ```
387,528
Consider that the outcome of Alice's efforts are understood to be satisfactory or even excellent, by her peers and the upper hierarchy. Given that Alice recognises she can deliver even better than she did, how should Alice formally state that she aims to do better than she has achieved without risking being misundersto...
2017/05/02
[ "https://english.stackexchange.com/questions/387528", "https://english.stackexchange.com", "https://english.stackexchange.com/users/126985/" ]
Without substantially altering your sentence, the simplest way to convey that her current achievement is already very good, would be (in my opinion) to use 'even more' as an intensified form of 'more' as in > > "my goal is to be **even more efficient** and to close more deals per month" > > > where she can clear...
Most people would not take the statement as negative. However the simplest change the emphasis to the positive is to add the word 'even' before the goals. > > My goal is to be *even* more efficient and to close *even* more sales per month. > > > It's not a subtle change.
387,528
Consider that the outcome of Alice's efforts are understood to be satisfactory or even excellent, by her peers and the upper hierarchy. Given that Alice recognises she can deliver even better than she did, how should Alice formally state that she aims to do better than she has achieved without risking being misundersto...
2017/05/02
[ "https://english.stackexchange.com/questions/387528", "https://english.stackexchange.com", "https://english.stackexchange.com/users/126985/" ]
Without substantially altering your sentence, the simplest way to convey that her current achievement is already very good, would be (in my opinion) to use 'even more' as an intensified form of 'more' as in > > "my goal is to be **even more efficient** and to close more deals per month" > > > where she can clear...
When taken without the full context, yes, it may appear that Alice is acknowledging inferior performance by saying "my goal is to be more efficient and to close more deals per month". One way for Alice to restate this in a positive way would be > > My successes come from continuously looking for ways to improve. > ...
387,528
Consider that the outcome of Alice's efforts are understood to be satisfactory or even excellent, by her peers and the upper hierarchy. Given that Alice recognises she can deliver even better than she did, how should Alice formally state that she aims to do better than she has achieved without risking being misundersto...
2017/05/02
[ "https://english.stackexchange.com/questions/387528", "https://english.stackexchange.com", "https://english.stackexchange.com/users/126985/" ]
When taken without the full context, yes, it may appear that Alice is acknowledging inferior performance by saying "my goal is to be more efficient and to close more deals per month". One way for Alice to restate this in a positive way would be > > My successes come from continuously looking for ways to improve. > ...
Most people would not take the statement as negative. However the simplest change the emphasis to the positive is to add the word 'even' before the goals. > > My goal is to be *even* more efficient and to close *even* more sales per month. > > > It's not a subtle change.
24,204,167
Pretty short, I'm not really sure if possible, plus I can't find an example. ``` void Order<T>(List<T> lista) { // get all properties, T is always a class List<PropertyInfo> props = typeof(T).GetProperties().ToList(); // just order by one property, let's say: props[0] List<T> oList = lista.OrderBy( /*...
2014/06/13
[ "https://Stackoverflow.com/questions/24204167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1524477/" ]
Using the code from [this Blog](http://www.daedtech.com/linq-order-by-when-you-have-property-name) results in the following [Extension Method](http://msdn.microsoft.com/en-US/en-en/library/bb383977.aspx): ``` public static IEnumerable<T> OrderBy<T>(this IEnumerable<T> entities, string propertyName) { if (!entities...
I think this should work (if the property array is not empty) ``` List<T> oList = lista.OrderBy(item => props[0].GetValue(item)).ToList(); ``` On Mono, there's no overload of GetValue that takes a single argument. ``` List<T> oList = lista.OrderBy(item => props[0].GetValue(item, null)).ToList(); ```
444,147
I have been reading lately about electricity markets and I have stumbled upon the term ["volume risk"](https://en.wikipedia.org/wiki/Electricity_market#Risk_management). > > Volume risk is often used to denote the phenomenon whereby electricity market participants have uncertain volumes or quantities of consumption ...
2019/06/18
[ "https://electronics.stackexchange.com/questions/444147", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/217809/" ]
> > where would the overproduced electricity go, if the consumer has > estimated his consumption poorly? > > > It doesn't go anywhere - if the consumer under-consumes compared to the original prediction then, that under-consumption is physically less-current being taken and less-power being supplied by the genera...
The simple answer to "where would the overproduced electricity go" is that the generator will not produce excess electricity and that causes a reduction in the fuel that feeds the driver of the generator. It is more complex than that. Some types and sizes of generating equipment are easier to "throttle back" than other...
444,147
I have been reading lately about electricity markets and I have stumbled upon the term ["volume risk"](https://en.wikipedia.org/wiki/Electricity_market#Risk_management). > > Volume risk is often used to denote the phenomenon whereby electricity market participants have uncertain volumes or quantities of consumption ...
2019/06/18
[ "https://electronics.stackexchange.com/questions/444147", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/217809/" ]
> > where would the overproduced electricity go, if the consumer has > estimated his consumption poorly? > > > It doesn't go anywhere - if the consumer under-consumes compared to the original prediction then, that under-consumption is physically less-current being taken and less-power being supplied by the genera...
> > Who would cover the electricity difference if the generator does not > end up producing the quantity stated in the trade or where would the > overproduced electricity go, if the consumer has estimated his > consumption poorly? > > > This is why continuous grid management is needed. Electricity in the grid ...
444,147
I have been reading lately about electricity markets and I have stumbled upon the term ["volume risk"](https://en.wikipedia.org/wiki/Electricity_market#Risk_management). > > Volume risk is often used to denote the phenomenon whereby electricity market participants have uncertain volumes or quantities of consumption ...
2019/06/18
[ "https://electronics.stackexchange.com/questions/444147", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/217809/" ]
> > where would the overproduced electricity go, if the consumer has > estimated his consumption poorly? > > > It doesn't go anywhere - if the consumer under-consumes compared to the original prediction then, that under-consumption is physically less-current being taken and less-power being supplied by the genera...
There are different kinds of generators. Some do supply constant electricity with monthly schedules like nuclear and thermal power plant, these can't dynamically change the production. The variable part of the demand is supplied by power plants that can quickly turn on and off, these are gas turbine, hydroelectric pl...
15,533,258
If I have a method call in a for loop that is the same for all iterations of the loop - is the compiler smart enough to optimize it? ``` for (int j = 0; j < 24; j++ ) { *destinationPointer++ = identityArray[j] * (1 / powf(2, valueFromAboveInMethod)); } ``` Or should I be explicit and assign it to a va...
2013/03/20
[ "https://Stackoverflow.com/questions/15533258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698947/" ]
It depends on with what options do you compile it. Usually even with minimal optimization enabled compilers deal with such simple optimizations, however it's better to just do it yourself as you have written in the second code. Anyway if compiler will optimize it, it will keep `additional 4 bytes` too, because value ne...
The compiler may not be smart enough to realize powf is stateless. When in doubt, compile to assembler and check it yourself.
15,533,258
If I have a method call in a for loop that is the same for all iterations of the loop - is the compiler smart enough to optimize it? ``` for (int j = 0; j < 24; j++ ) { *destinationPointer++ = identityArray[j] * (1 / powf(2, valueFromAboveInMethod)); } ``` Or should I be explicit and assign it to a va...
2013/03/20
[ "https://Stackoverflow.com/questions/15533258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698947/" ]
I personally would use a variable here. Not only because it may provide better code, but also because it shows to anyone reading the code that the value doesn't change [I'd give it a better variable-name than "value", however]. I do expect the compiler to actually pre-calculate the value, but as has been mentioned, it ...
It depends on with what options do you compile it. Usually even with minimal optimization enabled compilers deal with such simple optimizations, however it's better to just do it yourself as you have written in the second code. Anyway if compiler will optimize it, it will keep `additional 4 bytes` too, because value ne...
15,533,258
If I have a method call in a for loop that is the same for all iterations of the loop - is the compiler smart enough to optimize it? ``` for (int j = 0; j < 24; j++ ) { *destinationPointer++ = identityArray[j] * (1 / powf(2, valueFromAboveInMethod)); } ``` Or should I be explicit and assign it to a va...
2013/03/20
[ "https://Stackoverflow.com/questions/15533258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698947/" ]
I personally would use a variable here. Not only because it may provide better code, but also because it shows to anyone reading the code that the value doesn't change [I'd give it a better variable-name than "value", however]. I do expect the compiler to actually pre-calculate the value, but as has been mentioned, it ...
The compiler may not be smart enough to realize powf is stateless. When in doubt, compile to assembler and check it yourself.
64,162,161
In CSS I would use `input[type="radio"]:checked { color: #000}` but in Material UI that expression is not valid. In Material UI I create rules using makeStyles: `const useStyles = makeStyles(() => ({ text: { color: "red", }, }));` How can I target `input[type="radio"]` elements using makeStyles?
2020/10/01
[ "https://Stackoverflow.com/questions/64162161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13385688/" ]
You can use `"&:checked"` to target checked radio buttons. That is assuming you are using the native `input` DOM component. If you are using the MUI `<Radio/>`, you can target the [rule name checked](https://material-ui.com/api/radio/#css) ```js const useStyles = makeStyles({ customRadio: { "& + label" : { ...
Have you tried something like this? ``` const useStyles = makeStyles(() => ({ text: { color: "red", }, 'input[type="radio"]:checked': { color: '#000' } })); ```
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
You can try with: ``` $input = '100 r St Lazare, 75009 PARIS'; $words = explode(' ', $input); $last = array_pop($words); ``` or ``` $last = $words[count($words) - 1]; ```
Regular expressions and `explode` are possible solutions, however, the fastest one is `substr` in my opinion: ``` $last = substr($words, strrpos($words, " ")+1); ``` `strrpos` returns the offset of last space. That's all you need.
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
If you want a **pure** regex solution, you can use ``` ([a-z]+)$|^.*\b([a-z]+)\b ``` as your regex. (Again, replace `[a-z]` with `[^\s\d]` if you're dealing with non-ascii chars) [Demo @ regex101](http://regex101.com/r/yC4vK5) --- Essentially there are two cases: 1. A word consists only of letters *or* numb...
You can try with: ``` $input = '100 r St Lazare, 75009 PARIS'; $words = explode(' ', $input); $last = array_pop($words); ``` or ``` $last = $words[count($words) - 1]; ```
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
You can try with: ``` $input = '100 r St Lazare, 75009 PARIS'; $words = explode(' ', $input); $last = array_pop($words); ``` or ``` $last = $words[count($words) - 1]; ```
you may try ``` $text = "100 r St Lazare, 75009 PARIS"; $exploded = explode(" ",$text); echo $exploded[count($exploded)-1] ```
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
If you want a **pure** regex solution, you can use ``` ([a-z]+)$|^.*\b([a-z]+)\b ``` as your regex. (Again, replace `[a-z]` with `[^\s\d]` if you're dealing with non-ascii chars) [Demo @ regex101](http://regex101.com/r/yC4vK5) --- Essentially there are two cases: 1. A word consists only of letters *or* numb...
Regular expressions and `explode` are possible solutions, however, the fastest one is `substr` in my opinion: ``` $last = substr($words, strrpos($words, " ")+1); ``` `strrpos` returns the offset of last space. That's all you need.
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
Regular expressions and `explode` are possible solutions, however, the fastest one is `substr` in my opinion: ``` $last = substr($words, strrpos($words, " ")+1); ``` `strrpos` returns the offset of last space. That's all you need.
you may try ``` $text = "100 r St Lazare, 75009 PARIS"; $exploded = explode(" ",$text); echo $exploded[count($exploded)-1] ```
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
I'd like to suggest the following version, though it is still not perfect for all cases: ``` $input = '100 r St Lazare, 75009 PARIS 345'; // pass, returns "PARIS" $input = '100 r St Lazare, 75009 PARIS'; // pass, returns "PARIS" $input = 'this just a Ðöæ 75009'; // pass, returns "Ðöæ" $input = 'this jus...
Regular expressions and `explode` are possible solutions, however, the fastest one is `substr` in my opinion: ``` $last = substr($words, strrpos($words, " ")+1); ``` `strrpos` returns the offset of last space. That's all you need.
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
If you want a **pure** regex solution, you can use ``` ([a-z]+)$|^.*\b([a-z]+)\b ``` as your regex. (Again, replace `[a-z]` with `[^\s\d]` if you're dealing with non-ascii chars) [Demo @ regex101](http://regex101.com/r/yC4vK5) --- Essentially there are two cases: 1. A word consists only of letters *or* numb...
you may try ``` $text = "100 r St Lazare, 75009 PARIS"; $exploded = explode(" ",$text); echo $exploded[count($exploded)-1] ```
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
If you want a **pure** regex solution, you can use ``` ([a-z]+)$|^.*\b([a-z]+)\b ``` as your regex. (Again, replace `[a-z]` with `[^\s\d]` if you're dealing with non-ascii chars) [Demo @ regex101](http://regex101.com/r/yC4vK5) --- Essentially there are two cases: 1. A word consists only of letters *or* numb...
I'd like to suggest the following version, though it is still not perfect for all cases: ``` $input = '100 r St Lazare, 75009 PARIS 345'; // pass, returns "PARIS" $input = '100 r St Lazare, 75009 PARIS'; // pass, returns "PARIS" $input = 'this just a Ðöæ 75009'; // pass, returns "Ðöæ" $input = 'this jus...
21,401,891
Can somebody help me to getting the last word from a text which contains only letters. I should use regex I think... For example: ``` 100 r St Lazare, 75009 PARIS ``` I need the word `PARIS`
2014/01/28
[ "https://Stackoverflow.com/questions/21401891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3243871/" ]
I'd like to suggest the following version, though it is still not perfect for all cases: ``` $input = '100 r St Lazare, 75009 PARIS 345'; // pass, returns "PARIS" $input = '100 r St Lazare, 75009 PARIS'; // pass, returns "PARIS" $input = 'this just a Ðöæ 75009'; // pass, returns "Ðöæ" $input = 'this jus...
you may try ``` $text = "100 r St Lazare, 75009 PARIS"; $exploded = explode(" ",$text); echo $exploded[count($exploded)-1] ```
43,324,450
I want a button at the right corner of a div. It works fine normally, but upon adding the align="right" to the html, the button doesn't work anymore (although it does align to the right). ``` <input id="exitbutton" align="right" style="width:15px" type="image" src="images/#"/> ``` Why does this happen?
2017/04/10
[ "https://Stackoverflow.com/questions/43324450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7548189/" ]
Ideally `align="right"` is not the property of input tag if you are using HTML5. As you are already applying inline style, you can just apply `float:right` to align input button to the right. ``` <input id="exitbutton" style="width:15px; float:right" type="image" src="images/#"/> ```
For buttons instead of using inline attributes use text alignment in your css. And avoid giving style with attributes as much as you can. For form elements you should use float if you are not using flex. But keep it in mind you should clear floats in order to prevent visual errors
43,324,450
I want a button at the right corner of a div. It works fine normally, but upon adding the align="right" to the html, the button doesn't work anymore (although it does align to the right). ``` <input id="exitbutton" align="right" style="width:15px" type="image" src="images/#"/> ``` Why does this happen?
2017/04/10
[ "https://Stackoverflow.com/questions/43324450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7548189/" ]
Ideally `align="right"` is not the property of input tag if you are using HTML5. As you are already applying inline style, you can just apply `float:right` to align input button to the right. ``` <input id="exitbutton" style="width:15px; float:right" type="image" src="images/#"/> ```
`align` property is not for an input field You can use `float` like this: ```css input{float:right;} ``` ```html <input id="exitbutton" style="width:15px" type="image" src="images/#"/> ```
53,223,975
I am putting a JSON response into a variable via `requests.json()` like this: ``` response = requests.get(some_url, params=some_params).json() ``` This however converts JSON's original `"` to Python's `'`, `true` to `True`, `null` to `None`. This poses a problem when trying to save the response as text and the conv...
2018/11/09
[ "https://Stackoverflow.com/questions/53223975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8461786/" ]
You'll need an Object array instead of a String Array to keep a record of which checkbox was checked: ``` nontrade = [ { label: 'a', selected: false }, { label: 'b', selected: false }, { label: 'c', selected: false }, { label: 'd', selected: false } ]; trade = [ { label: 'aa', selected: false }, { lab...
In my case, I got the checkbox values from an API and the checkbox to select ALL the other checkboxes were sibling checkboxes. What happens here is if you check any of the 'ALL' checkboxes all the sibling checkboxes are also checked. ```js areasAndPermissions = [{ area: 'all', permissions: ['ALL', 'CREATE', '...
56,537,807
If I didn't initiate the iterators *i* and *j* with zero's this is what happens. The compiler does initiate them by zeros but somehow the child loop didn't proceed with iterating. Any interpretation for that? I already found the solution but I am asking about what could be the reason behind this? ``` void sortById(in...
2019/06/11
[ "https://Stackoverflow.com/questions/56537807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5095396/" ]
You need to pass `rgb` as well with the values. Try the below solution. ``` scheme.forEach(colour => { console.log(colour) // successful data collected const column = document.createElement('div') column.setAttribute('class', 'column') app.appendChild(column) column.style.backgroundColor = `rgb(${colour})`...
That's because the value you get in `colour` is an Array, not a colour code. You should parse the array into a colour code (i.e. RGB format). ``` scheme.forEach(colour => { console.log(colour) // successful data collected const column = document.createElement('div') column.setAttribute('class', 'column') cons...
56,537,807
If I didn't initiate the iterators *i* and *j* with zero's this is what happens. The compiler does initiate them by zeros but somehow the child loop didn't proceed with iterating. Any interpretation for that? I already found the solution but I am asking about what could be the reason behind this? ``` void sortById(in...
2019/06/11
[ "https://Stackoverflow.com/questions/56537807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5095396/" ]
That's because the value you get in `colour` is an Array, not a colour code. You should parse the array into a colour code (i.e. RGB format). ``` scheme.forEach(colour => { console.log(colour) // successful data collected const column = document.createElement('div') column.setAttribute('class', 'column') cons...
Instead of passing array as a color you should create a `rgb()` string with elements from that array. You could create a function for this. ```js const div = document.querySelector('div'); const rgb = color => `rgb(${color.join(', ')})` div.style.backgroundColor = rgb([50, 200, 50]) ``` ```html <div>Div</div> ```
56,537,807
If I didn't initiate the iterators *i* and *j* with zero's this is what happens. The compiler does initiate them by zeros but somehow the child loop didn't proceed with iterating. Any interpretation for that? I already found the solution but I am asking about what could be the reason behind this? ``` void sortById(in...
2019/06/11
[ "https://Stackoverflow.com/questions/56537807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5095396/" ]
That's because the value you get in `colour` is an Array, not a colour code. You should parse the array into a colour code (i.e. RGB format). ``` scheme.forEach(colour => { console.log(colour) // successful data collected const column = document.createElement('div') column.setAttribute('class', 'column') cons...
You can try the following way: ```js var scheme = [[122, 122, 122], [222, 122, 122], [122, 322, 122]] scheme.forEach(colour => { //console.log(colour) // successful data collected const column = document.createElement('div'); column.textContent = 'test'; column.setAttribute('class', 'column'); docume...
56,537,807
If I didn't initiate the iterators *i* and *j* with zero's this is what happens. The compiler does initiate them by zeros but somehow the child loop didn't proceed with iterating. Any interpretation for that? I already found the solution but I am asking about what could be the reason behind this? ``` void sortById(in...
2019/06/11
[ "https://Stackoverflow.com/questions/56537807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5095396/" ]
You need to pass `rgb` as well with the values. Try the below solution. ``` scheme.forEach(colour => { console.log(colour) // successful data collected const column = document.createElement('div') column.setAttribute('class', 'column') app.appendChild(column) column.style.backgroundColor = `rgb(${colour})`...
Instead of passing array as a color you should create a `rgb()` string with elements from that array. You could create a function for this. ```js const div = document.querySelector('div'); const rgb = color => `rgb(${color.join(', ')})` div.style.backgroundColor = rgb([50, 200, 50]) ``` ```html <div>Div</div> ```
56,537,807
If I didn't initiate the iterators *i* and *j* with zero's this is what happens. The compiler does initiate them by zeros but somehow the child loop didn't proceed with iterating. Any interpretation for that? I already found the solution but I am asking about what could be the reason behind this? ``` void sortById(in...
2019/06/11
[ "https://Stackoverflow.com/questions/56537807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5095396/" ]
You need to pass `rgb` as well with the values. Try the below solution. ``` scheme.forEach(colour => { console.log(colour) // successful data collected const column = document.createElement('div') column.setAttribute('class', 'column') app.appendChild(column) column.style.backgroundColor = `rgb(${colour})`...
You can try the following way: ```js var scheme = [[122, 122, 122], [222, 122, 122], [122, 322, 122]] scheme.forEach(colour => { //console.log(colour) // successful data collected const column = document.createElement('div'); column.textContent = 'test'; column.setAttribute('class', 'column'); docume...
8,168,447
I have a dropdownlist and it is very simple. You click the button to go further you have error if you don't select nothing from DDL. But how i do to not appear the error when the user choose something from the DDL? Here is the markup: ``` <asp:DropDownList ID="DropDownList1" runat="server" CssClass="jump"> <asp:...
2011/11/17
[ "https://Stackoverflow.com/questions/8168447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
As simple as this: ``` err.InnerHtml = ""; if (DropDownList1.SelectedIndex == 0) { err.InnerHtml = "<span style='font: normal bold 11px/100% Arial, Verdana, Sans-Serif; color: Red'>Du måste välja Fordonstyp!</span>"; return; } ``` This will hide the error by default, then show it only if need...
You could also use a [RequiredFieldValidator](http://msdn.microsoft.com/en-us/library/5hbw267h%28v=VS.100%29.aspx) : ``` <asp:RequiredFieldValidator id="rfvFavoriteCar" Text="Du måste välja Fordonstyp!" ControlToValidate="DropDownList1" Runat="server" /> ```
8,168,447
I have a dropdownlist and it is very simple. You click the button to go further you have error if you don't select nothing from DDL. But how i do to not appear the error when the user choose something from the DDL? Here is the markup: ``` <asp:DropDownList ID="DropDownList1" runat="server" CssClass="jump"> <asp:...
2011/11/17
[ "https://Stackoverflow.com/questions/8168447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
As simple as this: ``` err.InnerHtml = ""; if (DropDownList1.SelectedIndex == 0) { err.InnerHtml = "<span style='font: normal bold 11px/100% Arial, Verdana, Sans-Serif; color: Red'>Du måste välja Fordonstyp!</span>"; return; } ``` This will hide the error by default, then show it only if need...
If you need to have a field selected, why not remove the empty selection line? ``` <asp:ListItem Text="" Value="0"></asp:ListItem> ```
8,168,447
I have a dropdownlist and it is very simple. You click the button to go further you have error if you don't select nothing from DDL. But how i do to not appear the error when the user choose something from the DDL? Here is the markup: ``` <asp:DropDownList ID="DropDownList1" runat="server" CssClass="jump"> <asp:...
2011/11/17
[ "https://Stackoverflow.com/questions/8168447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
As simple as this: ``` err.InnerHtml = ""; if (DropDownList1.SelectedIndex == 0) { err.InnerHtml = "<span style='font: normal bold 11px/100% Arial, Verdana, Sans-Serif; color: Red'>Du måste välja Fordonstyp!</span>"; return; } ``` This will hide the error by default, then show it only if need...
``` if (DropDownList1.SelectedIndex == 0) { err.InnerHtml = "<span style='font: normal bold 11px/100% Arial, Verdana, Sans-Serif; color: Red'>Du måste välja Fordonstyp!</span>"; err.visible = true; return; } else err.visible = false; ```
8,168,447
I have a dropdownlist and it is very simple. You click the button to go further you have error if you don't select nothing from DDL. But how i do to not appear the error when the user choose something from the DDL? Here is the markup: ``` <asp:DropDownList ID="DropDownList1" runat="server" CssClass="jump"> <asp:...
2011/11/17
[ "https://Stackoverflow.com/questions/8168447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
As simple as this: ``` err.InnerHtml = ""; if (DropDownList1.SelectedIndex == 0) { err.InnerHtml = "<span style='font: normal bold 11px/100% Arial, Verdana, Sans-Serif; color: Red'>Du måste välja Fordonstyp!</span>"; return; } ``` This will hide the error by default, then show it only if need...
I took your code modified it to work. (at least what I think you are looking for) ``` <asp:DropDownList ID="DropDownList1" runat="server" CssClass="jump" AutoPostBack="true"> ``` and here ``` if (DropDownList1.SelectedIndex == 0) { err.InnerHtml = "<span style='font: normal bold 11px/100% Arial, Verdana, San...
3,803,356
An AJAX response is returning the full HTML page. I need to extract the fragment between the body (`<body>` and `</body>`) tags. This is required to be done on the client side using JavaScript. Any help will be appreciated.
2010/09/27
[ "https://Stackoverflow.com/questions/3803356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459416/" ]
The simplest but kind-of worst way would be simple string hacking on the response text. ``` var bodyhtml= html.split('<body>').pop().split('</body>')[0]; ``` This is unsatisfactory in the general case, but can be feasible if you know the exact format of the HTML being returned (eg. that there's no attributes on the ...
If your HTML Page is on Web then You can use YQL. e.g if your page url is <http://xyz.com/page.html> and you want everything in body element do like this ``` select * from html where url="http://xyz.com/page.html" and xpath='//body' ``` If you are new to YQL read this <http://en.wikipedia.org/wiki/YQL_Page_Scrapi...
3,803,356
An AJAX response is returning the full HTML page. I need to extract the fragment between the body (`<body>` and `</body>`) tags. This is required to be done on the client side using JavaScript. Any help will be appreciated.
2010/09/27
[ "https://Stackoverflow.com/questions/3803356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459416/" ]
The simplest but kind-of worst way would be simple string hacking on the response text. ``` var bodyhtml= html.split('<body>').pop().split('</body>')[0]; ``` This is unsatisfactory in the general case, but can be feasible if you know the exact format of the HTML being returned (eg. that there's no attributes on the ...
``` // Get the XML object for the "body" tag from the XMLHttpRequest/ActiveXObject // object (requestObj). // NOTE: This assumes there is only one "body" tag in your HTML document. var body = requestObj.responseXML.getElementsByTagName("body")[0]; // Get the "body" tag as an XML string. var bodyXML; // for Internet ...
169,529
I'd like to know whether "the survey online" or "an online survey" should be used in the following: > > World Gym has been under new management since July 3. For the new team to better serve our members, please take a few moments and click here to fill out **the survey online / an online survey**. > > > I'd appre...
2018/06/14
[ "https://ell.stackexchange.com/questions/169529", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/3865/" ]
The chosen article reveals the speaker's thought. With **the** the speaker is indicating that he or she believes you will understand (you, being the visitor reading those words) that **a survey** is normally associated with attempts to get to know users better, and **the particular survey in this instance** can be rea...
The survey is **very specific here.** How? Because it says *click here.* Anything specific i.e. *only that thing and nothing else* would have the definite article. Take another example and you may understand that - > > If you want to register, click here to go to **the registration form.** > > > So, registration ...
12,169,271
I have sets of data like this: ``` 5.3.12.0 5.3.12.1 5.3.12.2 5.3.12.3 5.3.12.4 ``` How do I structure this in a YAML file, and then load it into Ruby as a simple array? I want the data above to be loaded as an array like: ``` fileset_levels = ["5.3.12.0", "5.3.12.1", "5.3.12.2", "5.3.12.3", "5.3.12.4"] ``` I'l...
2012/08/29
[ "https://Stackoverflow.com/questions/12169271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383883/" ]
A great way to learn how to do anything with a serializer is to try writing a piece of code to demo a round-trip: ``` require 'yaml' puts %w[ 5.3.12.0 5.3.12.1 5.3.12.2 5.3.12.3 5.3.12.4 ].to_yaml ``` Which outputs: ``` --- - 5.3.12.0 - 5.3.12.1 - 5.3.12.2 - 5.3.12.3 - 5.3.12.4 ``` Creating the round-...
you call this a yaml file but this is just a basic file. Yaml is like a hash structure, you have a key that match a value. Here just a list of values. What you can do is ``` >> file = File.read('vuln1.yml') => "5.3.12.0\n5.3.12.1\n5.3.12.2\n5.3.12.3 \n5.3.12.4\n" >> file.split("\n") => ["5.3.12.0", "5.3.12.1", "5.3.1...
27,809,448
I am a beginner in Java having only limited knowledge in SQL commands say 5 or 6 commands... I tried connecting my Java project with an access database "aman.accdb" using ODBC in my laptop.. The database has a table named "tab".. I am using a windows 7 64 bit pc with Java JDK for 64 bit installed in it. And also I use...
2015/01/07
[ "https://Stackoverflow.com/questions/27809448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4411184/" ]
> > I am using JDK 1.8.0 > > > The JDBC-ODBC Bridge has been removed from Java 8. Consider using the [UCanAccess](http://ucanaccess.sourceforge.net/site.html) JDBC driver instead. For details. see [Manipulating an Access database from Java without ODBC](https://stackoverflow.com/q/21955256/2144390)
Try this, i believe its because you have not specified the driver. This is for `MS Access` database. ``` public als() throws SQLException { initComponents(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:man") ; }catch(Exception e) { ...
66,578,376
i have a android app of version 4.20 inside 10M sqlitedb, now i have a app of version 4.21 inside 100M sqlitedb,i want upgrade 4.20 to 4.21, when it upgrade have completed, i find the sqlite size still keep 10M in 4.21 app. so the question is how to override sqlitedb when upgrade app 4.20 -> 4.21 。 --- My business i...
2021/03/11
[ "https://Stackoverflow.com/questions/66578376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2552241/" ]
> > I dont have a user created in IAM but have a role created and assigned. > > > If you have only IAM role for RDS, you still need IAM user or some other role (e.g. instance role) which can **assume** (`iam:AssumeRole`) the RDS's role. Then, you have to use boto3' [assume\_role](https://boto3.amazonaws.com/v1/do...
You should check the role of your User first. Then, it should be .aws/credentials ``` cat credential [default] aws_access_key_id = ***** aws_secret_access_key = **** ```
32,682,228
Suppose I have a method: ``` std::vector<double> minimize(double (*f)(const std::vector<double>& x)) ``` that takes a function *f(x)* and finds *x* that minimizes it. Suppose I want to minimize a function *g(x, a)* (with respect to *x*) which also takes a parameter *a* as an argument: ``` double g(const std::vector...
2015/09/20
[ "https://Stackoverflow.com/questions/32682228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4297373/" ]
You can easily use a lambda. ``` minimize([=](const std::vector<double>& x) { return g(x, a); }); ``` This is assuming that you change your function to use `std::function` instead of a function pointer. Function pointers are terribly limited and can't do anything interesting at all, like this, so it's best to forget...
Use [labda](http://www.drdobbs.com/cpp/lambdas-in-c11/240168241) as Puppy suggested, but additinally update `minimize` to be a function template. Using template parameter instead of std::function will dramatically speed up `minimize` ``` //somewhere in header file template<class Function> std::vector<double> minimize(...
25,943,160
I have an array as follows: ``` my_array = [ [value_1, value_2, value_3, value_4], [value_n1, value_n2, value_n3, value_n4], [value_x1, value_x2, value_x3, value_x4], [value_y1, value_y2, value_y3, value_y4], [value_z1, value_z2, value_z3, value_z4] ] ``` I find the array that ha...
2014/09/19
[ "https://Stackoverflow.com/questions/25943160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162811/" ]
In light of the edit of your question, I believe this is what you want. ``` my_array = [[5, 3, 1], [1, 2, 3], [4, 5, 6], [7, 8, 9]] val = 4 (ndx = my_array.transpose.first.index(val)) ? ((1..my_array[ndx].size-1).each { |i| my_array[ndx][i] += 1 }; my_array) : nil #=> [[5, ...
Maybe something along these lines: ``` my_array.map{|a| a.include?(some_value) ? transform(a) : a } def transform array #return your modified array end ``` If you fed that `[[1,2],[2,3],[3,4]]` and you had `some_value` set to 3, you could use ``` def transform array do array.map{|k| k + 1} end ``` to get...
25,943,160
I have an array as follows: ``` my_array = [ [value_1, value_2, value_3, value_4], [value_n1, value_n2, value_n3, value_n4], [value_x1, value_x2, value_x3, value_x4], [value_y1, value_y2, value_y3, value_y4], [value_z1, value_z2, value_z3, value_z4] ] ``` I find the array that ha...
2014/09/19
[ "https://Stackoverflow.com/questions/25943160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162811/" ]
Finding sub-array by its first element is a job of [`Array#assoc`](http://www.ruby-doc.org/core-2.1.2/Array.html#method-i-assoc) method. Increasing value of following elements is a straightforward task. Possible implementation: ``` array = [ ['abc', 4, 5], ['xyz', 2, 10], ['ubf', 40, 9] ] x = 'abc' marr = array.assoc...
Maybe something along these lines: ``` my_array.map{|a| a.include?(some_value) ? transform(a) : a } def transform array #return your modified array end ``` If you fed that `[[1,2],[2,3],[3,4]]` and you had `some_value` set to 3, you could use ``` def transform array do array.map{|k| k + 1} end ``` to get...
25,943,160
I have an array as follows: ``` my_array = [ [value_1, value_2, value_3, value_4], [value_n1, value_n2, value_n3, value_n4], [value_x1, value_x2, value_x3, value_x4], [value_y1, value_y2, value_y3, value_y4], [value_z1, value_z2, value_z3, value_z4] ] ``` I find the array that ha...
2014/09/19
[ "https://Stackoverflow.com/questions/25943160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162811/" ]
In light of the edit of your question, I believe this is what you want. ``` my_array = [[5, 3, 1], [1, 2, 3], [4, 5, 6], [7, 8, 9]] val = 4 (ndx = my_array.transpose.first.index(val)) ? ((1..my_array[ndx].size-1).each { |i| my_array[ndx][i] += 1 }; my_array) : nil #=> [[5, ...
If you have an array but want it to behave in a special way, you may want to think about creating a class. ``` class EGC < Array def increment(val) self.map do |sub| if sub.first == val [val, sub[1..-1].map(&:next)].flatten else sub end end end end ``` Then you can do th...
25,943,160
I have an array as follows: ``` my_array = [ [value_1, value_2, value_3, value_4], [value_n1, value_n2, value_n3, value_n4], [value_x1, value_x2, value_x3, value_x4], [value_y1, value_y2, value_y3, value_y4], [value_z1, value_z2, value_z3, value_z4] ] ``` I find the array that ha...
2014/09/19
[ "https://Stackoverflow.com/questions/25943160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162811/" ]
Finding sub-array by its first element is a job of [`Array#assoc`](http://www.ruby-doc.org/core-2.1.2/Array.html#method-i-assoc) method. Increasing value of following elements is a straightforward task. Possible implementation: ``` array = [ ['abc', 4, 5], ['xyz', 2, 10], ['ubf', 40, 9] ] x = 'abc' marr = array.assoc...
If you have an array but want it to behave in a special way, you may want to think about creating a class. ``` class EGC < Array def increment(val) self.map do |sub| if sub.first == val [val, sub[1..-1].map(&:next)].flatten else sub end end end end ``` Then you can do th...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
vii7b5 = (me),se,te,re => V7 without root tone VIIdim7 = (me),se,te,re,fa => Vb9 **me or mi** in brackets as it can be considered as dropped root tone of the dom7 respectively dom7b9. Critical point to decide which chord will better fit is the melody: if it contains the b9 (in F#,**A#,C#,E,G**) this would be **G** -...
I don't have much to add to other posts concerning the analysis, however I'd like to point another point. In some cases indeed either diminished and half-diminished chords might provide good harmonization of a melody, however they sound substantially different. If you play one or another randomly, due to mistakes, it m...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
In this case it's a "safe" substitution, because the pitches are within the key (`G# minor`) and have contextually appropriate functions within the key. `A#m7b5` and `A#dim7` differ only in the presence of `G#` or `G`, respectively, both of which are present in `G# minor`. (Technically `G` is `Fx`, but the distinction...
Taking Bm7-5 vs Bdim7 as examples. If you want to see the chords as working in the same roles as simpler more common chords in the key of A minor: * **Bm7-5** (alias B half-diminished alias Dm6/B) works roughly as a **substitute for Dm**, so it works as **Am's subdominant**. Bm7-5 contains all the notes of a Dm. * **B...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
In this case it's a "safe" substitution, because the pitches are within the key (`G# minor`) and have contextually appropriate functions within the key. `A#m7b5` and `A#dim7` differ only in the presence of `G#` or `G`, respectively, both of which are present in `G# minor`. (Technically `G` is `Fx`, but the distinction...
The basic triad (which is what usually gives the main "color" to the chord) is the same, and being a diminshed fifth it creates a lots of tension towards the next one - usually a half tone above, and usually the tonic. They *are* similar and often interchangeable. While they are not diatonic on both major and minor mo...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
> > Do m7b5 chords function the same as dim7 chords? > > > If talking about function, it seems better to not use jazz chord symbols and switch to using Roman numeral analysis (RNA.) The two chord types are *half-diminished seventh* and *diminished seventh*. The diminished seventh chord is easier to describe firs...
The basic triad (which is what usually gives the main "color" to the chord) is the same, and being a diminshed fifth it creates a lots of tension towards the next one - usually a half tone above, and usually the tonic. They *are* similar and often interchangeable. While they are not diatonic on both major and minor mo...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
I don't have much to add to other posts concerning the analysis, however I'd like to point another point. In some cases indeed either diminished and half-diminished chords might provide good harmonization of a melody, however they sound substantially different. If you play one or another randomly, due to mistakes, it m...
Do m7ba and Do dim7 are exactly the same chord: ``` Do m7b5 = Do dim7 Do (root) Mib (minor third) Solb (flat fifth) Sib (seventh) La# m7b5 = La# dim7 La# (root) Do (minor third) Mi (flat fifth) (perfect fifth would be Mi#) Sol# (seventh) (mjor seventh would be Sol##) ``` Anyway, it sounds weird to call A# ...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
> > Do m7b5 chords function the same as dim7 chords? > > > If talking about function, it seems better to not use jazz chord symbols and switch to using Roman numeral analysis (RNA.) The two chord types are *half-diminished seventh* and *diminished seventh*. The diminished seventh chord is easier to describe firs...
While m7♭5 chords and dim7 chords are fairly interchangeable as dominant-function chords (don't interchange them if the melody note is the 7th), the dim7 chord is a much better **pivot chord** between keys than the m7♭5 chord, as any given dim7 chord is an enharmonic re-spelling of 3 other dim7 chords, while a m7♭5 cho...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
While m7♭5 chords and dim7 chords are fairly interchangeable as dominant-function chords (don't interchange them if the melody note is the 7th), the dim7 chord is a much better **pivot chord** between keys than the m7♭5 chord, as any given dim7 chord is an enharmonic re-spelling of 3 other dim7 chords, while a m7♭5 cho...
Do m7ba and Do dim7 are exactly the same chord: ``` Do m7b5 = Do dim7 Do (root) Mib (minor third) Solb (flat fifth) Sib (seventh) La# m7b5 = La# dim7 La# (root) Do (minor third) Mi (flat fifth) (perfect fifth would be Mi#) Sol# (seventh) (mjor seventh would be Sol##) ``` Anyway, it sounds weird to call A# ...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
The basic triad (which is what usually gives the main "color" to the chord) is the same, and being a diminshed fifth it creates a lots of tension towards the next one - usually a half tone above, and usually the tonic. They *are* similar and often interchangeable. While they are not diatonic on both major and minor mo...
While m7♭5 chords and dim7 chords are fairly interchangeable as dominant-function chords (don't interchange them if the melody note is the 7th), the dim7 chord is a much better **pivot chord** between keys than the m7♭5 chord, as any given dim7 chord is an enharmonic re-spelling of 3 other dim7 chords, while a m7♭5 cho...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
The basic triad (which is what usually gives the main "color" to the chord) is the same, and being a diminshed fifth it creates a lots of tension towards the next one - usually a half tone above, and usually the tonic. They *are* similar and often interchangeable. While they are not diatonic on both major and minor mo...
I don't have much to add to other posts concerning the analysis, however I'd like to point another point. In some cases indeed either diminished and half-diminished chords might provide good harmonization of a melody, however they sound substantially different. If you play one or another randomly, due to mistakes, it m...
110,430
In a song I am learning, there is a section of the song that has the chord progression G#m | A#m7b5 | B6 I sometimes get the fingerings wrong and use dimished 7th chords on guitar instead of m7b5 chords and in this case I actually think the dimished7th chord sounds good too. So I wanted to ask, what is the difference f...
2021/02/02
[ "https://music.stackexchange.com/questions/110430", "https://music.stackexchange.com", "https://music.stackexchange.com/users/35708/" ]
The tritone A♯ and E resolves nicely to B and D♯. Other notes in the chords are less important. That tritone is found in F♯7 (the standard dominant of B major). It's also found in A♯m7♭5 and in A♯dim7. (Also in C7, if we want to play with ♭5 substitutions.) So they'll all resolve in a nice functionally harmonic way to...
While m7♭5 chords and dim7 chords are fairly interchangeable as dominant-function chords (don't interchange them if the melody note is the 7th), the dim7 chord is a much better **pivot chord** between keys than the m7♭5 chord, as any given dim7 chord is an enharmonic re-spelling of 3 other dim7 chords, while a m7♭5 cho...
64,811,703
I'm coding MERN app and I'm almost done with it. However, I am having problems displaying a single customer page with data. My App.js ``` import React from 'react'; import { BrowserRouter as Router, Route } from "react-router-dom"; import CustomersList from "./components/customers-list"; import customerRewards from '...
2020/11/12
[ "https://Stackoverflow.com/questions/64811703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088949/" ]
Your piece of state, `customerRewards` is an array when it comes from the API. So even when you declare your initial state with an object `{}`, `customerRewards` is always going to be an array with one element in this case. Could be an issue in your API response - I'm not familiar with MongoDB Atlas or if it creates ac...
just select the element which name you want to get: ``` customerRewards[0].name ```
69,539,215
I am asking for help for an issue i've been trying to solve for hours and hours, in vain. I am working with google query() on google spreadsheets. So i have this kind of table (lets say A1:E3) | Client | Bank receipt | Start Date | End date | Value | | --- | --- | --- | --- | --- | | John | #1 | 14/10/2021 | 31/10/202...
2021/10/12
[ "https://Stackoverflow.com/questions/69539215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17133713/" ]
Try like this (in composition API you use ref or reactive instead data function, and you return your functions/reactive data): ``` <template> <div class="hamburger-toggle" @click="toggle" :class="{ nav__open: isActive }"> </template> <script> import { ref } from "@vue/reactivity"; export default { name: "navbar...
Also, it will work with a little less code: ``` <template> <div @click="isActive = !isActive"> ... </div> </template> <script setup> import { ref } from "vue"; const isActive = ref(true) </script> ``` you can read here about the [`<script setup>`](https://blog.vuejs.org/posts/vue-3.2.html)
38,015
Whenever I'm trying to close a file that has been changed, I get the save file dialog ![save file dialog](https://i.stack.imgur.com/tsjeG.png) I remember that the *Don't Save* button used to have focus, so I could press it using Spacebar, while pressing Enter would click on *Save*. But now on Lion, I'm unable to find...
2012/01/23
[ "https://apple.stackexchange.com/questions/38015", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/2288/" ]
Go to... 1. **System Preferences→Keyboard→Keyboard Shortcuts** 2. and select **All controls** under **Full Keyboard Access** * Now you can use `⇥` (tab) to switch between the dialog boxes. * **Note**: Unlike in Windows, you need to hit `space` to trigger a highlighted box that is not the default one! (If this is n...
On version 10.15.6, the previous answer didn't work as is. If you want to switch with Tab or "don't save" directly with the Space key, you'll need to go to **System Preferences** → **Keyboard** and toggle this option: [![printscreen of the toggled option](https://i.stack.imgur.com/TWiP0.png)](https://i.stack.imgur.co...
48,616
I have a simple product with custom options. After popup, I select custom options of this product, and click add to cart. I get params like that: `product=167&options%5B4%5D=10&qty=1`. Now I want to add product to cart programmatically, how can I do it?
2014/12/17
[ "https://magento.stackexchange.com/questions/48616", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/17279/" ]
please check the Mage\_Checkout\_CartController and addAction() inside, you will find everything you need ;) ``` $cart = $this->_getCart(); $params = $this->getRequest()->getParams(); try { if (isset($params['qty'])) { $filter = new Zend_Filter_LocalizedToNormalized( array...
Haven't tested the code below so might need some debugging but I guess it would be something like this ``` $productid = Mage::app()->getRequest()->getParam('product'); $qty = Mage::app()->getRequest()->getParam('qty'); $options = array(); foreach (Mage::app()->getRequest()->getParams() as $key => $value) { if (!str...
34,387
Can lower stages of current rockets be replaced to reusable and more efficient boosters with parachutes? Would reusable rocket stages save money?
2019/02/22
[ "https://space.stackexchange.com/questions/34387", "https://space.stackexchange.com", "https://space.stackexchange.com/users/18879/" ]
At [12 launches per year](https://spacenews.com/ariane-6-could-use-reusable-prometheus-engine-designer-says/), Arianespace does not see a business case for a reusable first stage. > > “We still have not understood, would we save money by reusing? At least with our launch rate?” he asked. “We hope to launch 12 times a...
Reusable first stages are already saving SpaceX money. Parachute recovery has the drawback that your stage is going to splash down in corrosive salt water, requiring some cleaning and refurbishment before it's ready to fly again. Falcon 9 style powered-landing boosters have to reserve a lot of fuel mass for landing ...
1,553,916
I have a N-dimensional vector, X and 'n' equidistant points along each dimension and a parameter 'delta'. I need a way to find the total of n^N vectors enclosed by the Hypercube defined with the vector X at the center and each side of Hypercube being of size 2\*delta. For example: Consider a case of N=3, so we have a...
2009/10/12
[ "https://Stackoverflow.com/questions/1553916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If i understand your problem correctly, you have an axis-aligned hypercube centred around a point X, and you have subdivided the interior of this hypercube into a regular lattice where the lattice points and spacing are in the coordinate system of the hypercube. All you have to do is let X = 0, find the vectors to each...
Ok, I didn't fully understand your question. There are total of `2^(N-1)*N` "lines" about a point in an N-dimensional hypercube. If you just want to create n points on lines which look like the axis, but translated at a distance of delta from the origin, here's some (poorly written, for clarity) MATLAB code: ``` n =...
17,176
What was the concept behind the staff that Loki used in the Avengers movie? It contained a blue crystal (presumably a part of the tesseract?) He uses it to put people like Hawkeye under a spell of sorts and also used it to blast stuff. I assumed that the tesseract could only be used as an energy source. It is evident...
2012/05/24
[ "https://scifi.stackexchange.com/questions/17176", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/2288/" ]
### Loki is an [Asgardian](https://scifi.stackexchange.com/a/16815/2765). In the Marvel Cinematic Universe, he is a member of a super-advanced race of beings that live on other planets far from Earth, but connected via technological tools. Loki's staff was believed to be one of those tools. **UPDATE:** It appears Loki...
The staff is a magic weapon from Asgard and the crystal he uses is different from the gems from the infinity gauntlet. It is the mind gem, not part of the tesseract.
33,094,033
I'm pretty sure I'm doing things the wrong way and I'd like to know the right way. The problem I face is: * I have a distributed batch job * I use AWS spot instances to fulfill it * always a one-off request (so I'm after simple solutions) * The instances need some configuration and setup, and they need to be sent tas...
2015/10/13
[ "https://Stackoverflow.com/questions/33094033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/617026/" ]
You could use [Ansible](http://www.ansible.com/) to do this reasonably simply. Your Ansible playbook would look something like: ``` - name: Stage instance(s) hosts: local connection: local gather_facts: false vars: keypair: mykeypair instance_type: m1.small security_group: sg-123456abc ...
couple of things to try / think about: 1) you should look into building an AMI with everything you need from the image + the hook that runs the boot time code. This should allow you to just boot up images with this AMI and not having to worry about building it 2) use an SQS queue to dispatch the tasks. this way the ...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
There are two logical ways of dealing with time travel paradoxes: * [**Stable time loop**](http://tvtropes.org/pmwiki/pmwiki.php/Main/StableTimeLoop). When you travel to the past, whatever you do, you won't actually change anything (which pretty much implies there is no free will). In fiction, the way this is often d...
My belief is that the audience is guided towards the nonsensical belief that there are two dimensions of time - ordinary time, and "meta-time" - that is, that before "now" in "meta-time", the universe had such-and-such a history, but one second later in "meta-time", history was "changed", and the past became a differen...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
My belief is that the audience is guided towards the nonsensical belief that there are two dimensions of time - ordinary time, and "meta-time" - that is, that before "now" in "meta-time", the universe had such-and-such a history, but one second later in "meta-time", history was "changed", and the past became a differen...
If the time travel is branching, then it needs no explanation, but if it's linear, then I'd imagine it's because time travelling protected them? For example, and I hope this is not just in the CW show, the Reverse Flash, mortal enemy of the Flash (I hope you could've figured that one out on your own), is able to basica...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
My belief is that the audience is guided towards the nonsensical belief that there are two dimensions of time - ordinary time, and "meta-time" - that is, that before "now" in "meta-time", the universe had such-and-such a history, but one second later in "meta-time", history was "changed", and the past became a differen...
This is a variation of Flater's answer about the universe "preventing" the paradox. At first I was going to comment that it requires a sort of "God" or "Deus Ex Machina" to intervene on behalf of the plot. But think of it slightly differently: Quantum physics tells us that there is an inherent randomness in the univer...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
There are two logical ways of dealing with time travel paradoxes: * [**Stable time loop**](http://tvtropes.org/pmwiki/pmwiki.php/Main/StableTimeLoop). When you travel to the past, whatever you do, you won't actually change anything (which pretty much implies there is no free will). In fiction, the way this is often d...
The highest voted answer makes sense, but it seems to omit a third possibility, which happens to be the theory I subscribe to. There are many theories. I like this one the most because it makes sense (to me) and is consistent with how the (real world) universe tries to solve similar paradoxes, e.g. when two objects tr...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
There are two logical ways of dealing with time travel paradoxes: * [**Stable time loop**](http://tvtropes.org/pmwiki/pmwiki.php/Main/StableTimeLoop). When you travel to the past, whatever you do, you won't actually change anything (which pretty much implies there is no free will). In fiction, the way this is often d...
If the time travel is branching, then it needs no explanation, but if it's linear, then I'd imagine it's because time travelling protected them? For example, and I hope this is not just in the CW show, the Reverse Flash, mortal enemy of the Flash (I hope you could've figured that one out on your own), is able to basica...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
There are two logical ways of dealing with time travel paradoxes: * [**Stable time loop**](http://tvtropes.org/pmwiki/pmwiki.php/Main/StableTimeLoop). When you travel to the past, whatever you do, you won't actually change anything (which pretty much implies there is no free will). In fiction, the way this is often d...
This is a variation of Flater's answer about the universe "preventing" the paradox. At first I was going to comment that it requires a sort of "God" or "Deus Ex Machina" to intervene on behalf of the plot. But think of it slightly differently: Quantum physics tells us that there is an inherent randomness in the univer...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
The highest voted answer makes sense, but it seems to omit a third possibility, which happens to be the theory I subscribe to. There are many theories. I like this one the most because it makes sense (to me) and is consistent with how the (real world) universe tries to solve similar paradoxes, e.g. when two objects tr...
If the time travel is branching, then it needs no explanation, but if it's linear, then I'd imagine it's because time travelling protected them? For example, and I hope this is not just in the CW show, the Reverse Flash, mortal enemy of the Flash (I hope you could've figured that one out on your own), is able to basica...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
The highest voted answer makes sense, but it seems to omit a third possibility, which happens to be the theory I subscribe to. There are many theories. I like this one the most because it makes sense (to me) and is consistent with how the (real world) universe tries to solve similar paradoxes, e.g. when two objects tr...
This is a variation of Flater's answer about the universe "preventing" the paradox. At first I was going to comment that it requires a sort of "God" or "Deus Ex Machina" to intervene on behalf of the plot. But think of it slightly differently: Quantum physics tells us that there is an inherent randomness in the univer...
15,539
There are many movies and TV episodes in which a character "crosses his own timeline", sometimes even meeting his past or future self (e.g. *The Day of the Doctor*). Technically, I should say meeting his past self *and* meeting his future self, I suppose, since this is actually what happens. When they supposedly alter...
2013/12/01
[ "https://movies.stackexchange.com/questions/15539", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/729/" ]
This is a variation of Flater's answer about the universe "preventing" the paradox. At first I was going to comment that it requires a sort of "God" or "Deus Ex Machina" to intervene on behalf of the plot. But think of it slightly differently: Quantum physics tells us that there is an inherent randomness in the univer...
If the time travel is branching, then it needs no explanation, but if it's linear, then I'd imagine it's because time travelling protected them? For example, and I hope this is not just in the CW show, the Reverse Flash, mortal enemy of the Flash (I hope you could've figured that one out on your own), is able to basica...
37,876,455
I want to build an application that will receive user-defined Strings of unknown size and identify them as either being simple Strings or dates. What I want to do is to find a way to extract the date pattern of the String **without** knowing if the String that the program will receive will actually be a date. More pre...
2016/06/17
[ "https://Stackoverflow.com/questions/37876455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1860791/" ]
10s of thousands is not a huge amount. I would just try to parse it and catch exceptions: ``` private static final DateTimeFormatter FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd_HHmm"); public static boolean isValidDate(String input) { try { FMT.parse(input); return true; } catch (DateTimeParseException...
As the others have suggested, there is no way of implementing what I'm asking for. The application needs to know what are the patterns that is going to seek in the received String, ab initio; it cannot just magically guess that a String is a date without the prior knowledge of how a date is actually assembled. So, I wi...
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
"Minimize" is a really bad word to use when trying to consider the quality of your code. It's vague, and it can lead to undesirable outcomes, such as broken or unusable code. For example, is your goal to minimize the number of bytes used storing the source code on a hard drive? That might have been important when pape...
There are many ways to do this, depending on what you're going for. If you're stuck with Java, then probably look to Apache commons: ``` StringUtils.reverseDelimited(st, ' '); ``` Try using Scala if you can, which is nicer in so many ways: ``` st.split(" ").reverse.mkString(" ") ```
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
In your first approach you have the right idea of starting at the end of the String and working backwards. The issues you have are: * you should use StringBuilder instead of String concatenation.... * using a `temp` string which you add-to in reverse order, then reverse again in to the result is a slow approach .... b...
**Approach 1:** JDK provides `java.util.StringTokenizer` to do the split or tokenizing a given text. This API helps avoid going character by character. No external jar/libraries required. Tokenizing gives you each separated word as an array element that you could print in reverse. ``` import java.util.ArrayList; imp...
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
"Minimize" is a really bad word to use when trying to consider the quality of your code. It's vague, and it can lead to undesirable outcomes, such as broken or unusable code. For example, is your goal to minimize the number of bytes used storing the source code on a hard drive? That might have been important when pape...
In your first approach you have the right idea of starting at the end of the String and working backwards. The issues you have are: * you should use StringBuilder instead of String concatenation.... * using a `temp` string which you add-to in reverse order, then reverse again in to the result is a slow approach .... b...
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
Re-use existing code. --------------------- Libraries allow for maximum re-use. Use them! If you don't like libraries, try to re-use as much as Java offers. Look up documentation, examples, etc. * Splitting strings is java default `split()` * Reversing can be done with the excellent `Collections` class * Java8 has s...
Here is a clean approach to reverse a string by its parts: ``` public class Main { // ReverseParts: reverses a string by words as opposed to characters. public static String ReverseParts(String input, String splitBy, String joinBy) { StringBuilder built = new StringBuilder(); // Note: String....
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
In your first approach you have the right idea of starting at the end of the String and working backwards. The issues you have are: * you should use StringBuilder instead of String concatenation.... * using a `temp` string which you add-to in reverse order, then reverse again in to the result is a slow approach .... b...
Here is a clean approach to reverse a string by its parts: ``` public class Main { // ReverseParts: reverses a string by words as opposed to characters. public static String ReverseParts(String input, String splitBy, String joinBy) { StringBuilder built = new StringBuilder(); // Note: String....
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
There are many ways to do this, depending on what you're going for. If you're stuck with Java, then probably look to Apache commons: ``` StringUtils.reverseDelimited(st, ' '); ``` Try using Scala if you can, which is nicer in so many ways: ``` st.split(" ").reverse.mkString(" ") ```
Here is a clean approach to reverse a string by its parts: ``` public class Main { // ReverseParts: reverses a string by words as opposed to characters. public static String ReverseParts(String input, String splitBy, String joinBy) { StringBuilder built = new StringBuilder(); // Note: String....
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
Stuffing all your code into `main()` is bad practice. This functionality belongs in a function of its own. When doing multiple string concatenations, you really want to use a `StringBuilder`. If you don't, the compiler will make one for you anyway, *every time you concatenate two strings using +*. It's better to do it...
Here is a clean approach to reverse a string by its parts: ``` public class Main { // ReverseParts: reverses a string by words as opposed to characters. public static String ReverseParts(String input, String splitBy, String joinBy) { StringBuilder built = new StringBuilder(); // Note: String....
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
Here is a clean approach to reverse a string by its parts: ``` public class Main { // ReverseParts: reverses a string by words as opposed to characters. public static String ReverseParts(String input, String splitBy, String joinBy) { StringBuilder built = new StringBuilder(); // Note: String....
**Approach 1:** JDK provides `java.util.StringTokenizer` to do the split or tokenizing a given text. This API helps avoid going character by character. No external jar/libraries required. Tokenizing gives you each separated word as an array element that you could print in reverse. ``` import java.util.ArrayList; imp...
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
"Minimize" is a really bad word to use when trying to consider the quality of your code. It's vague, and it can lead to undesirable outcomes, such as broken or unusable code. For example, is your goal to minimize the number of bytes used storing the source code on a hard drive? That might have been important when pape...
Here is a clean approach to reverse a string by its parts: ``` public class Main { // ReverseParts: reverses a string by words as opposed to characters. public static String ReverseParts(String input, String splitBy, String joinBy) { StringBuilder built = new StringBuilder(); // Note: String....
37,364
I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current program. First approach: ``` class StringRev{ public static void main(String args[]){ String str = "He is the one"; ...
2013/12/14
[ "https://codereview.stackexchange.com/questions/37364", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/33463/" ]
In your first approach you have the right idea of starting at the end of the String and working backwards. The issues you have are: * you should use StringBuilder instead of String concatenation.... * using a `temp` string which you add-to in reverse order, then reverse again in to the result is a slow approach .... b...
Re-use existing code. --------------------- Libraries allow for maximum re-use. Use them! If you don't like libraries, try to re-use as much as Java offers. Look up documentation, examples, etc. * Splitting strings is java default `split()` * Reversing can be done with the excellent `Collections` class * Java8 has s...
50,941
In this sentence: 做乜唔叫埋我? What is the function of 埋? I understood this sentence to be: "why didn't you call me?" (perhaps to an outing or a party). What is the difference with the sentence "做乜唔叫我"? Insights please.
2022/04/12
[ "https://chinese.stackexchange.com/questions/50941", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/20355/" ]
1. [V + **埋**] = [**也** + V] = [V + **too**] Example: * 叫**埋**佢去 = **也**叫他去 = ask him to go **too** * 殺**埋**佢隻狗 = **也**殺了他的狗 = kill his dog **too** * 連你都打**埋** = 連你**也一起**打 = beat even you **too** 2. [V + 埋] = [V + 完] = [finish + V] Example: * 執**埋**啲手尾 = 辦**完**那些收尾工作 = **finish** those finishing work * 計**埋**條數就走...
做乜唔叫埋我? What is the function of 埋? First the sentence reads as:- 做乜 = why, (for what reason) 唔叫 = didn't call, (didn't include) 埋我? = me as well? The function of 埋 in this context of Cantonese speech is not "bury" but to mean "as well" So, 埋我 means "me as well" Of course in Cantonese 埋 also means "bury" in some ...
50,941
In this sentence: 做乜唔叫埋我? What is the function of 埋? I understood this sentence to be: "why didn't you call me?" (perhaps to an outing or a party). What is the difference with the sentence "做乜唔叫我"? Insights please.
2022/04/12
[ "https://chinese.stackexchange.com/questions/50941", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/20355/" ]
1. [V + **埋**] = [**也** + V] = [V + **too**] Example: * 叫**埋**佢去 = **也**叫他去 = ask him to go **too** * 殺**埋**佢隻狗 = **也**殺了他的狗 = kill his dog **too** * 連你都打**埋** = 連你**也一起**打 = beat even you **too** 2. [V + 埋] = [V + 完] = [finish + V] Example: * 執**埋**啲手尾 = 辦**完**那些收尾工作 = **finish** those finishing work * 計**埋**條數就走...
做乜唔叫我? => Why didn't (you) notify me? 做乜唔叫**埋**我? = 做乜唔預我? = 做乜唔邀請我? => Why didn't (you) **also** count me **in**? = Why was I kept out? = Why ain't I **also in**vited? In English, "**also** count (somebody) **in**" means "**in**vite (somebody) **too**", but "count (somebody)" alone has no such clear meaning. While ...
50,941
In this sentence: 做乜唔叫埋我? What is the function of 埋? I understood this sentence to be: "why didn't you call me?" (perhaps to an outing or a party). What is the difference with the sentence "做乜唔叫我"? Insights please.
2022/04/12
[ "https://chinese.stackexchange.com/questions/50941", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/20355/" ]
1. [V + **埋**] = [**也** + V] = [V + **too**] Example: * 叫**埋**佢去 = **也**叫他去 = ask him to go **too** * 殺**埋**佢隻狗 = **也**殺了他的狗 = kill his dog **too** * 連你都打**埋** = 連你**也一起**打 = beat even you **too** 2. [V + 埋] = [V + 完] = [finish + V] Example: * 執**埋**啲手尾 = 辦**完**那些收尾工作 = **finish** those finishing work * 計**埋**條數就走...
As verbal suffix, 埋 can function as a verb complement with a lexical meaning somewhat like "close, tight". In this case, it can be used together with an adverb of degree (such as 好,太) and 咗. For example: 1. 唔好企太埋。(Don't stand too close.) 2. 佢关埋咗度门。(He has closed the door (tightly).) In a sentence like 做乜唔叫埋我?, 埋 func...
50,941
In this sentence: 做乜唔叫埋我? What is the function of 埋? I understood this sentence to be: "why didn't you call me?" (perhaps to an outing or a party). What is the difference with the sentence "做乜唔叫我"? Insights please.
2022/04/12
[ "https://chinese.stackexchange.com/questions/50941", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/20355/" ]
做乜唔叫埋我? What is the function of 埋? First the sentence reads as:- 做乜 = why, (for what reason) 唔叫 = didn't call, (didn't include) 埋我? = me as well? The function of 埋 in this context of Cantonese speech is not "bury" but to mean "as well" So, 埋我 means "me as well" Of course in Cantonese 埋 also means "bury" in some ...
做乜唔叫我? => Why didn't (you) notify me? 做乜唔叫**埋**我? = 做乜唔預我? = 做乜唔邀請我? => Why didn't (you) **also** count me **in**? = Why was I kept out? = Why ain't I **also in**vited? In English, "**also** count (somebody) **in**" means "**in**vite (somebody) **too**", but "count (somebody)" alone has no such clear meaning. While ...
50,941
In this sentence: 做乜唔叫埋我? What is the function of 埋? I understood this sentence to be: "why didn't you call me?" (perhaps to an outing or a party). What is the difference with the sentence "做乜唔叫我"? Insights please.
2022/04/12
[ "https://chinese.stackexchange.com/questions/50941", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/20355/" ]
做乜唔叫埋我? What is the function of 埋? First the sentence reads as:- 做乜 = why, (for what reason) 唔叫 = didn't call, (didn't include) 埋我? = me as well? The function of 埋 in this context of Cantonese speech is not "bury" but to mean "as well" So, 埋我 means "me as well" Of course in Cantonese 埋 also means "bury" in some ...
As verbal suffix, 埋 can function as a verb complement with a lexical meaning somewhat like "close, tight". In this case, it can be used together with an adverb of degree (such as 好,太) and 咗. For example: 1. 唔好企太埋。(Don't stand too close.) 2. 佢关埋咗度门。(He has closed the door (tightly).) In a sentence like 做乜唔叫埋我?, 埋 func...
50,941
In this sentence: 做乜唔叫埋我? What is the function of 埋? I understood this sentence to be: "why didn't you call me?" (perhaps to an outing or a party). What is the difference with the sentence "做乜唔叫我"? Insights please.
2022/04/12
[ "https://chinese.stackexchange.com/questions/50941", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/20355/" ]
As verbal suffix, 埋 can function as a verb complement with a lexical meaning somewhat like "close, tight". In this case, it can be used together with an adverb of degree (such as 好,太) and 咗. For example: 1. 唔好企太埋。(Don't stand too close.) 2. 佢关埋咗度门。(He has closed the door (tightly).) In a sentence like 做乜唔叫埋我?, 埋 func...
做乜唔叫我? => Why didn't (you) notify me? 做乜唔叫**埋**我? = 做乜唔預我? = 做乜唔邀請我? => Why didn't (you) **also** count me **in**? = Why was I kept out? = Why ain't I **also in**vited? In English, "**also** count (somebody) **in**" means "**in**vite (somebody) **too**", but "count (somebody)" alone has no such clear meaning. While ...
5,060,583
I'm looking for something like flex/bison that works with C# code. I want to be able to provide some language descriptors and a parser should be generated.
2011/02/20
[ "https://Stackoverflow.com/questions/5060583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/616840/" ]
[ANTLR](http://www.antlr.org/) is a very common parser generator with output bindings for many languages (including c#), but it is LLR which might make it a little more cumbersome than flex/bison if that's what you are accustomed to.
I've had my best luck with ANTLR, it can generate C# code as well. Good Language design support as well with ANTLR Works, an IDE for designing and testing your grammars, and quite a few tutorials to explain the whole thing. Other option is the F# powerpack that has fsLex and fsYacc. Only brielfy poked at it, seems pow...
5,060,583
I'm looking for something like flex/bison that works with C# code. I want to be able to provide some language descriptors and a parser should be generated.
2011/02/20
[ "https://Stackoverflow.com/questions/5060583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/616840/" ]
There are several options. I've found Irony to be good. It's powerful, and it has a novel syntax utilizing C# operator overloads to convey the syntax of your grammars directly in C#. Irony - .NET Language Implementation Kit. <http://irony.codeplex.com/>
I've had my best luck with ANTLR, it can generate C# code as well. Good Language design support as well with ANTLR Works, an IDE for designing and testing your grammars, and quite a few tutorials to explain the whole thing. Other option is the F# powerpack that has fsLex and fsYacc. Only brielfy poked at it, seems pow...
74,284
Is the phrase "I'm glad it helped" grammatically correct? And if it is, does it express correctly that I am more than happy that I could help someone?
2012/07/12
[ "https://english.stackexchange.com/questions/74284", "https://english.stackexchange.com", "https://english.stackexchange.com/users/20713/" ]
"I'm glad it helped" is grammatically correct. But it doesn't mean that you're glad *you* helped, it means you're glad that something helped. It might, from context, be clear that it was something you said, did, or gave them. But "I'm glad it helped" alone doesn't say that. You can say "I'm glad I helped" or "I'm glad...
*I'm glad it helped* is certainly grammatical, and it expresses the meaning you indicate. There are variations including, for example, *I’m glad I was able to help*. More briefly, you can say *My pleasure*.
74,284
Is the phrase "I'm glad it helped" grammatically correct? And if it is, does it express correctly that I am more than happy that I could help someone?
2012/07/12
[ "https://english.stackexchange.com/questions/74284", "https://english.stackexchange.com", "https://english.stackexchange.com/users/20713/" ]
*I'm glad it helped* is certainly grammatical, and it expresses the meaning you indicate. There are variations including, for example, *I’m glad I was able to help*. More briefly, you can say *My pleasure*.
This is very much comprehensible and commonly used, but it is not grammatically correct as the word "that" has been omitted. I know that it's pedantic but don't tell the guy that his sentence is absolutely correct. Of course, I would definitely advise a foreigner in England to use this phrase as it is polite and idioma...
74,284
Is the phrase "I'm glad it helped" grammatically correct? And if it is, does it express correctly that I am more than happy that I could help someone?
2012/07/12
[ "https://english.stackexchange.com/questions/74284", "https://english.stackexchange.com", "https://english.stackexchange.com/users/20713/" ]
"I'm glad it helped" is grammatically correct. But it doesn't mean that you're glad *you* helped, it means you're glad that something helped. It might, from context, be clear that it was something you said, did, or gave them. But "I'm glad it helped" alone doesn't say that. You can say "I'm glad I helped" or "I'm glad...
This is very much comprehensible and commonly used, but it is not grammatically correct as the word "that" has been omitted. I know that it's pedantic but don't tell the guy that his sentence is absolutely correct. Of course, I would definitely advise a foreigner in England to use this phrase as it is polite and idioma...
278,574
How do you polymorph? What is the command or key I must use?
2016/08/01
[ "https://gaming.stackexchange.com/questions/278574", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/159680/" ]
You can't really polymorph at will. =================================== There are 6 different types of things that can polymorph you. * Stepping on a polymorph trap will turn you into a random monster (magic-resistance will block this) * The spell of polymorph, cast at you (at yourself or possibly by a monster, thoug...
Doppelganger corpses will polymorph you, as well. And, if you happen to be a lycan (werecreature), you will polymorph into that particular creature at random (often, inconveniently or worse) or you can quaff unholy water to change at will. Regardless of how you polymorph, changing back still takes an unspecified amount...
501,559
In a statistics textbook I saw that the linear simple regression model is defined as \begin{equation} Y = \alpha + \beta x + e \end{equation} where $x$ is a value of the independent variable, $Y$ is the response, $\alpha$ and $\beta$ are the parameters, and $e$ is a random error with a mean of 0. Then this textbook ta...
2020/12/19
[ "https://stats.stackexchange.com/questions/501559", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/243929/" ]
You are right\*, we are *estimating* parameters but not (realizations of) random variables. We would *predict* those instead. \*Except for the last bit where you say > > Then, given that the mean of $e$ is zero, $A+Bx$ is an estimator of $\alpha + \beta x + e$. > > > Note that $\alpha+\beta x+e$ is a random vari...
When we say $A$ is an estimator of $\alpha$ it means that $\mathbb{E}(A)=\alpha$. Since $A+Bx$ is a random variable(because of $\alpha$ and $\beta$) we can write: $$\mathbb{E}(A+Bx)=\mathbb{E}(A)+\mathbb{E}(Bx)+0=\mathbb{E}(A)+\mathbb{E}(B)x+\mathbb{E}(e)=\mathbb{E}(Y)$$ Hope it helps.
36,884,146
I have a sample dataset 'a' like this: ``` > a group marks upd class 1 T 2 up A 2 C 3 up <NA> 3 C 4 down B 4 T 5 up <NA> 5 T 6 down D 6 C 7 up <NA> 7 T 1 down <NA> 8 T 0 down G ``` Here for each group (T or C) there are re...
2016/04/26
[ "https://Stackoverflow.com/questions/36884146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6199075/" ]
Your `id.value` is not a HTML element. You are trying to get an access to `value` property of id variable... Something like this `"ename".value` Try this: ``` document.getElementById(id).value = 'VALUE'; ``` ```js function myFunction(id) { var x = parseInt(document.getElementById(id).value); if (!(x === par...
You are setting empty string in the value property of `id`. `id` is a `string`. Hence, it won't work you need to put an empty string somewhere in the document where the id attribute is equal to the function argument. you need to use : ``` document.getElementById(id).value = ""; ```
36,884,146
I have a sample dataset 'a' like this: ``` > a group marks upd class 1 T 2 up A 2 C 3 up <NA> 3 C 4 down B 4 T 5 up <NA> 5 T 6 down D 6 C 7 up <NA> 7 T 1 down <NA> 8 T 0 down G ``` Here for each group (T or C) there are re...
2016/04/26
[ "https://Stackoverflow.com/questions/36884146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6199075/" ]
Your `id.value` is not a HTML element. You are trying to get an access to `value` property of id variable... Something like this `"ename".value` Try this: ``` document.getElementById(id).value = 'VALUE'; ``` ```js function myFunction(id) { var x = parseInt(document.getElementById(id).value); if (!(x === par...
You cannot use `id.value` because the `id` passed in you function was a string. Since you already passed the `id` then maybe you can use: `document.getElementById(id).value = "";` **Answer Explained**
52,937,262
I keep on having this error > > ActionView::Template::Error (undefined method `each' for nil:NilClass): > > > Here's my show.html.erb ``` <% @bookings.each do |booking| %> <% if booking.checkin_on > Date.today %> <% if booking.status == "Confirmed" %> <li class="dashboard"> <%= cl_image_tag(booking.bed...
2018/10/22
[ "https://Stackoverflow.com/questions/52937262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10161978/" ]
You are not declairing the @bookings variable on your `show` method, which explains the crash. It appears you are declaring it as you wanted it on the first line of your `index` method. Just change where you declare it, and it shall be alright. Also, to avoid further headaches, you should refactor the `set_booking` me...
By convention in Rails controller actions (`index` and `show` in your case) render views with same names, in your case those might be `intex.html.erb` and `show.html.erb`. In your show method you define two variables: `@bed` and `@booking` and in your view (`show.html.erb`) you try to loop variable `@bookings` which yo...