qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
34,488,876 | From my eclipse project I've removed .class file for a particular class thinking eclipse will regenerate it for me if I build it again or run the project again.
But when I tried to run the program, It's showing class not found exception.
I'm wondering what's happening there? doesn't eclipse build .class files each ti... | 2015/12/28 | [
"https://Stackoverflow.com/questions/34488876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3709218/"
] | Compilation will happen either the next time the source file is modified, if you have it set to Build Automatically, or the next time you run. *Both* of these expect compiled source files to still have their .class files around. *Clean* the project from the `Project` menu to force it to recompile regardless. | Make sure that in the Project up-menu, the option "Build Automatically" is checked then just clean your project.
It should regenerate the .class file(s). |
34,488,876 | From my eclipse project I've removed .class file for a particular class thinking eclipse will regenerate it for me if I build it again or run the project again.
But when I tried to run the program, It's showing class not found exception.
I'm wondering what's happening there? doesn't eclipse build .class files each ti... | 2015/12/28 | [
"https://Stackoverflow.com/questions/34488876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3709218/"
] | Compilation will happen either the next time the source file is modified, if you have it set to Build Automatically, or the next time you run. *Both* of these expect compiled source files to still have their .class files around. *Clean* the project from the `Project` menu to force it to recompile regardless. | Check Your java file is in a source folder (right click project, properties, build path)
and you have automatic build turned on (Project menu -> Build automatically)
Also make sure your project compilation/build succeeds, otherwise Eclipse may not compile all the classes.
Check in the Problem windows if there is any ... |
34,488,876 | From my eclipse project I've removed .class file for a particular class thinking eclipse will regenerate it for me if I build it again or run the project again.
But when I tried to run the program, It's showing class not found exception.
I'm wondering what's happening there? doesn't eclipse build .class files each ti... | 2015/12/28 | [
"https://Stackoverflow.com/questions/34488876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3709218/"
] | Compilation will happen either the next time the source file is modified, if you have it set to Build Automatically, or the next time you run. *Both* of these expect compiled source files to still have their .class files around. *Clean* the project from the `Project` menu to force it to recompile regardless. | * Project menu
* Click "Clean"
* Select "clean all projects" or "Clean selected projects below" and
choose your project
* Check "Start a build immediately"
* Click "ok"
* Now run your program.
Also as suggested by other answers, enable "Build Automatically" in Projects Menu.
Hope it helps |
69,708,937 | I have a password `UICollectionViewCell` with a `UITextField` to enter the password. I want to have a button where the user can change the isSecureTextEntry property.
My Code
-------
```
private lazy var button: UIButton = {
let view = UIButton()
view.translatesAutoresizingMaskIntoConstraints = false
view... | 2021/10/25 | [
"https://Stackoverflow.com/questions/69708937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6738168/"
] | Here you go:
```
your_list = [['AIGSALPPMM', 'AVIVANVS'], ['DKEPBARCLA', 'DAVIDSNKC'], ['DAVKEMBDBL', 'DAVIDSNKC'], ['DAKEMJPMPB', '']]
new_list = [[val[0], val[0]] if val[-1]=='' else val for val in your_list]
new_list
```
Correct me if I misunderstood your question | Use a boolean mask to filter your rows:
```
df = pd.read_excel('check_counterparties.xlsx', sheet_name='counterparties_cdwu',
usecols=['A', 'B'], skiprows=4)
out = df[df['B'] == '']
```
Output:
```
# DataFrame format
>>> out
A B
3 DAKEMJPMPB
# List format
>>> out.to_dict(orient='... |
69,708,937 | I have a password `UICollectionViewCell` with a `UITextField` to enter the password. I want to have a button where the user can change the isSecureTextEntry property.
My Code
-------
```
private lazy var button: UIButton = {
let view = UIButton()
view.translatesAutoresizingMaskIntoConstraints = false
view... | 2021/10/25 | [
"https://Stackoverflow.com/questions/69708937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6738168/"
] | ```
main_arr = [['AIGSALPPMM', 'AVIVANVS'], ['DKEPBARCLA', 'DAVIDSNKC'], ['DAVKEMBDBL', 'DAVIDSNKC'], ['DAKEMJPMPB', '']]
for arr in main_arr:
if arr[1] == '':
print (arr)
``` | Use a boolean mask to filter your rows:
```
df = pd.read_excel('check_counterparties.xlsx', sheet_name='counterparties_cdwu',
usecols=['A', 'B'], skiprows=4)
out = df[df['B'] == '']
```
Output:
```
# DataFrame format
>>> out
A B
3 DAKEMJPMPB
# List format
>>> out.to_dict(orient='... |
69,708,937 | I have a password `UICollectionViewCell` with a `UITextField` to enter the password. I want to have a button where the user can change the isSecureTextEntry property.
My Code
-------
```
private lazy var button: UIButton = {
let view = UIButton()
view.translatesAutoresizingMaskIntoConstraints = false
view... | 2021/10/25 | [
"https://Stackoverflow.com/questions/69708937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6738168/"
] | Here you go:
```
your_list = [['AIGSALPPMM', 'AVIVANVS'], ['DKEPBARCLA', 'DAVIDSNKC'], ['DAVKEMBDBL', 'DAVIDSNKC'], ['DAKEMJPMPB', '']]
new_list = [[val[0], val[0]] if val[-1]=='' else val for val in your_list]
new_list
```
Correct me if I misunderstood your question | Use list comprehension:
```
lst = [['AIGSALPPMM', 'AVIVANVS'], ['DKEPBARCLA', 'DAVIDSNKC'], ['DAVKEMBDBL', 'DAVIDSNKC'], ['DAKEMJPMPB', '']]
>>> [sublist for sublist in lst if len(sublist[-1].strip())==0]
[['DAKEMJPMPB', '']]
``` |
69,708,937 | I have a password `UICollectionViewCell` with a `UITextField` to enter the password. I want to have a button where the user can change the isSecureTextEntry property.
My Code
-------
```
private lazy var button: UIButton = {
let view = UIButton()
view.translatesAutoresizingMaskIntoConstraints = false
view... | 2021/10/25 | [
"https://Stackoverflow.com/questions/69708937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6738168/"
] | ```
main_arr = [['AIGSALPPMM', 'AVIVANVS'], ['DKEPBARCLA', 'DAVIDSNKC'], ['DAVKEMBDBL', 'DAVIDSNKC'], ['DAKEMJPMPB', '']]
for arr in main_arr:
if arr[1] == '':
print (arr)
``` | Use list comprehension:
```
lst = [['AIGSALPPMM', 'AVIVANVS'], ['DKEPBARCLA', 'DAVIDSNKC'], ['DAVKEMBDBL', 'DAVIDSNKC'], ['DAKEMJPMPB', '']]
>>> [sublist for sublist in lst if len(sublist[-1].strip())==0]
[['DAKEMJPMPB', '']]
``` |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | You should avoid removing from a list in the middle. It will give you polynomial time complexity, and is a little tricky to get correct anyway. Removing items from a list while iterating over it will commonly cause you to skip items, as your list changes in size. However, it is possible to do it safely by iterating bac... | Try a list comprehension:
```
list1_set = set(list1)
list2[:] = [x for x in list2 if int(x) not in list1_set]
``` |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | If all `list2` items are unique, you can remove them in a reversed iteration:
```
for item in reversed(list2):
for number in list1:
if str(number) in item:
list2.remove(item)
break
print(list2)
#['0001', '0003', '0004', '0005']
``` | You can always use set intersection:
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
list1 = set(map(str, list1))
# {'6', '8', '9', '7'}
list2[:] = [x for x in list2 if not list1.intersection(x)]
print(list2)
```
Which Outputs:
```
['0001', '0003', '0004', '0005']
... |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | Try a list comprehension:
```
list1_set = set(list1)
list2[:] = [x for x in list2 if int(x) not in list1_set]
``` | You can try something like this
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
for i in list2:
if int(list(i)[-1:][0]) not in list1:
print(i)
```
output:
```
0001
0003
0004
0005
``` |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | You should avoid removing from a list in the middle. It will give you polynomial time complexity, and is a little tricky to get correct anyway. Removing items from a list while iterating over it will commonly cause you to skip items, as your list changes in size. However, it is possible to do it safely by iterating bac... | You can try something like this
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
for i in list2:
if int(list(i)[-1:][0]) not in list1:
print(i)
```
output:
```
0001
0003
0004
0005
``` |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | You should avoid removing from a list in the middle. It will give you polynomial time complexity, and is a little tricky to get correct anyway. Removing items from a list while iterating over it will commonly cause you to skip items, as your list changes in size. However, it is possible to do it safely by iterating bac... | You can always use set intersection:
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
list1 = set(map(str, list1))
# {'6', '8', '9', '7'}
list2[:] = [x for x in list2 if not list1.intersection(x)]
print(list2)
```
Which Outputs:
```
['0001', '0003', '0004', '0005']
... |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | You can use `re.findall`:
```
import re
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
new_list2 = filter(lambda x:int(re.findall('\d+(?=$)', x)[0]) not in list1, list2)
```
Output:
```
['0001', '0003', '0004', '0005']
``` | You can always use set intersection:
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
list1 = set(map(str, list1))
# {'6', '8', '9', '7'}
list2[:] = [x for x in list2 if not list1.intersection(x)]
print(list2)
```
Which Outputs:
```
['0001', '0003', '0004', '0005']
... |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | Try a list comprehension:
```
list1_set = set(list1)
list2[:] = [x for x in list2 if int(x) not in list1_set]
``` | You can always use set intersection:
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
list1 = set(map(str, list1))
# {'6', '8', '9', '7'}
list2[:] = [x for x in list2 if not list1.intersection(x)]
print(list2)
```
Which Outputs:
```
['0001', '0003', '0004', '0005']
... |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | You should avoid removing from a list in the middle. It will give you polynomial time complexity, and is a little tricky to get correct anyway. Removing items from a list while iterating over it will commonly cause you to skip items, as your list changes in size. However, it is possible to do it safely by iterating bac... | If all `list2` items are unique, you can remove them in a reversed iteration:
```
for item in reversed(list2):
for number in list1:
if str(number) in item:
list2.remove(item)
break
print(list2)
#['0001', '0003', '0004', '0005']
``` |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | You can use `re.findall`:
```
import re
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
new_list2 = filter(lambda x:int(re.findall('\d+(?=$)', x)[0]) not in list1, list2)
```
Output:
```
['0001', '0003', '0004', '0005']
``` | You can try something like this
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
for i in list2:
if int(list(i)[-1:][0]) not in list1:
print(i)
```
output:
```
0001
0003
0004
0005
``` |
48,432,737 | I wonder how can i iterate over a list2 and remove all ittems that contains one of the list1 ittems ?
```
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
```
and result will be :
```
list2=[ '0001', '0003', '0004', '0005']
```
i try somthing like :
```
list1 = [6,... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8700815/"
] | You should avoid removing from a list in the middle. It will give you polynomial time complexity, and is a little tricky to get correct anyway. Removing items from a list while iterating over it will commonly cause you to skip items, as your list changes in size. However, it is possible to do it safely by iterating bac... | You can use `re.findall`:
```
import re
list1 = [6, 7, 8, 9]
list2=['0009', '0001', '0008', '0003', '0004', '0005', '0006', '0007']
new_list2 = filter(lambda x:int(re.findall('\d+(?=$)', x)[0]) not in list1, list2)
```
Output:
```
['0001', '0003', '0004', '0005']
``` |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In the case where you are ignoring the first character, you only want to compare `word.length() - 1` characters -- and the same length for both the string and the word.
Note that you really don't need to test the case where the first letter exactly matches as that is a subset of the case where you are ignoring the fir... | Try using:
```
if (str.length() > 0 && str.substring(1).startsWith(word.substring(1))) {
```
for the conditional as it is much clearer. Also, tvanfosson and Darth Eru are correct that the first conditional with the exact match on the first character is extraneous. |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your problem is in your second comparison (the general case). You are taking a substring of str to the end of str, and comparing it with a substring of word to the end of word. However, if str="hippo" and word="xip", "ippo" != "ip".
As an additional note, once you fix the second case, you won't really need the first c... | In the case where you are ignoring the first character, you only want to compare `word.length() - 1` characters -- and the same length for both the string and the word.
Note that you really don't need to test the case where the first letter exactly matches as that is a subset of the case where you are ignoring the fir... |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In the case where you are ignoring the first character, you only want to compare `word.length() - 1` characters -- and the same length for both the string and the word.
Note that you really don't need to test the case where the first letter exactly matches as that is a subset of the case where you are ignoring the fir... | Try Regex!
```
java.lang.String
boolean matches(String regex)
``` |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In the case where you are ignoring the first character, you only want to compare `word.length() - 1` characters -- and the same length for both the string and the word.
Note that you really don't need to test the case where the first letter exactly matches as that is a subset of the case where you are ignoring the fir... | Here's a starting point for you
```
import junit.framework.TestCase;
public class HippoTest extends TestCase {
public void testActualStart() throws Exception {
assertEquals("hi", startWord("hippo", "hi"));
}
public void testSimilarStart() throws Exception {
assertEquals("xip", startWord(... |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your problem in your second IF statement is that you are comparing the word to the entire substring. What you should compare it to (after checking their length of course) is:
```
str.substring(1,word.length()).equals(word.substring(1,word.length()))
``` | Try using:
```
if (str.length() > 0 && str.substring(1).startsWith(word.substring(1))) {
```
for the conditional as it is much clearer. Also, tvanfosson and Darth Eru are correct that the first conditional with the exact match on the first character is extraneous. |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your problem in your second IF statement is that you are comparing the word to the entire substring. What you should compare it to (after checking their length of course) is:
```
str.substring(1,word.length()).equals(word.substring(1,word.length()))
``` | Try Regex!
```
java.lang.String
boolean matches(String regex)
``` |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | you've got the right idea there... simply compare a substring of **str** from character 1 to **word.length** to a substring of **word** from character 1 to the end of word.
if they match return the substring of **str** to **word.length**. | Try Regex!
```
java.lang.String
boolean matches(String regex)
``` |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your problem is in your second comparison (the general case). You are taking a substring of str to the end of str, and comparing it with a substring of word to the end of word. However, if str="hippo" and word="xip", "ippo" != "ip".
As an additional note, once you fix the second case, you won't really need the first c... | Try Regex!
```
java.lang.String
boolean matches(String regex)
``` |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In the case where you are ignoring the first character, you only want to compare `word.length() - 1` characters -- and the same length for both the string and the word.
Note that you really don't need to test the case where the first letter exactly matches as that is a subset of the case where you are ignoring the fir... | You could try using regular expressions, starting at the 2nd character, to see if there is a match. You could also do some sort of substring, as I see you have done.
For the boundary case of a 1 letter long string, just hard code it to return properly. |
1,034,726 | i posted the other day with practice questions i was getting stuck with and i am stuck again
Please firstly can i ask you dont post full solutions.
The question is from here
<http://www.javabat.com/prob/p141494>
and reads
Given a string and a second "word" string, we'll say that the word matches the string if it a... | 2009/06/23 | [
"https://Stackoverflow.com/questions/1034726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your problem is in your second comparison (the general case). You are taking a substring of str to the end of str, and comparing it with a substring of word to the end of word. However, if str="hippo" and word="xip", "ippo" != "ip".
As an additional note, once you fix the second case, you won't really need the first c... | Here's a starting point for you
```
import junit.framework.TestCase;
public class HippoTest extends TestCase {
public void testActualStart() throws Exception {
assertEquals("hi", startWord("hippo", "hi"));
}
public void testSimilarStart() throws Exception {
assertEquals("xip", startWord(... |
12,684,960 | I'm trying to get a switch to return true or false, but I seem to be failing somewhere. I keep getting false. I'm totally lost. This should have worked actually. How do I get this right?
```
if (validNum(1))
{echo 'Ok';}else{echo 'Fail';}
function validNum($x)
{
switch ($x)
{
case 1:
echo "Number 1";
break;
ret... | 2012/10/02 | [
"https://Stackoverflow.com/questions/12684960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407503/"
] | The whole point of `break` is that it jumps out of the `case`. You're never reaching your `return` statements. You never need to both `return` *and* `break` from within a case. | You're putting a `break` in front of your `return`. It will never hit the `return`. |
12,684,960 | I'm trying to get a switch to return true or false, but I seem to be failing somewhere. I keep getting false. I'm totally lost. This should have worked actually. How do I get this right?
```
if (validNum(1))
{echo 'Ok';}else{echo 'Fail';}
function validNum($x)
{
switch ($x)
{
case 1:
echo "Number 1";
break;
ret... | 2012/10/02 | [
"https://Stackoverflow.com/questions/12684960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407503/"
] | I would rewrite it to below. It merges three cases together and avoids using a `break` statement that would otherwise go past your `switch`. Basically, with `return` you don't need `break`.
```
switch ($x)
{
case 1:
case 2:
case 3:
echo "Number $x";
return true;
default:
echo "No number between 1... | The whole point of `break` is that it jumps out of the `case`. You're never reaching your `return` statements. You never need to both `return` *and* `break` from within a case. |
12,684,960 | I'm trying to get a switch to return true or false, but I seem to be failing somewhere. I keep getting false. I'm totally lost. This should have worked actually. How do I get this right?
```
if (validNum(1))
{echo 'Ok';}else{echo 'Fail';}
function validNum($x)
{
switch ($x)
{
case 1:
echo "Number 1";
break;
ret... | 2012/10/02 | [
"https://Stackoverflow.com/questions/12684960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407503/"
] | I would rewrite it to below. It merges three cases together and avoids using a `break` statement that would otherwise go past your `switch`. Basically, with `return` you don't need `break`.
```
switch ($x)
{
case 1:
case 2:
case 3:
echo "Number $x";
return true;
default:
echo "No number between 1... | You're putting a `break` in front of your `return`. It will never hit the `return`. |
2,596,177 | >
> What is the simplest accurate approximation of $\sin^{-1}x$ using a (polynomial) function of $x$ and $\sqrt{1-x^2}$?
>
>
>
The most well-known definition in this subject is Euler's formula:
$$\sin^{-1}x=-i\ln\left(\sqrt{1-x^2}+ix\right) \tag{1}$$
I'm looking for a bivariate polynomial approximation
$$\sin... | 2018/01/07 | [
"https://math.stackexchange.com/questions/2596177",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | To express $\theta\in[0,\frac{\pi}{2}]$ as a polynomial of $\sin\theta$ and $\cos\theta$, consider
$$\theta\approx a\_0+\sum\_{n=1}^N(a\_n\cos n\theta+b\_n\sin n\theta),\quad\theta\in[0,\frac{\pi}{2}].$$
The fitting problem becomes linear this way. However, there is no requirement on the value of the right-hand side ... | From the classic
"Approximations for Digital Computers"
by Hastings,
published in 1955:
$\arcsin(x)
=\dfrac{\pi}{2}-\sqrt{1-x}f\_n(x)
$
where
$f\_n(x)
=\sum\_{k=0}^n a\_{n, k}x^k
$
are polynomials of degree $n$
for $n=3$ to $7$.
The simplest is
$f\_{3}(x)$
for which
$a\_{3, 0..3}
=1.5707288,
-.2121144,
.0742610,
-0.1... |
39,140 | I play acoustic guitar in a band with drums, electric bass, and electric guitar. I'm often told that I need to switch to electric because nobody can hear my guitar However, I like the sound of acoustic on pretty much all of our songs.
My current setup is an acoustic/electric into a Fishman Loudbox Mini, with a line ou... | 2015/11/05 | [
"https://music.stackexchange.com/questions/39140",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/12245/"
] | In a lot of mixes, it's normal and even intentional for the acoustic guitar(s) to get hidden behind the electric guitars and other instruments during the loud parts. If you listen to the Led Zeppelin songs that have both acoustic and electric guitars, it can sound like the acoustic track is muted during the "loud" part... | Agreed - a well played acoustic guitar often sounds better for rhythm in a band situation. If it's being DI'd from your little amp into the P.A., then it should come through the mix properly. If your mixer guy is doing it right, he should be able to remix for the louder numbers. It may just be that it's the Freddie Gre... |
39,140 | I play acoustic guitar in a band with drums, electric bass, and electric guitar. I'm often told that I need to switch to electric because nobody can hear my guitar However, I like the sound of acoustic on pretty much all of our songs.
My current setup is an acoustic/electric into a Fishman Loudbox Mini, with a line ou... | 2015/11/05 | [
"https://music.stackexchange.com/questions/39140",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/12245/"
] | I also play a Taylor Acoustic (614CE) in a band with electric guitar and electric bass and drums. I also play in an acoustic duo and play at open mics with other musicians with all sorts of instrumentation in the impromptu bands we form, and I play solo acoustic. So I would like to share what I have learned from person... | Agreed - a well played acoustic guitar often sounds better for rhythm in a band situation. If it's being DI'd from your little amp into the P.A., then it should come through the mix properly. If your mixer guy is doing it right, he should be able to remix for the louder numbers. It may just be that it's the Freddie Gre... |
39,140 | I play acoustic guitar in a band with drums, electric bass, and electric guitar. I'm often told that I need to switch to electric because nobody can hear my guitar However, I like the sound of acoustic on pretty much all of our songs.
My current setup is an acoustic/electric into a Fishman Loudbox Mini, with a line ou... | 2015/11/05 | [
"https://music.stackexchange.com/questions/39140",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/12245/"
] | I also play a Taylor Acoustic (614CE) in a band with electric guitar and electric bass and drums. I also play in an acoustic duo and play at open mics with other musicians with all sorts of instrumentation in the impromptu bands we form, and I play solo acoustic. So I would like to share what I have learned from person... | In a lot of mixes, it's normal and even intentional for the acoustic guitar(s) to get hidden behind the electric guitars and other instruments during the loud parts. If you listen to the Led Zeppelin songs that have both acoustic and electric guitars, it can sound like the acoustic track is muted during the "loud" part... |
46,278,853 | I have been going through a tutorial on Spring boot and there I learnt how to stop jackson from converting dates to **timestamp**. eg :
```
{"birthDate":1505736233603} //before
{"birthDate":"2017-09-18T12:04:27.345+0000"}//after
```
by writing
```
spring.jackson.serialization.write-dates-as-timestamps=false
```
... | 2017/09/18 | [
"https://Stackoverflow.com/questions/46278853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4960619/"
] | You'll have to configure the Spring Bean in charge of creating the JSON your service is returning.
First off, you need to define the Jackson Object Mapper Bean that your converter will use to create the JSON:
```
<bean class="com.fasterxml.jackson.databind.ObjectMapper" id="objectMapper">
<property name="dateForm... | if you have access to the ObjectMapper, you can also set it as a property programmatically
```
ObjectMapper mapper = new ObjectMapper();
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.setDateFormat(new ISO8601DateFormat());
``` |
46,278,853 | I have been going through a tutorial on Spring boot and there I learnt how to stop jackson from converting dates to **timestamp**. eg :
```
{"birthDate":1505736233603} //before
{"birthDate":"2017-09-18T12:04:27.345+0000"}//after
```
by writing
```
spring.jackson.serialization.write-dates-as-timestamps=false
```
... | 2017/09/18 | [
"https://Stackoverflow.com/questions/46278853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4960619/"
] | You'll have to configure the Spring Bean in charge of creating the JSON your service is returning.
First off, you need to define the Jackson Object Mapper Bean that your converter will use to create the JSON:
```
<bean class="com.fasterxml.jackson.databind.ObjectMapper" id="objectMapper">
<property name="dateForm... | Another way is to configure the `MessageConverter` after they have been populated/configured by the framework:
```java
@EnableWebMvc
@Configuration
public class AppConfiguration implements WebMvcConfigurer {
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
for (... |
46,278,853 | I have been going through a tutorial on Spring boot and there I learnt how to stop jackson from converting dates to **timestamp**. eg :
```
{"birthDate":1505736233603} //before
{"birthDate":"2017-09-18T12:04:27.345+0000"}//after
```
by writing
```
spring.jackson.serialization.write-dates-as-timestamps=false
```
... | 2017/09/18 | [
"https://Stackoverflow.com/questions/46278853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4960619/"
] | Another way is to configure the `MessageConverter` after they have been populated/configured by the framework:
```java
@EnableWebMvc
@Configuration
public class AppConfiguration implements WebMvcConfigurer {
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
for (... | if you have access to the ObjectMapper, you can also set it as a property programmatically
```
ObjectMapper mapper = new ObjectMapper();
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.setDateFormat(new ISO8601DateFormat());
``` |
350,100 | I have a new install of Debian 8 ("Jessie") and want to install the `firewalld` package, but APT can't find it. This may be related to the fact that I didn't specify a mirror during installation, but as far as I can tell, I've made the appropriate configurations.
`firewalld` is located on the mirror here:
`http://ftp... | 2017/03/08 | [
"https://unix.stackexchange.com/questions/350100",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/219868/"
] | You need to have the full Jessie repository in your `sources.list`; you should have at least
```
deb http://ftp.us.debian.org/debian jessie main
deb http://ftp.us.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main
```
(you can add `contrib` if you want, and the corresponding `de... | "Installing firewalld package on Debian 8 (Jessie) is as easy as running the following command on terminal:"
>
> sudo apt-get update
>
>
> sudo apt-get install firewalld
>
>
>
From <https://www.howtoinstall.co/en/debian/jessie/firewalld> |
65,492,839 | I am attempting to deploy a resource with Terraform using an ARM template. I will give some simple sample code below that demonstrates the issue. I realize the code below is deploying a storage account and can be done in Terraform without an ARM template, but I am just providing a piece of simple code to demonstrate th... | 2020/12/29 | [
"https://Stackoverflow.com/questions/65492839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636887/"
] | It turns out this is actually an easy fix, if not an obvious one.
Apparently all parameters need to be defined as string and then use the ARM template conversion functions to convert to the correct type.
In the template.json, we would have this in the parameters section:
```
βsupportsHttpsTrafficOnlyβ: {
βtypeβ: β... | Per documentation: <https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax#data-types>
>
> When specifying boolean and integer values in your template, don't
> surround the value with quotation marks. Start and end string values
> with double quotation marks.
>
>
>
What you have ... |
35,102,011 | Can I change the pitch of the voice in AVSpeechSynthesizer or putting any effects on the output voice from it so it could sound differently? | 2016/01/30 | [
"https://Stackoverflow.com/questions/35102011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Yes, you can change the **pitch** and the **rate** of the spoken sentence.
The `AVSpeechUtterance` class has two relevant properties:
* `pitchMultiplier: Float` (value between **0.5** (lowest pitch) to **2.0** (highest pitch)). The default pitch is **1.0**.
* `rate: Float` (value between two constants: `AVSpeechUtter... | The default pitch is 0.5.
AVSpeechUtteranceMinimumSpeechRate is 0.0
AVSpeechUtteranceMaximumSpeechRate is 1.0 (the highest rate of speech).
```
AVSpeechSynthesizer *synthesizer= [[AVSpeechSynthesizer alloc]init];
synthesizer.delegate=self;
AVSpeechUtterance *utterances =
[AVSpeechUtterance speechUtteranceWithString... |
41,421,670 | I am using a subtitle cell in a UITableView. I have set the following in `viewDidLoad` to make the row height automatically expand:
```
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 100
```
I have also set the title and subtitle of the cell to word wrap:
```
cell.tex... | 2017/01/02 | [
"https://Stackoverflow.com/questions/41421670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1767270/"
] | By using this code from <https://stackoverflow.com/a/40168001/4045472> and define the cell as:
```
class MyTableViewCell: UITableViewCell {
override func systemLayoutSizeFitting(_ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority: UILayoutPriority, verticalFittingPriority: UILayoutPriori... | You need to set constraints so that the cell can size automatically based on the size of the label. Here is a tutorial on dynamic cells. <https://www.raywenderlich.com/129059/self-sizing-table-view-cells> |
41,421,670 | I am using a subtitle cell in a UITableView. I have set the following in `viewDidLoad` to make the row height automatically expand:
```
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 100
```
I have also set the title and subtitle of the cell to word wrap:
```
cell.tex... | 2017/01/02 | [
"https://Stackoverflow.com/questions/41421670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1767270/"
] | You should take one lable and give constrain like that,
[](https://i.stack.imgur.com/MXvbd.png)
After that, write this two delegate method of tableview.
```
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGF... | You need to set constraints so that the cell can size automatically based on the size of the label. Here is a tutorial on dynamic cells. <https://www.raywenderlich.com/129059/self-sizing-table-view-cells> |
71,503,416 | It should be ok to add all the variables as global inside the function? All the other functions will receive them? I did a short test and it should work. Should I need to add Get-Variable -ValueOnly...?
```
$ReleaseVersion = ($Versions | where {$_.VersionNumber -eq $VersionToUse}).ReleaseVersion
$Sourceversion = ($Ver... | 2022/03/16 | [
"https://Stackoverflow.com/questions/71503416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18253602/"
] | Edit: Totally Changed this answer to include latest information
User of the script will now see versions to select and then enter version number to be used. your four variables are then filled with the relevant data.
```
$SharedDriveFolderPath= "\\Test\xxx" # This is just for me to test - you have your own data somew... | You could store and choose it that way with a hashtable:
```
$myVars = @{}
$myVars.Version2000 = @{"Path"="c:\";"Title"="MySensitiveData"}
$myVars.Version2000.Path
$myVars.Version2000.Title
```
it could then look like
```
PS C:\> $myVars = @{}
PS C:\> $myVars.Version2000 = @{
>> "Path"="c:\Prog2000"
>> "Title"="MyS... |
27,512,122 | I have a TextBoxFor that is set to read only and it currently holds a person's last name. What I now need to do is add to it so that the person's suffix (II, III, Sr., Jr., etc) shows in the text box next to their last name.
This is what I have so far with just the last name. I can't figure out how to add the suffix po... | 2014/12/16 | [
"https://Stackoverflow.com/questions/27512122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3885497/"
] | One possibility to do this, if this will always be readonly, would be adding this to your model:
```
public string LastNameWithSuffix
{
get { return String.Format("{0} {1}", Person.LastName, Person.Suffix); }
}
```
Then you can just change your code in the textbox to reference m.LastNameWithSuffix directly:
```... | I believe this may only be achieved through using a viewmodel. In your controller, instead of passing the original data model, you would pass the viewmodel, (used in your view) and one the entities of the viewmodel would contain the combination.
```
public class ViewModel
{
public string LastName {get; set;}
public s... |
22,001,200 | I'm starting to use IntelliJ IDEA 13 Ultimate Edition and was wonder if it had a searchable tabular view of maven dependencies for a project like Eclipse does.
For example, in Eclipse I can check my project's maven dependencies by going to its pom and then clicking on the "Dependencies Hierarchy" tab. From there, I can... | 2014/02/24 | [
"https://Stackoverflow.com/questions/22001200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/623941/"
] | Try [Maven Helper plugin](http://plugins.jetbrains.com/plugin/7179?pr=idea_ce): once you install it, every POM file gets a tab for "Dependency Analyzer" which also includes a search bar.
If you need something more, report an issue. But it should be easy to implement it yourself and send a pull request. | Firstly, you have the maven plugin enabled, and you can build your project in IntelliJ via the `Maven Projects` pane (top right) ?
Now, you can see all your maven dependencies in a *linear* list in the `Project` pane (top left), underneath your source code. You can also type a search-string (e.g. "apache" will highlig... |
7,427,564 | So far i have created a search box, which searches the primary key of my database.
How can i modify my php query to search multiple values in my database.
eg: If i search the name of the car instead of the VIN (primary key) it will show all the results matching the search value.
This
```
$query = ("SELECT * ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7427564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946094/"
] | Have you tried something like `$query = ("SELECT * FROM cars WHERE VIN='$VIN' OR name LIKE '%$VIN%'");`?
"LIKE" uses % as wildcard, so it will find all cars that have $VIN in their name.
But anyway make sure to `mysql_real_escape_string()` your parameter $VIN first, to prevent SQL injections! | Use the following query:
```
$query = ("SELECT * FROM cars WHERE Name LIKE '%$txtName%'");
```
**NOTE:**: Wildcard `%` is been used at the beginning and end to return all names having your search word anywhere in the field. |
7,427,564 | So far i have created a search box, which searches the primary key of my database.
How can i modify my php query to search multiple values in my database.
eg: If i search the name of the car instead of the VIN (primary key) it will show all the results matching the search value.
This
```
$query = ("SELECT * ... | 2011/09/15 | [
"https://Stackoverflow.com/questions/7427564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946094/"
] | Have you tried something like `$query = ("SELECT * FROM cars WHERE VIN='$VIN' OR name LIKE '%$VIN%'");`?
"LIKE" uses % as wildcard, so it will find all cars that have $VIN in their name.
But anyway make sure to `mysql_real_escape_string()` your parameter $VIN first, to prevent SQL injections! | something like this might work for you
```
$query = ("SELECT * FROM cars WHERE VIN='$VIN' OR CARS='$VIN'");
``` |
16,760,210 | I have been translating some shell code to MS-DOS Batch. In my code, I have the sample:
```
for %%i in (%*) do set "clargs=!clargs! %%i"
```
If I input the argument "-?" (without the quotation marks), it is not added to clargs. I assume it is because '?' is a wildcard character. Is there anything I can do to ensure ... | 2013/05/26 | [
"https://Stackoverflow.com/questions/16760210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2397924/"
] | You are correct, the wild card characters `*` and `?` are always expanded when used within a FOR IN() clause. Unfortunately, there is no way to prevent the wildcard expansion.
You cannot use a FOR loop to access all parameters if they contain wildcards. Instead, you should use a GOTO loop, along with the SHIFT command... | ```
@ECHO OFF
SETLOCAL
SET dummy=%*
FOR /f "tokens=1*delims==" %%f IN ('set dummy') DO CALL :addme %%g
ECHO %clargs%
GOTO :eof
:addme
IF "%~1"=="" GOTO :EOF
IF DEFINED clargs SET clargs=%clargs% %1
IF NOT DEFINED clargs SET clargs=%1
SHIFT
GOTO addme
```
I severly doubt you'll get a completely bullet-proof solution... |
66,026,657 | I'm following a video to code a fully responsive website, but I can't seem to be able to make the background video full screen like in the video, maybe I'm missing a line of code? You'll see on the screenshot a big white space at the bottom. I'll leave some code below, hopefully that'll help to find the issue. Many tha... | 2021/02/03 | [
"https://Stackoverflow.com/questions/66026657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14781362/"
] | Set the position: fix, along with top & left properties. this will ensure the entire background area is covered.
In your case this will be in the variable `VideoBg`
```css
video {
object-fit: cover;
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
}
```
source: <https://css-tricks.com/full... | try setting the height of your HeroBg to 100vh instead of 100%;
```
export const HeroBg = styled.div`
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100vh;
overflow: hidden;
`
``` |
2,760,326 | Let
$$y=\cos \phi+i\sin \phi \tag{1}$$
Differentiating both sides of equation (1) with respect to $\phi$, we get,
$$\begin{align}
\frac{dy}{d\phi} &=-\sin \phi+i\cos \phi \\
&=i(\cos \phi-\frac{1}{i}\sin \phi) \\
&=i(\cos\phi+i\sin \phi) \\
&=iy \\
\implies\frac{1}{y}dy &=i\;d\phi \tag{2}
\end{align}$$
Integrating... | 2018/04/30 | [
"https://math.stackexchange.com/questions/2760326",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/351620/"
] | Your proof is correct, but there are some hidden assumptions which your book has conveniently failed to mention.
In particular the key assumption is the definition of symbol $e^{iy} $ for $y\in\mathbb{R} $ or equivalently the definition of $\log z$ for $z\in\mathbb{C} $.
One approach is to define $e^z, z\in\mathbb{C}... | >
> Note that indefinite integrals defined algebraically deal with complex quantities. However, many elementary calculus textbooks write formulas such as
>
>
> $$\int \frac{dx}{x} = \ln{|x|} \:\:\:\:\:\:\:\:\:\:\:\:\:\:\: (4)$$
>
>
> (where the notation $x$ is used to indicate that $x$ is assumed to be a real numb... |
57,421 | I want to insert a 1\*12 table in Sketch 3 artboard. But I'm not able to find out how to insert it.
I've already read this [article](https://graphicdesign.stackexchange.com/questions/54819/sketch3-is-it-possible-to-create-a-text-table). But according to the answer, the plugin is used to distribute the items. I need a ... | 2015/08/03 | [
"https://graphicdesign.stackexchange.com/questions/57421",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/41130/"
] | As crazy as this sounds, you can use [Apple's spreadsheet app, Numbers](https://www.apple.com/mac/numbers/) to create a table that you can copy and paste into Sketch. I did this example really quick
**Basic workflow**
1. Create a table (do most of the design in here)
[), I saw a question on their meta... |
377 | The Drupal community traditionally clustered around Drupal.org. While surely there will be a community around drupal.stackexchange.com I am really curious on how can we channel these people back to drupal.org where they can contribute in the many ways drupal.org lets us: code reviews, handbook page, answering questions... | 2011/07/06 | [
"https://drupal.meta.stackexchange.com/questions/377",
"https://drupal.meta.stackexchange.com",
"https://drupal.meta.stackexchange.com/users/-1/"
] | IRC is something which we don't promote very much. While it isn't a direct link to D.org it is a hotline to the Drupal community. Perhaps we should mention it more. | I think that 'answering questions in the issue queues' is a real weakness in D.O. the redesign didn't address. There is still no email notification of answers happening. So I am guessing there is no notification of questions either, which makes it really difficult to use to get the answers; therefore, there is a migrat... |
377 | The Drupal community traditionally clustered around Drupal.org. While surely there will be a community around drupal.stackexchange.com I am really curious on how can we channel these people back to drupal.org where they can contribute in the many ways drupal.org lets us: code reviews, handbook page, answering questions... | 2011/07/06 | [
"https://drupal.meta.stackexchange.com/questions/377",
"https://drupal.meta.stackexchange.com",
"https://drupal.meta.stackexchange.com/users/-1/"
] | Actually there is something that can be done to channel people back to Drupal.org, but this is not actually possible in a beta site.
In other SE sites (e.g., Super User with [Community Promotion Ads - 1H 2011](https://meta.superuser.com/questions/2164/community-promotion-ads-1h-2011)), I saw a question on their meta... | I think that 'answering questions in the issue queues' is a real weakness in D.O. the redesign didn't address. There is still no email notification of answers happening. So I am guessing there is no notification of questions either, which makes it really difficult to use to get the answers; therefore, there is a migrat... |
54,111,389 | I'm creating a wp plugin for my website and I have a form on my website who have to put some value into my db. my problem is the data don't want to be put into my db.
I try to change my coding multiple time, and I debug the fonction (the data are recive by the fonction) but actually my code looks like this:
my front ... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54111389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10645178/"
] | One counting problem I see is happening is in your self-join of the `writtenby` table. There, you are not checking that the matching row has a *different* `author_id`. If the `author_id` be the same, then you should not be counting it. Also, what you should be counting for the number of shared authors is the second `wr... | With the help of Tim Biegeleisen and the sample data, I found that what was missing is the clause DISTINCT in the count
```
SELECT p.doi, p.year, COUNT(DISTINCT w2.author_id) AS cnt
FROM authors a
INNER JOIN writtenby w1
ON a.author_id = w1.author_id
INNER JOIN writtenby w2
ON w1.paper_id = w2.paper_id
INNER JOIN pa... |
5,807,750 | What are the best JQuery/Javascript controls for common use?
I am looking for the basics: Grid, Calendar, Datepicker, google-suggest-like textbox, etc...
Preferably themed with jQueryUI.
The main controls I am looking for are clientside alternatives to Telerik ASP.NET AJAX RadGrid, Scheduler and Editor, treeview cont... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5807750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/614695/"
] | Entity life-cycle callback methods @PrePersist, @PreUpdate can be used here to verify the field value NAN/-INF/+INF etc & then setting the default value accordingly.
```
//--
@PrePersist
@PreUpdate
private void resetField() {
if(field == Double.POSITIVE_INFINITY)
field = somePredefinedValu... | MySQL doesn't seem to support "infinity". [This article](http://www.ryannitz.org/tech-notes/2009/01/19/mysql-and-negative-infinity/) writes that:
>
> Storing and retrieving negative infinity in a MySQL database is accomplished by inserting an arbitrarily large negative number.
>
>
>
Same goes for positive. [Other... |
5,807,750 | What are the best JQuery/Javascript controls for common use?
I am looking for the basics: Grid, Calendar, Datepicker, google-suggest-like textbox, etc...
Preferably themed with jQueryUI.
The main controls I am looking for are clientside alternatives to Telerik ASP.NET AJAX RadGrid, Scheduler and Editor, treeview cont... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5807750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/614695/"
] | Entity life-cycle callback methods @PrePersist, @PreUpdate can be used here to verify the field value NAN/-INF/+INF etc & then setting the default value accordingly.
```
//--
@PrePersist
@PreUpdate
private void resetField() {
if(field == Double.POSITIVE_INFINITY)
field = somePredefinedValu... | I managed this problem by adding a varchar column to store the text representation of `Float.NaN`, `Float.POSITIVE_INFINITY` and `Float.NEGATIVE_INFINITY` while the original column will store `NULL`.
Then I use the setter and the getter to do manage those two columns.
In my @Entity class
```
/** The value I persist.... |
5,807,750 | What are the best JQuery/Javascript controls for common use?
I am looking for the basics: Grid, Calendar, Datepicker, google-suggest-like textbox, etc...
Preferably themed with jQueryUI.
The main controls I am looking for are clientside alternatives to Telerik ASP.NET AJAX RadGrid, Scheduler and Editor, treeview cont... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5807750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/614695/"
] | MySQL doesn't seem to support "infinity". [This article](http://www.ryannitz.org/tech-notes/2009/01/19/mysql-and-negative-infinity/) writes that:
>
> Storing and retrieving negative infinity in a MySQL database is accomplished by inserting an arbitrarily large negative number.
>
>
>
Same goes for positive. [Other... | I managed this problem by adding a varchar column to store the text representation of `Float.NaN`, `Float.POSITIVE_INFINITY` and `Float.NEGATIVE_INFINITY` while the original column will store `NULL`.
Then I use the setter and the getter to do manage those two columns.
In my @Entity class
```
/** The value I persist.... |
69,314,655 | I am using react-router-dom and according to docs it says for url pattern `https:\\example.com\user\:id\:gender`
we can use `useParams()` hook to read the patters like
```
import {useParams, Route} from react-router;
<Route exact path="/user/:id/:gender" component={User}/>
const user=(props)=>{
const params = usePar... | 2021/09/24 | [
"https://Stackoverflow.com/questions/69314655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9489351/"
] | I assume the code that does the `malloc` and calls `callback` doesn't know anything about the type of the object, only its size.
```
#include <stdlib.h>
void *alloc_and_init(size_t nmemb, size_t size, void (*callback)(void *))
{
void *b = calloc(nmemb, size);
if (b)
{
char *p = b;
for (siz... | ```
for( inherited *p = b, *e = p + count; p < e; p++ ){
callback(p);
}
``` |
69,314,655 | I am using react-router-dom and according to docs it says for url pattern `https:\\example.com\user\:id\:gender`
we can use `useParams()` hook to read the patters like
```
import {useParams, Route} from react-router;
<Route exact path="/user/:id/:gender" component={User}/>
const user=(props)=>{
const params = usePar... | 2021/09/24 | [
"https://Stackoverflow.com/questions/69314655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9489351/"
] | ```
for( inherited *p = b, *e = p + count; p < e; p++ ){
callback(p);
}
``` | Polymorphism in C is always rather clunky. Basically you have to construct a "vtable" manually. The naive, simplified version below lets each object have its own function pointer. You'll end up with something rather contrived like this:
```
#include <stdio.h>
#include <stdlib.h>
typedef struct base_t base_t;
typedef ... |
69,314,655 | I am using react-router-dom and according to docs it says for url pattern `https:\\example.com\user\:id\:gender`
we can use `useParams()` hook to read the patters like
```
import {useParams, Route} from react-router;
<Route exact path="/user/:id/:gender" component={User}/>
const user=(props)=>{
const params = usePar... | 2021/09/24 | [
"https://Stackoverflow.com/questions/69314655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9489351/"
] | I assume the code that does the `malloc` and calls `callback` doesn't know anything about the type of the object, only its size.
```
#include <stdlib.h>
void *alloc_and_init(size_t nmemb, size_t size, void (*callback)(void *))
{
void *b = calloc(nmemb, size);
if (b)
{
char *p = b;
for (siz... | Polymorphism in C is always rather clunky. Basically you have to construct a "vtable" manually. The naive, simplified version below lets each object have its own function pointer. You'll end up with something rather contrived like this:
```
#include <stdio.h>
#include <stdlib.h>
typedef struct base_t base_t;
typedef ... |
69,314,655 | I am using react-router-dom and according to docs it says for url pattern `https:\\example.com\user\:id\:gender`
we can use `useParams()` hook to read the patters like
```
import {useParams, Route} from react-router;
<Route exact path="/user/:id/:gender" component={User}/>
const user=(props)=>{
const params = usePar... | 2021/09/24 | [
"https://Stackoverflow.com/questions/69314655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9489351/"
] | I assume the code that does the `malloc` and calls `callback` doesn't know anything about the type of the object, only its size.
```
#include <stdlib.h>
void *alloc_and_init(size_t nmemb, size_t size, void (*callback)(void *))
{
void *b = calloc(nmemb, size);
if (b)
{
char *p = b;
for (siz... | ```
char *b = malloc(size * count);
for (int i = 0; i < count; i++){
// iterate based on known size & send to callback
callback( b + i * size );
}
``` |
69,314,655 | I am using react-router-dom and according to docs it says for url pattern `https:\\example.com\user\:id\:gender`
we can use `useParams()` hook to read the patters like
```
import {useParams, Route} from react-router;
<Route exact path="/user/:id/:gender" component={User}/>
const user=(props)=>{
const params = usePar... | 2021/09/24 | [
"https://Stackoverflow.com/questions/69314655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9489351/"
] | ```
char *b = malloc(size * count);
for (int i = 0; i < count; i++){
// iterate based on known size & send to callback
callback( b + i * size );
}
``` | Polymorphism in C is always rather clunky. Basically you have to construct a "vtable" manually. The naive, simplified version below lets each object have its own function pointer. You'll end up with something rather contrived like this:
```
#include <stdio.h>
#include <stdlib.h>
typedef struct base_t base_t;
typedef ... |
4,280,455 | Currently I am working on an embedded project. The client side is an 8bits MCU and the server side is computer.
As part of goal, I want to minimize the chance people copy our product. During the initialization phase, the server send its serial number to client and client do some simple calculation with its serial num... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4280455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/520592/"
] | Use a key pair. On initialization:
* Client tells server "I am online"
* Server encrypts a verification message, which only the client will be able to decode
* Client sends back the decrypted message
There should be no need for the server's key to be hardcoded - it can be generated based on a timestamp (only an answe... | Have the server send either a monotonically-increasing counter or a timestamp to the client, alongside the serial number. The client then includes that in the calculation it performs.
Because the server always sends a different request, the response will always be different (of course, if the market is lucrative enoug... |
4,280,455 | Currently I am working on an embedded project. The client side is an 8bits MCU and the server side is computer.
As part of goal, I want to minimize the chance people copy our product. During the initialization phase, the server send its serial number to client and client do some simple calculation with its serial num... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4280455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/520592/"
] | Use a key pair. On initialization:
* Client tells server "I am online"
* Server encrypts a verification message, which only the client will be able to decode
* Client sends back the decrypted message
There should be no need for the server's key to be hardcoded - it can be generated based on a timestamp (only an answe... | A different idea might be to require the 8 bit controller to send a CRC of the date, time and serial number to the server. The server can verify it is a unique serial and send a CRC with date, time and authorization code.
You might also look into the rolling code algorythms used for garage doors openers to see if they... |
56,450,254 | When I use this code I would like to turn to every element of array of structures like this:
```
array[0]->X;
array[1]->X;
```
I tried everything I could, but in all cases I've had Segmentation fault. What am I doing wrong?
Please look at blocks between #if 0 #endif
```
#include <stdio.h>
#include <stdlib.h>
#incl... | 2019/06/04 | [
"https://Stackoverflow.com/questions/56450254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7104681/"
] | If you do not mind creating one more dataframe for `mylist`, one way may be to use `merge`:
```
mylist_df = pd.DataFrame(mylist, columns=['RPN', 'npi']) # creating other df
df = df.merge(mylist_df, how='left', on='RPN')
df['npi'].fillna(df['RPN'], inplace=True) # fill na values with RPN of same dataframe
``` | `map` with a dict + `fillna` to replace unmapped values. Depending upon the shape of `mylist` choose the correct dictionary:
```
d = dict(zip(*mylist)) # if [[1, 2, 3], ['2000', '2000a', '2000b']]
d = dict(mylist) # if [[1, '2000'], [2, '2000a'], [3,'2000b']]
df['npi'] = df.RPN.map(d).fillna(df.RPN)
# RPN ... |
56,450,254 | When I use this code I would like to turn to every element of array of structures like this:
```
array[0]->X;
array[1]->X;
```
I tried everything I could, but in all cases I've had Segmentation fault. What am I doing wrong?
Please look at blocks between #if 0 #endif
```
#include <stdio.h>
#include <stdlib.h>
#incl... | 2019/06/04 | [
"https://Stackoverflow.com/questions/56450254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7104681/"
] | If you do not mind creating one more dataframe for `mylist`, one way may be to use `merge`:
```
mylist_df = pd.DataFrame(mylist, columns=['RPN', 'npi']) # creating other df
df = df.merge(mylist_df, how='left', on='RPN')
df['npi'].fillna(df['RPN'], inplace=True) # fill na values with RPN of same dataframe
``` | This can be viewed as a left join with a `fillna` operation afterwards.
```
my_series = pd.series(index=[1, 2, 3], data=['2000', '2000a', '2000b'], name='RPN')
df = pd.DataFrame({"RPN": [1, 1, 2, 4], "Source": ['netflix', 'netflix', 'hulu', 'hulu']}).set_index("RPN")
result = df.join(my_series, how="left").reset_ind... |
5,127,573 | In the eclipse directory, there is .classpath file. What's the purpose of this file?
I have ant build.xml available, why Eclipse still need its own? | 2011/02/26 | [
"https://Stackoverflow.com/questions/5127573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496949/"
] | Eclipse has its own mechanism for building your project. The .classpath file contains information that the IDE uses to create the classpath used at build-time, runtime etc. You can directly edit this file if you want but it is created by the IDE based on the settings that you provide via the project properties dialog.
... | The reason for this is that it doesn't matter if you have an Ant file or not. The reason for the presence of this file is that this is a Java Project, and the corresponding Project nature always generate such a file. Create a normal Project (New->Project->General->Project) and you'll see that there is no .classpath fil... |
588,069 | I am supporting a user that can't type and consequently often hits `AltGr` (on the right side of space-key). He has enough power to decide he wants to disable that key (instead of learning to type). and he asked me to quickly get rid of that key
The only way I found was using KbdEdit and map `AltGr` to "KANA" ([How to... | 2013/04/26 | [
"https://superuser.com/questions/588069",
"https://superuser.com",
"https://superuser.com/users/25225/"
] | I would recommend [SharpKeys](http://sharpkeys.codeplex.com):
>
> SharpKeys is a Registry hack that is used to make certain keys on a
> keyboard act like other keys. For example, if you accidentally hit
> Caps Lock often, you could use this utility to map Caps Lock to a
> Shift key or even turn it off completely. ... | Why not a hardware solution? Physically remove the key. |
588,069 | I am supporting a user that can't type and consequently often hits `AltGr` (on the right side of space-key). He has enough power to decide he wants to disable that key (instead of learning to type). and he asked me to quickly get rid of that key
The only way I found was using KbdEdit and map `AltGr` to "KANA" ([How to... | 2013/04/26 | [
"https://superuser.com/questions/588069",
"https://superuser.com",
"https://superuser.com/users/25225/"
] | I would recommend [SharpKeys](http://sharpkeys.codeplex.com):
>
> SharpKeys is a Registry hack that is used to make certain keys on a
> keyboard act like other keys. For example, if you accidentally hit
> Caps Lock often, you could use this utility to map Caps Lock to a
> Shift key or even turn it off completely. ... | If I understand you correctly, the problem is not pressing `AltGr`, but `AltGr` in combination with other keys?
You might want to get [The Microsoft Keyboard Layout Creator](http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx).
There you `Load existing Keyboard...` (from File-Menu), select the language and desig... |
588,069 | I am supporting a user that can't type and consequently often hits `AltGr` (on the right side of space-key). He has enough power to decide he wants to disable that key (instead of learning to type). and he asked me to quickly get rid of that key
The only way I found was using KbdEdit and map `AltGr` to "KANA" ([How to... | 2013/04/26 | [
"https://superuser.com/questions/588069",
"https://superuser.com",
"https://superuser.com/users/25225/"
] | I would recommend [SharpKeys](http://sharpkeys.codeplex.com):
>
> SharpKeys is a Registry hack that is used to make certain keys on a
> keyboard act like other keys. For example, if you accidentally hit
> Caps Lock often, you could use this utility to map Caps Lock to a
> Shift key or even turn it off completely. ... | Thanks guys. MS KLC was also an idea I considered, but as I only wanted to disable that simple key, it seemed too much work to create a separate layout etc.
I finally found "keytweak" (here: <http://webpages.charter.net/krumsick/> ) and that has an easy switch "disable key" which quickly fixed the problem. :) |
588,069 | I am supporting a user that can't type and consequently often hits `AltGr` (on the right side of space-key). He has enough power to decide he wants to disable that key (instead of learning to type). and he asked me to quickly get rid of that key
The only way I found was using KbdEdit and map `AltGr` to "KANA" ([How to... | 2013/04/26 | [
"https://superuser.com/questions/588069",
"https://superuser.com",
"https://superuser.com/users/25225/"
] | I would recommend [SharpKeys](http://sharpkeys.codeplex.com):
>
> SharpKeys is a Registry hack that is used to make certain keys on a
> keyboard act like other keys. For example, if you accidentally hit
> Caps Lock often, you could use this utility to map Caps Lock to a
> Shift key or even turn it off completely. ... | I'm using the [keymapper](https://code.google.com/p/keymapper/) program to accomplish this. It lets you remap and disable keyboard keys using a virtual keyboard. |
588,069 | I am supporting a user that can't type and consequently often hits `AltGr` (on the right side of space-key). He has enough power to decide he wants to disable that key (instead of learning to type). and he asked me to quickly get rid of that key
The only way I found was using KbdEdit and map `AltGr` to "KANA" ([How to... | 2013/04/26 | [
"https://superuser.com/questions/588069",
"https://superuser.com",
"https://superuser.com/users/25225/"
] | If I understand you correctly, the problem is not pressing `AltGr`, but `AltGr` in combination with other keys?
You might want to get [The Microsoft Keyboard Layout Creator](http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx).
There you `Load existing Keyboard...` (from File-Menu), select the language and desig... | Why not a hardware solution? Physically remove the key. |
588,069 | I am supporting a user that can't type and consequently often hits `AltGr` (on the right side of space-key). He has enough power to decide he wants to disable that key (instead of learning to type). and he asked me to quickly get rid of that key
The only way I found was using KbdEdit and map `AltGr` to "KANA" ([How to... | 2013/04/26 | [
"https://superuser.com/questions/588069",
"https://superuser.com",
"https://superuser.com/users/25225/"
] | If I understand you correctly, the problem is not pressing `AltGr`, but `AltGr` in combination with other keys?
You might want to get [The Microsoft Keyboard Layout Creator](http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx).
There you `Load existing Keyboard...` (from File-Menu), select the language and desig... | Thanks guys. MS KLC was also an idea I considered, but as I only wanted to disable that simple key, it seemed too much work to create a separate layout etc.
I finally found "keytweak" (here: <http://webpages.charter.net/krumsick/> ) and that has an easy switch "disable key" which quickly fixed the problem. :) |
588,069 | I am supporting a user that can't type and consequently often hits `AltGr` (on the right side of space-key). He has enough power to decide he wants to disable that key (instead of learning to type). and he asked me to quickly get rid of that key
The only way I found was using KbdEdit and map `AltGr` to "KANA" ([How to... | 2013/04/26 | [
"https://superuser.com/questions/588069",
"https://superuser.com",
"https://superuser.com/users/25225/"
] | If I understand you correctly, the problem is not pressing `AltGr`, but `AltGr` in combination with other keys?
You might want to get [The Microsoft Keyboard Layout Creator](http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx).
There you `Load existing Keyboard...` (from File-Menu), select the language and desig... | I'm using the [keymapper](https://code.google.com/p/keymapper/) program to accomplish this. It lets you remap and disable keyboard keys using a virtual keyboard. |
14,062,904 | I'm working on a low latency system and need a solution to convert a double number to byte array but with precision for decimal numbers. I need to consider there should be less object creation within the solution. Also, I'm getting value as double.
My current implementation is somewhat like
```
int offset = 0;
double... | 2012/12/27 | [
"https://Stackoverflow.com/questions/14062904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293768/"
] | ```
byte[] bytes = new byte[8];
java.nio.ByteBuffer.wrap(bytes).putDouble(yourDouble);
``` | If you really want low latency, then the important thing is to avoid heap memory allocations (which cause GC pauses at some unspecified later point).
So I'm assuming that:
* You have allocated your byte array in advance
* You want to put a double in your byte array without doing any intermediate allocations
The tric... |
14,062,904 | I'm working on a low latency system and need a solution to convert a double number to byte array but with precision for decimal numbers. I need to consider there should be less object creation within the solution. Also, I'm getting value as double.
My current implementation is somewhat like
```
int offset = 0;
double... | 2012/12/27 | [
"https://Stackoverflow.com/questions/14062904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293768/"
] | ```
byte[] bytes = new byte[8];
java.nio.ByteBuffer.wrap(bytes).putDouble(yourDouble);
``` | If you want a double formatted into an ASCII (character) string then String.format is probably the simplest approach that gives you control over the format:
```
String result = String.formatter("%5.3f", theDoubleValue);
``` |
14,062,904 | I'm working on a low latency system and need a solution to convert a double number to byte array but with precision for decimal numbers. I need to consider there should be less object creation within the solution. Also, I'm getting value as double.
My current implementation is somewhat like
```
int offset = 0;
double... | 2012/12/27 | [
"https://Stackoverflow.com/questions/14062904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293768/"
] | If you really want low latency, then the important thing is to avoid heap memory allocations (which cause GC pauses at some unspecified later point).
So I'm assuming that:
* You have allocated your byte array in advance
* You want to put a double in your byte array without doing any intermediate allocations
The tric... | If you want a double formatted into an ASCII (character) string then String.format is probably the simplest approach that gives you control over the format:
```
String result = String.formatter("%5.3f", theDoubleValue);
``` |
112,727 | I am trying to switch to a GameScreen when the LinearVelocity of a Box2D - Object is x = 0.
If it is so, I am using the setScreen() - Method by calling the main class. This works perfekt, but when the screen should change, it just flickers, which is most likely caused by the render() - method in the screen class.
So ... | 2015/12/09 | [
"https://gamedev.stackexchange.com/questions/112727",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/75877/"
] | The obvious answer to this question is to sit down and watch through the entire archive of [**Handmade Hero**](http://handmadehero.org).
It is *exactly* what you are after. It is literally a tutorial on how to make a game from scratch, without engines or libraries. Obviously it is very long. | Unless you want to spend a couple of years writing your own drivers, you'll need at least a graphics library. I'm all for making things from scratch and while that can be fun, making **EVERYTHING** from scratch is frustrating, annoying and pointless.
The logic behind using libraries like OpenGL is to avoid complicated... |
112,727 | I am trying to switch to a GameScreen when the LinearVelocity of a Box2D - Object is x = 0.
If it is so, I am using the setScreen() - Method by calling the main class. This works perfekt, but when the screen should change, it just flickers, which is most likely caused by the render() - method in the screen class.
So ... | 2015/12/09 | [
"https://gamedev.stackexchange.com/questions/112727",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/75877/"
] | The obvious answer to this question is to sit down and watch through the entire archive of [**Handmade Hero**](http://handmadehero.org).
It is *exactly* what you are after. It is literally a tutorial on how to make a game from scratch, without engines or libraries. Obviously it is very long. | **Sure you can!** Just, probably not very well on PC. You can pretty much forget about graphics card acceleration. To quote [Patrick Hughes' answer to another question](https://gamedev.stackexchange.com/a/16156/22026):
>
> [PC is like the] wild west, barroom brawls and your OS is the sheriff keeping everyone from get... |
33,022,749 | I'm trying to store some field of a form into database, using this code:
```
$data = $form->getData();
$em=$this->getDoctrine()->getManager();
$em=persist($data->getCompany());
$em->flush();
return $this->redirectToRoute('target_success');}
```
But I get following error:
```
Attempted to call function "persist" fro... | 2015/10/08 | [
"https://Stackoverflow.com/questions/33022749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2820116/"
] | `$em=persist ...` should be `$em->persist(...);`
Furthermore I wonder if it is going to work. Does `getCompany()` return an entity? | $em->persist() must have an instance of an entity object as its parameter. The persist operation tells Doctrine you want this entity to be written to database. You can't give an individual field to persist(), it writes the whole object. Also you appear to be trying to write a form back to the database. You need to pass... |
64,055,519 | I am making shopping app and I am listing user's cart in a recycler view then calculate total price inside `onBindViewHolder` but I have to scroll down to get price of all items.
can I make recycler view load all items at once or is there better solution to count total price?
by the way I tried putting the recycler vie... | 2020/09/24 | [
"https://Stackoverflow.com/questions/64055519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14337006/"
] | If you simply want to specify WHICH database to query, you can fully-qualify the reference to the `INFORMATION_SCHEMA.TABLES` view as follows:
```
select t.table_schema,
t.table_name
from DATABASE_NAME_TO_SEARCH.information_schema.tables t
inner join information_schema.columns c on
c.table_schema = t.t... | One option is to use the database `SNOWFLAKE.ACCOUNT_USAGE`:
```sql
select table_schema, table_name, column_name
from snowflake.account_usage.columns
where deleted is null
and column_name='RIP4'
```
Most users don't have access to it, so you might need to grant the privileges first:
```sql
use role accountadmin;
gr... |
64,055,519 | I am making shopping app and I am listing user's cart in a recycler view then calculate total price inside `onBindViewHolder` but I have to scroll down to get price of all items.
can I make recycler view load all items at once or is there better solution to count total price?
by the way I tried putting the recycler vie... | 2020/09/24 | [
"https://Stackoverflow.com/questions/64055519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14337006/"
] | One option is to use the database `SNOWFLAKE.ACCOUNT_USAGE`:
```sql
select table_schema, table_name, column_name
from snowflake.account_usage.columns
where deleted is null
and column_name='RIP4'
```
Most users don't have access to it, so you might need to grant the privileges first:
```sql
use role accountadmin;
gr... | An alternative way to get the tables that contain a specific column name is the following:
```
show columns like 'COLUMN_NAME' in schema "DB_NAME"."SCHEMA_NAME"
```
In the above example, we search for all tables under the database "DB\_NAME" and under the schema "SCHEMA\_NAME" that contain the column called "COLUMN\... |
64,055,519 | I am making shopping app and I am listing user's cart in a recycler view then calculate total price inside `onBindViewHolder` but I have to scroll down to get price of all items.
can I make recycler view load all items at once or is there better solution to count total price?
by the way I tried putting the recycler vie... | 2020/09/24 | [
"https://Stackoverflow.com/questions/64055519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14337006/"
] | If you simply want to specify WHICH database to query, you can fully-qualify the reference to the `INFORMATION_SCHEMA.TABLES` view as follows:
```
select t.table_schema,
t.table_name
from DATABASE_NAME_TO_SEARCH.information_schema.tables t
inner join information_schema.columns c on
c.table_schema = t.t... | An alternative way to get the tables that contain a specific column name is the following:
```
show columns like 'COLUMN_NAME' in schema "DB_NAME"."SCHEMA_NAME"
```
In the above example, we search for all tables under the database "DB\_NAME" and under the schema "SCHEMA\_NAME" that contain the column called "COLUMN\... |
91,779 | I had created the dropdown list with fields Lab,Pharmacy,Food and Nurse.When I select the lab it generates the new fields and when I select the pharmacy it generates the new field with upload button.I need to send the mail with these details for lab and pharmacy.
By using below mail function I can send only for lab bu... | 2015/11/27 | [
"https://magento.stackexchange.com/questions/91779",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/29354/"
] | try that for sending the email just change the `model` and `attachment` code
```
$mail = new Zend_Mail();
$mail->setFrom('admin@labwise.in',"Labwise");
$mail->addTo($cemail,$pname);
$mail->setSubject('Blood Donor');
$mail->setBodyHtml($html);
if(file_exists(Mage::getBaseDir('media').DS.'requestquote'.DS.$uploadfil... | This code is Working for me try this le me know if you have any query
```
$mailTemplate = Mage::getModel('core/email_template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
// file attached
if($post['file']){
$destination_path = Mage::getBaseD... |
91,779 | I had created the dropdown list with fields Lab,Pharmacy,Food and Nurse.When I select the lab it generates the new fields and when I select the pharmacy it generates the new field with upload button.I need to send the mail with these details for lab and pharmacy.
By using below mail function I can send only for lab bu... | 2015/11/27 | [
"https://magento.stackexchange.com/questions/91779",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/29354/"
] | this is tested code all email are working without any error.
```
<?php
if( !empty($_FILES["fileToUpload"]["name"]) and $_POST['servicetype']=='Pharmacy')
{
$image_ext = end(explode('.',$_FILES["fileToUpload"]["name"]));
$allowed_ext = array('gif','png' ,'jpg','jpeg','pdf','doc','d... | try that for sending the email just change the `model` and `attachment` code
```
$mail = new Zend_Mail();
$mail->setFrom('admin@labwise.in',"Labwise");
$mail->addTo($cemail,$pname);
$mail->setSubject('Blood Donor');
$mail->setBodyHtml($html);
if(file_exists(Mage::getBaseDir('media').DS.'requestquote'.DS.$uploadfil... |
91,779 | I had created the dropdown list with fields Lab,Pharmacy,Food and Nurse.When I select the lab it generates the new fields and when I select the pharmacy it generates the new field with upload button.I need to send the mail with these details for lab and pharmacy.
By using below mail function I can send only for lab bu... | 2015/11/27 | [
"https://magento.stackexchange.com/questions/91779",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/29354/"
] | this is tested code all email are working without any error.
```
<?php
if( !empty($_FILES["fileToUpload"]["name"]) and $_POST['servicetype']=='Pharmacy')
{
$image_ext = end(explode('.',$_FILES["fileToUpload"]["name"]));
$allowed_ext = array('gif','png' ,'jpg','jpeg','pdf','doc','d... | This code is Working for me try this le me know if you have any query
```
$mailTemplate = Mage::getModel('core/email_template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
// file attached
if($post['file']){
$destination_path = Mage::getBaseD... |
10,999,855 | I am using:
```
if (UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight)
{
viewofimage.frame = CGRectMake(130, 45, 220, 115);
share.frame = CGRectMake(205, 161, 70, 70);
invite.frame = CGRectMake(8, 161, 70, 70);
contact.frame = CGRectMake(402, 161, 70, 70);
invitation.frame... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10999855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/717452/"
] | This is due to [specificity](http://www.w3.org/TR/CSS21/cascade.html#specificity): although `a` is an element type selector which is less specific than a class selector, it's accompanied by a `:link` pseudo-class which is equally specific to your `.button` class. A type + pseudo-class will therefore be more specific th... | >
> A selector's specificity is calculated as follows:
>
> - count the number of ID selectors in the selector (= a)
>
> - count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)
>
> - count the number of type selectors and pseudo-elements in the selector (= c)
... |
413 | When viewing a single contact, I can select "Actions" Vcard and export a vcard which can then be used in other applications (Outlook, OwnCloud, etc)
I would like to be able to select "Create Vcard" in the drop down list for actions for search results, and get a vcard file of many contacts that could be imported into o... | 2015/04/09 | [
"https://civicrm.stackexchange.com/questions/413",
"https://civicrm.stackexchange.com",
"https://civicrm.stackexchange.com/users/275/"
] | This option does not exist (as yet).I'm not aware of an extension to do this either. Your options include:
a. Write an extension that adds the above functionality
b. Use the api to export the data into a program that can generate multiple vcards and use that | You can use the extension vcard-export. See <https://lab.civicrm.org/extensions/vcard-export> . |
66,793,543 | I'm trying to make a starboard code with my bot, and everything else is working good. But I'm trying to make it to where the bot ignores reactions from the author of the actual message.
This is my current code:
```js
client.on('messageReactionAdd', (reaction_orig, message, user) => {
if (message.author.id === react... | 2021/03/25 | [
"https://Stackoverflow.com/questions/66793543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14722081/"
] | The problem is that [`messageReactionAdd`](https://discord.js.org/#/docs/main/master/class/Client?scrollTo=e-messageReactionAdd) takes two parameters; the message reaction as the first one, and the user that applied the emoji as the second one. When you write `reaction_orig, message, user`, `reaction_orig` is the react... | Try doing this :
```js
client.on('messageReactionAdd', (reaction, user) => {
if (!reaction.message.author.id === user.id){
//Do whatever you like with it
console.log(reaction.name)
}
});
```
Note: The message must be cached. For that you'll need to do this
```js
Client.channels.cache.get("Ch... |
28,319 | One thing about German language bothers me since ever. As far as I know you still use "Sie" even if the context is disrespectful.
For example:
>
> "Sie sind ein Arschloch!" `("You are an asshole!")`
>
>
>
Isn't it a little bit silly to use the formal person to, for example, offend someone? Why is it still done? | 2016/02/22 | [
"https://german.stackexchange.com/questions/28319",
"https://german.stackexchange.com",
"https://german.stackexchange.com/users/16024/"
] | As Burki mentioned in his comment:
>
> The *Sie* is not only used to show respect, but also to indicate distance. Apart from that it is a language convention, and as such it is a bit hard to get rid of.
>
>
>
You can use *du* or *Sie* in disrespectful context and they can have different levels of respect.
Some ... | I'd go further than the accepted answer, and say that "Sie"/"Du" are nowadays almost never used to show respect, they are almost always used to only show closeness. Using "Du" with someone you barely know is usually inappropriate and thus disrespectful, but the "Du" itself is not indicating disrespect at all. I don't k... |
11,559,316 | Hi all : How can i fix the problem of css in ie 7 and ie6 : my divs change possition in those two : www.justcode/housetostay: I will be very glad if i get any help | 2012/07/19 | [
"https://Stackoverflow.com/questions/11559316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can use conditionals to do this.
In your add this code.
```
<!--[if lt IE 8]>
// Add your IE only stylesheet here
<![endif]-->
```
This means that if the browser is Less Than IE8 load the stylesheet in the comments.
You can be more specific if you need to.
`<!--[if IE ]>` - Targets all IE versions from 5... | Without using hacks I would suggest using this technique
```
<!--[if lt IE 7]><html class="ie6"><![endif]-->
<!--[if IE 7]><html class="ie7"><![endif]-->
<!--[if IE 8]><html class="ie8"><![endif]-->
<!--[if gt IE 8]><!--><html><!--<![endif]-->
```
Then you can add css:
```
.ie6 .my-div {
}
.ie7 .my-div {
}
```
... |
9,982,786 | Has anyone tried to get Windows 7/8 running on linux with the Microsoft Virtual PC download directly from Microsoft? It doesn't seem to be working using the default Boxes or Virtual Machine (QEMU) in CentOS / Red Hat?
```
SETTINGS:
Base Memory 1024 MB
Video Memory 128 MB
Network Adapter: Intel PRO/1000 MT Desktop (NAT... | 2012/04/02 | [
"https://Stackoverflow.com/questions/9982786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1164146/"
] | It sounds like you're trying to get Microsoft's IE Virtual PC *images* working in VirtualBox (not Virtual PC itself).
Luckily there is a tool available to automate the process of converting the images and getting them to work in VirtualBox. Take a look at [ievms](https://github.com/xdissent/ievms). | Microsoft Virtual PC downloads from <http://dev.modern.ie/> (MS) only support Virtual Box on linux and not the Virtual Machine Manager that comes with CentOS. |
9,982,786 | Has anyone tried to get Windows 7/8 running on linux with the Microsoft Virtual PC download directly from Microsoft? It doesn't seem to be working using the default Boxes or Virtual Machine (QEMU) in CentOS / Red Hat?
```
SETTINGS:
Base Memory 1024 MB
Video Memory 128 MB
Network Adapter: Intel PRO/1000 MT Desktop (NAT... | 2012/04/02 | [
"https://Stackoverflow.com/questions/9982786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1164146/"
] | Check <http://www.modern.ie/en-us/virtualization-tools#downloads>
This images are legal as `modern.ie` launched by Microsoft.
Site provide a wide range of up-today Windows images for Windows/Mac/Linux. | Microsoft Virtual PC downloads from <http://dev.modern.ie/> (MS) only support Virtual Box on linux and not the Virtual Machine Manager that comes with CentOS. |
9,982,786 | Has anyone tried to get Windows 7/8 running on linux with the Microsoft Virtual PC download directly from Microsoft? It doesn't seem to be working using the default Boxes or Virtual Machine (QEMU) in CentOS / Red Hat?
```
SETTINGS:
Base Memory 1024 MB
Video Memory 128 MB
Network Adapter: Intel PRO/1000 MT Desktop (NAT... | 2012/04/02 | [
"https://Stackoverflow.com/questions/9982786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1164146/"
] | It sounds like you're trying to get Microsoft's IE Virtual PC *images* working in VirtualBox (not Virtual PC itself).
Luckily there is a tool available to automate the process of converting the images and getting them to work in VirtualBox. Take a look at [ievms](https://github.com/xdissent/ievms). | Check <http://www.modern.ie/en-us/virtualization-tools#downloads>
This images are legal as `modern.ie` launched by Microsoft.
Site provide a wide range of up-today Windows images for Windows/Mac/Linux. |
17,487,872 | I want to add lines to /etc/my.conf as "sudo" using Shell.
Without logging as sudo, I can do:
```
{ echo "[mysqld]" ... | 2013/07/05 | [
"https://Stackoverflow.com/questions/17487872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185098/"
] | Firstly, use cat with a here-doc rather than a series of echoes. It's much cleaner. You can use the special form with a dash which strips leading tabs (tabs, not spaces!) to let you indent the here-doc to make it stand out.
Secondly, you can do the redirection as sudo by using `sudo sh -c` to start a root subshell, in... | ```
$ sudo echo "foo
bar
baz" > f
```
should work |
17,487,872 | I want to add lines to /etc/my.conf as "sudo" using Shell.
Without logging as sudo, I can do:
```
{ echo "[mysqld]" ... | 2013/07/05 | [
"https://Stackoverflow.com/questions/17487872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2185098/"
] | An alternative to launching a new shell is to use the `tee` command:
```
{ echo "[mysqld]"
ec... | ```
$ sudo echo "foo
bar
baz" > f
```
should work |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.