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 |
|---|---|---|---|---|---|
60,631,229 | i want to bind my button only on the element that i added to the cart, it's working well when i'm not in a loop but in a loop anything happen. i'm not sure if it was the right way to add the index like that in order to bind only the item clicked, if i don't put the index every button on the loop are binded and that's n... | 2020/03/11 | [
"https://Stackoverflow.com/questions/60631229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7528834/"
] | you can use:
```
words = input_str.split()
s = set()
result = set()
for w in words:
r = w[::-1]
if r in s:
result.add(r)
else:
s.add(w)
list(result)
```
output:
```
['am', 'eat']
```
this is O(n) time complexity solution, so you have to get first the words and iterate through them, e... | just change the indent of line "return reverse" :
```
input_str='i am going to eat ma and tae will also go'
word=input_str.split()
def isReverseEqual(s1, s2):
# If both the strings differ in length
if len(s1) != len(s2):
return False
l = len(s1)
for i in range(l):
# In case of any c... |
60,631,229 | i want to bind my button only on the element that i added to the cart, it's working well when i'm not in a loop but in a loop anything happen. i'm not sure if it was the right way to add the index like that in order to bind only the item clicked, if i don't put the index every button on the loop are binded and that's n... | 2020/03/11 | [
"https://Stackoverflow.com/questions/60631229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7528834/"
] | you can use:
```
words = input_str.split()
s = set()
result = set()
for w in words:
r = w[::-1]
if r in s:
result.add(r)
else:
s.add(w)
list(result)
```
output:
```
['am', 'eat']
```
this is O(n) time complexity solution, so you have to get first the words and iterate through them, e... | Your solution is overcomplicated. For example, function `isReverseEqual` can be written in one line:
```
def isReverseEqual(s1, s2):
return s1==s2[::-1]
```
Let's simplify it. First, treat your sentence as a set, not a list, because set lookups are more efficient:
```
words = set(input_str.split())
```
Next, ... |
60,631,229 | i want to bind my button only on the element that i added to the cart, it's working well when i'm not in a loop but in a loop anything happen. i'm not sure if it was the right way to add the index like that in order to bind only the item clicked, if i don't put the index every button on the loop are binded and that's n... | 2020/03/11 | [
"https://Stackoverflow.com/questions/60631229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7528834/"
] | just change the indent of line "return reverse" :
```
input_str='i am going to eat ma and tae will also go'
word=input_str.split()
def isReverseEqual(s1, s2):
# If both the strings differ in length
if len(s1) != len(s2):
return False
l = len(s1)
for i in range(l):
# In case of any c... | ```
input_str= 'i am going to eat ma and tae will also go'
words_list = input_str.split()
new_words_list = [word[::-1] for word in words_list]
data = []
for i in words_list:
if len(i) > 1 and i in new_words_list:
data.append(i)
```
**Output:**
```
['am', 'eat', 'ma', 'tae']
``` |
60,631,229 | i want to bind my button only on the element that i added to the cart, it's working well when i'm not in a loop but in a loop anything happen. i'm not sure if it was the right way to add the index like that in order to bind only the item clicked, if i don't put the index every button on the loop are binded and that's n... | 2020/03/11 | [
"https://Stackoverflow.com/questions/60631229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7528834/"
] | just change the indent of line "return reverse" :
```
input_str='i am going to eat ma and tae will also go'
word=input_str.split()
def isReverseEqual(s1, s2):
# If both the strings differ in length
if len(s1) != len(s2):
return False
l = len(s1)
for i in range(l):
# In case of any c... | Your solution is overcomplicated. For example, function `isReverseEqual` can be written in one line:
```
def isReverseEqual(s1, s2):
return s1==s2[::-1]
```
Let's simplify it. First, treat your sentence as a set, not a list, because set lookups are more efficient:
```
words = set(input_str.split())
```
Next, ... |
41,048,884 | So, I'm using [dotConnect for Oracle](https://www.devart.com/dotconnect/oracle/). I used the template and wizard to create a model of the database (Database first approach). We have multiple databases that a single application needs to reference and unfortunately the schema naming which contain the tables are not unifo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41048884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2351039/"
] | In Oracle you can call `alter session set current_schema = SCHEMA_NAME` statement which set contex of your session. Then you can go without prefixing tables with schema name but this may help only if you're using same session for all statements. | In case anyone has a similar issue I will expand on Kacper's answer:
In the model file `MyModel.lqml` I removed the schema specifications from the table names:
```
<Table Name="SCHEMA.TABLE" Member="ModelTableName">
```
to
```
<Table Name="TABLE" Member="ModelTableName">
```
Basiscally where applicable.
In code... |
41,048,884 | So, I'm using [dotConnect for Oracle](https://www.devart.com/dotconnect/oracle/). I used the template and wizard to create a model of the database (Database first approach). We have multiple databases that a single application needs to reference and unfortunately the schema naming which contain the tables are not unifo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41048884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2351039/"
] | In Oracle you can call `alter session set current_schema = SCHEMA_NAME` statement which set contex of your session. Then you can go without prefixing tables with schema name but this may help only if you're using same session for all statements. | There is an additional way to execute a command immediately after establishing a connection: set command (or several commands) via Run Once Command (or Initialization Command) connection string parameter. For more information, refer to <https://www.devart.com/dotconnect/oracle/docs/?Devart.Data.Oracle~Devart.Data.Oracl... |
41,048,884 | So, I'm using [dotConnect for Oracle](https://www.devart.com/dotconnect/oracle/). I used the template and wizard to create a model of the database (Database first approach). We have multiple databases that a single application needs to reference and unfortunately the schema naming which contain the tables are not unifo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41048884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2351039/"
] | In case anyone has a similar issue I will expand on Kacper's answer:
In the model file `MyModel.lqml` I removed the schema specifications from the table names:
```
<Table Name="SCHEMA.TABLE" Member="ModelTableName">
```
to
```
<Table Name="TABLE" Member="ModelTableName">
```
Basiscally where applicable.
In code... | There is an additional way to execute a command immediately after establishing a connection: set command (or several commands) via Run Once Command (or Initialization Command) connection string parameter. For more information, refer to <https://www.devart.com/dotconnect/oracle/docs/?Devart.Data.Oracle~Devart.Data.Oracl... |
38,383,867 | I currently have an iOS App that is already set up to receive push notifications. What I'm trying to do is, after a user presses the 'Join' button, I want to send them a "Welcome" push notification. Any clue on how to do this? | 2016/07/14 | [
"https://Stackoverflow.com/questions/38383867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6031898/"
] | It's pretty easy.
`AppDelegate`:
```
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Alert, .Sound, .Badge], categories: nil))
return true
}
func app... | On YouTube, Jared Davidson offers some great iOS tutorials.
He has two on notifications:
This one is just what you need:
<https://www.youtube.com/watch?v=tqJFJzUPpcI>
...and there's one for remote notifications (not with a button)
<https://www.youtube.com/watch?v=LBw5tuTvKd4> |
27,637,270 | In my application I have written to find IP Address of user.
```
HttpServletRequest httpRequest = (HttpServletRequest) request;
String userIpAddress = httpRequest.getHeader("X-Forwarded-For");
HttpServletRequest.getLocalAddr();
```
And getting the server ips can be done so:
```
Inet4Address.getLocalHost()... | 2014/12/24 | [
"https://Stackoverflow.com/questions/27637270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4247609/"
] | Try Following code:
```
Inet4Address address=(Inet4Address) Inet4Address.getLocalHost();
System.out.println(address.getHostAddress());
```
`Inet4Address` comes from `java.net.Inet4Address;` | Best way to find host address in LAN can be done as follows:
```
System.out.println(InetAddress.getByName("anyhostname").getHostAddress());
``` |
27,637,270 | In my application I have written to find IP Address of user.
```
HttpServletRequest httpRequest = (HttpServletRequest) request;
String userIpAddress = httpRequest.getHeader("X-Forwarded-For");
HttpServletRequest.getLocalAddr();
```
And getting the server ips can be done so:
```
Inet4Address.getLocalHost()... | 2014/12/24 | [
"https://Stackoverflow.com/questions/27637270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4247609/"
] | Try Following code:
```
Inet4Address address=(Inet4Address) Inet4Address.getLocalHost();
System.out.println(address.getHostAddress());
```
`Inet4Address` comes from `java.net.Inet4Address;` | Try this, it will enumerate all the interface's address of your local machine.
```
try {
Enumeration<NetworkInterface> interfaceEnumeration =
NetworkInterface.getNetworkInterfaces();
while (interfaceEnumeration.hasMoreElements()) {
Enumeration<InetAddress> inetAddressEnum... |
5,493,468 | I have this simple sample on VS2010:
```
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
AbsClass absClass = new ConClass();
// I have tried this also and the error is different:
// ConClass absClass = new ConC... | 2011/03/30 | [
"https://Stackoverflow.com/questions/5493468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357618/"
] | You need to make your `MyMethod` static:
```
public static void MyMethod(ref AbsClass a)
{
a.Id = "new";
}
```
The problem isn't the abstract class, the "problem" is the static `Main` method. Static methods don't have an instance, and as such, can't call instance methods.
[msdn on static classes... | You either need to make your `MyMethod` method static:
```
public static MyMethod(ref AbsClass a)
{
a.Id = "new";
}
```
Or preferrably, create an instance of the `Program` class, and call `MyMethod` from that instance:
```
Program p = new Program();
p.MyMethod(ref abs);
```
The reason why the first method wor... |
34,776,816 | I have a template:
```
var playersList = Vue.extend({
props: ['players'],
template: '#players-template'
});
Vue.component('players', playersList);
new Vue({
el: 'body',
methods: {
someMethod: function() {
//JSON data from request comes here
//Want to render template o... | 2016/01/13 | [
"https://Stackoverflow.com/questions/34776816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5073678/"
] | You have to specify the data in your Vue instance where the response is going to be stored
```
var playersList = Vue.extend({
template: '#players-template',
props: ['players']
}
});
Vue.component('players', playersList);
new Vue({
el: 'body',
data: {
players: ''
},
methods: {
... | Once you create the Vue app on the `body` element, you can use its component anywhere within that element. Since you named the component players, you'd render it like this:
```
<body>
<players :players="players"></players>
</body>
```
Then in your Vue
```
new Vue({
el: 'body',
data: function(){
return { pla... |
36,384 | On my 2002 BMW E46 330Ci, I've been getting error codes `202 Lambda regulating limit Bank1` and `203 Lambda regulating limit Bank2`. Here's the angry sensor readings from the INPA software:
[](https://i.stack.imgur.com/XjFFT.png)
I understand a number... | 2016/09/15 | [
"https://mechanics.stackexchange.com/questions/36384",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/2221/"
] | Here's how to decipher INPA
---------------------------

* **lambdaintegrator**
Short-term fuel trim. Both banks have a short-term correction of 28%.
This should settle down to 0% fairly quickly, so the fact that it stays red indicates that it is attempting to apply t... | It may depend on how you are gathering that data. Perhaps a "Live Data" OBD Parameter ID or "PID"?
You may need a more specific scan tool or smarter software.
*Some* (especially higher end) vehicles use wide-band O2 sensors, and on my scan tool read out in milliamps, not in volts.
In other words, your scan tool may ... |
36,384 | On my 2002 BMW E46 330Ci, I've been getting error codes `202 Lambda regulating limit Bank1` and `203 Lambda regulating limit Bank2`. Here's the angry sensor readings from the INPA software:
[](https://i.stack.imgur.com/XjFFT.png)
I understand a number... | 2016/09/15 | [
"https://mechanics.stackexchange.com/questions/36384",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/2221/"
] | It may depend on how you are gathering that data. Perhaps a "Live Data" OBD Parameter ID or "PID"?
You may need a more specific scan tool or smarter software.
*Some* (especially higher end) vehicles use wide-band O2 sensors, and on my scan tool read out in milliamps, not in volts.
In other words, your scan tool may ... | I had the same trouble code from O2 sensors like above. It's not the sensors that have problem. It's just telling you, it's trying to compensate for F/T mixture but it was unable to due to the fact it had reached it's LIMIT for compensation.
I tried a lot of other testing, finally it is the air leak that caused that p... |
36,384 | On my 2002 BMW E46 330Ci, I've been getting error codes `202 Lambda regulating limit Bank1` and `203 Lambda regulating limit Bank2`. Here's the angry sensor readings from the INPA software:
[](https://i.stack.imgur.com/XjFFT.png)
I understand a number... | 2016/09/15 | [
"https://mechanics.stackexchange.com/questions/36384",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/2221/"
] | Here's how to decipher INPA
---------------------------

* **lambdaintegrator**
Short-term fuel trim. Both banks have a short-term correction of 28%.
This should settle down to 0% fairly quickly, so the fact that it stays red indicates that it is attempting to apply t... | I had the same trouble code from O2 sensors like above. It's not the sensors that have problem. It's just telling you, it's trying to compensate for F/T mixture but it was unable to due to the fact it had reached it's LIMIT for compensation.
I tried a lot of other testing, finally it is the air leak that caused that p... |
59,433 | So I am sure there are better ways to set this up, but I wanted to see how something like this would work in Objective-C, so I went ahead and built a prototype of a Tradeable Card Game. I've never loaded information from a plist before, so this was the perfect opportunity for me to try that.
The idea here is that the ... | 2014/08/07 | [
"https://codereview.stackexchange.com/questions/59433",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/14608/"
] | Logic
-----
Never omit the optional braces like that. Think of yourself as a contributing factor to a future [coding accident](https://www.imperialviolet.org/2014/02/22/applebug.html). If you really want to omit braces, then put the statement on the same line, so that there is no possibility of misinterpretation.
The... | this is in addition to 200\_success's answer,
**Better Test Cases**
>
>
> ```
> byte[] bytes1 = {(byte) 0b11001111, (byte) 0b10111111};
> System.out.println(validate(bytes1)); // true
>
> byte[] bytes2 = {(byte) 0b11101111, (byte) 0b10101010, (byte) 0b10111111};
> System.out.println(validate(bytes2)); // true
>
>... |
2,655 | I was recently challenged to translate the following sentence from English into Chinese:
*You should stay away from that bar. A friend of mine went there before, and he ended up in the hospital after one drink. We think they put fertilizer in the margarita mix to save costs.*
I provided two translations:
1. 你不要去那个酒吧... | 2013/01/01 | [
"https://chinese.stackexchange.com/questions/2655",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/-1/"
] | Overall both translations are fine and fluent, with some small issues below:
**Grammatical/Syntactic issues:**
I think there is only one issue, in (2) 我们想酒保因为要**省钱的**. Either use 要省钱 as verb (i.e. remove 的), or use 要省钱的 as adjective (i.e. add 是 before 要).
**Semantic issues:**
In (1), margarita mix is translated int... | My translation:
你可别去那个酒吧。我一朋友去过一次,喝了一杯酒就进医院了。我们觉得他们为了省钱,在酒里掺了化肥。
Notes:
1. 你可别去那个酒吧 sounds stronger than 你最好别去那个酒吧.
2. 我一朋友 is more colloquial than 我的一个朋友.
3. 进医院了 means "end up in the hospital (because of sickness)." 去医院 just means "go to hospital," and it may not necessarily infer "to see a doctor." |
2,655 | I was recently challenged to translate the following sentence from English into Chinese:
*You should stay away from that bar. A friend of mine went there before, and he ended up in the hospital after one drink. We think they put fertilizer in the margarita mix to save costs.*
I provided two translations:
1. 你不要去那个酒吧... | 2013/01/01 | [
"https://chinese.stackexchange.com/questions/2655",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/-1/"
] | Overall both translations are fine and fluent, with some small issues below:
**Grammatical/Syntactic issues:**
I think there is only one issue, in (2) 我们想酒保因为要**省钱的**. Either use 要省钱 as verb (i.e. remove 的), or use 要省钱的 as adjective (i.e. add 是 before 要).
**Semantic issues:**
In (1), margarita mix is translated int... | I like the original translator's 被送到医院去了: 被 tends to be for nasty things, with an element of what I call "sitting duck" ("can't-do-anything-about-it"-ness) about it. 被送到医院去了, to me, almost conjures up an image of the drinker being carted off to the hospital, which is appropriate here, I feel.
I also like 孤影萍踪's 你可别 (o... |
2,655 | I was recently challenged to translate the following sentence from English into Chinese:
*You should stay away from that bar. A friend of mine went there before, and he ended up in the hospital after one drink. We think they put fertilizer in the margarita mix to save costs.*
I provided two translations:
1. 你不要去那个酒吧... | 2013/01/01 | [
"https://chinese.stackexchange.com/questions/2655",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/-1/"
] | My translation:
你可别去那个酒吧。我一朋友去过一次,喝了一杯酒就进医院了。我们觉得他们为了省钱,在酒里掺了化肥。
Notes:
1. 你可别去那个酒吧 sounds stronger than 你最好别去那个酒吧.
2. 我一朋友 is more colloquial than 我的一个朋友.
3. 进医院了 means "end up in the hospital (because of sickness)." 去医院 just means "go to hospital," and it may not necessarily infer "to see a doctor." | I like the original translator's 被送到医院去了: 被 tends to be for nasty things, with an element of what I call "sitting duck" ("can't-do-anything-about-it"-ness) about it. 被送到医院去了, to me, almost conjures up an image of the drinker being carted off to the hospital, which is appropriate here, I feel.
I also like 孤影萍踪's 你可别 (o... |
59,761,799 | I have a list of coordinates and another list of height values. How can I append height values to coordinate list in sequential order?
```
coor = [[[83.75, 18.70], [57.50, 18.70], [57.5, 2.87], [83.75, 4.18]],
[[83.75, 34.54], [110.0, 35.0], [104.86, 19.59], [83.75, 19.59]],
[[104.86, 19.59], [83.75, 19.59], [83... | 2020/01/16 | [
"https://Stackoverflow.com/questions/59761799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12237852/"
] | If you don't mind tuples, you can just use `zip`
```
> list(zip(coor, height))
[([[83.75, 18.7], [57.5, 18.7], [57.5, 2.87], [83.75, 4.18]], 5),
([[83.75, 34.54], [110.0, 35.0], [104.86, 19.59], [83.75, 19.59]], 4),
...
```
If it must be a list use `zip` in a comprehension.
```
> [list(pair) for pair in zip(coor... | tldr: One line solution, **zip** the iterables ([Python docs](https://docs.python.org/3.3/library/functions.html#zip)) and list for desired output explanation below:
```
[list(item) for item in list(zip(coor,height))]
```
explanation:
```
list1 = [
[['a','a'],['aa','aa']],
[['b','b'],['bb','bb']]]
list2 ... |
23,525,398 | i'm trying to capture pictures in a app using by Sencha Touch 2.3.1 and Cordova 3.4.1-0.1.0.
Reading the docs (<http://docs.sencha.com/touch/2.3.1/#!/api/Ext.device.Camera-method-capture>) it looks very easy and simple, but i'm having a very weird experience.
First i create a Sencha Touch app and initialize Cordova on... | 2014/05/07 | [
"https://Stackoverflow.com/questions/23525398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541615/"
] | JavaScript is single-threaded which means all the work needs to be done on the same thread including queuing events (from setTimeout/rAF, keys etc.), rendering to canvas and so forth.
If the loop is very tight (time-budget-wise) there will simply not be any room for the browser to do other tasks such as GC - for Chrom... | I've found that a huge source of memory leaking in javascript code is usually [closures](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures).
If you're accessing a variable inside your setInterval that was declared outside, then you're most likely leaking some memory. As to whether or not this is th... |
23,525,398 | i'm trying to capture pictures in a app using by Sencha Touch 2.3.1 and Cordova 3.4.1-0.1.0.
Reading the docs (<http://docs.sencha.com/touch/2.3.1/#!/api/Ext.device.Camera-method-capture>) it looks very easy and simple, but i'm having a very weird experience.
First i create a Sencha Touch app and initialize Cordova on... | 2014/05/07 | [
"https://Stackoverflow.com/questions/23525398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541615/"
] | JavaScript is single-threaded which means all the work needs to be done on the same thread including queuing events (from setTimeout/rAF, keys etc.), rendering to canvas and so forth.
If the loop is very tight (time-budget-wise) there will simply not be any room for the browser to do other tasks such as GC - for Chrom... | We've noticed chrome + canvas is not as performant as firefox + canvas. As to GC occurring when you open chrome dev tools, well I'd guess you may have some code that nudges chrome in just the right way to do a GC. Do you have some sort of window resize handler? There might be something else that is doing something simi... |
23,525,398 | i'm trying to capture pictures in a app using by Sencha Touch 2.3.1 and Cordova 3.4.1-0.1.0.
Reading the docs (<http://docs.sencha.com/touch/2.3.1/#!/api/Ext.device.Camera-method-capture>) it looks very easy and simple, but i'm having a very weird experience.
First i create a Sencha Touch app and initialize Cordova on... | 2014/05/07 | [
"https://Stackoverflow.com/questions/23525398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541615/"
] | I've found that a huge source of memory leaking in javascript code is usually [closures](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures).
If you're accessing a variable inside your setInterval that was declared outside, then you're most likely leaking some memory. As to whether or not this is th... | We've noticed chrome + canvas is not as performant as firefox + canvas. As to GC occurring when you open chrome dev tools, well I'd guess you may have some code that nudges chrome in just the right way to do a GC. Do you have some sort of window resize handler? There might be something else that is doing something simi... |
139,912 | >
> **Natural things** ought to be respected as “natural” beings , which
> means that we should try our best to avoid interfering with their
> natural existence and when it is necessary, to restore them into their
> natural state.(self-made)
>
>
>
Obviously, here I use "nutural things" to mean things like trees... | 2013/12/01 | [
"https://english.stackexchange.com/questions/139912",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/51369/"
] | To remove the ambiguity of "natural things", you could possible use "Our natural environment" as a collective noun to set the initial scope of your sentence, which would then focus the meaning of "things" later on to the broadest sense of nature, rather than natural yoghurt, make-up, etc:
>
> Our natural environment ... | You could try *All natural phenomena* or *All life, both animal and vegetable* or, more fancifully, *The whole of creation*. |
139,912 | >
> **Natural things** ought to be respected as “natural” beings , which
> means that we should try our best to avoid interfering with their
> natural existence and when it is necessary, to restore them into their
> natural state.(self-made)
>
>
>
Obviously, here I use "nutural things" to mean things like trees... | 2013/12/01 | [
"https://english.stackexchange.com/questions/139912",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/51369/"
] | To remove the ambiguity of "natural things", you could possible use "Our natural environment" as a collective noun to set the initial scope of your sentence, which would then focus the meaning of "things" later on to the broadest sense of nature, rather than natural yoghurt, make-up, etc:
>
> Our natural environment ... | Depending on what you intend to include in those "natural things", the following words could convey fine shades of meaning:
**All living creatures** (usually excludes trees and plants)
**All life** (as suggested by Barrie England, also *all of life*)
**Everything** (will also include water, rocks, etc.) |
139,912 | >
> **Natural things** ought to be respected as “natural” beings , which
> means that we should try our best to avoid interfering with their
> natural existence and when it is necessary, to restore them into their
> natural state.(self-made)
>
>
>
Obviously, here I use "nutural things" to mean things like trees... | 2013/12/01 | [
"https://english.stackexchange.com/questions/139912",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/51369/"
] | To remove the ambiguity of "natural things", you could possible use "Our natural environment" as a collective noun to set the initial scope of your sentence, which would then focus the meaning of "things" later on to the broadest sense of nature, rather than natural yoghurt, make-up, etc:
>
> Our natural environment ... | It's a bit long-winded, but "All things that are part of the natural world" is what I would choose, for the sake of clarity. Unfortunately, even this long-winded form is open to misinterpretation, because some people may think that it includes humans. |
35,564,808 | may i declare an array with a global element in C?
Can i declare with a const type?
It runs on Xcode, however I fear it isn't correct, because glob is not a const type (same thought on static type).
```
#include <stdio.h>
#include <stdilib.h>
int glob;
void main (){
int const con;
static int stat;
int ... | 2016/02/22 | [
"https://Stackoverflow.com/questions/35564808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5965371/"
] | The variable `post` is defined inside the `createPost()` function, which means that it is out of scope when you try to append it - it only exists within the `createPost()` function. Define `post` outside of the `createPost()` function, and it will become globally accessible, and it should work.
e.g.
```
var testimg ... | Since you're using jQuery your code could be :
```
var testimg = 'images/1.png'
var post = '<div class="col-md-3 col-sm-6 col-xs-12 post"></div>';
var img = '<img src="'+testimg+'" alt="post" class="img-responsive" '/>;
$(post).append(img);
$('#posts-div').append(post);
```
Hope this helps. |
35,564,808 | may i declare an array with a global element in C?
Can i declare with a const type?
It runs on Xcode, however I fear it isn't correct, because glob is not a const type (same thought on static type).
```
#include <stdio.h>
#include <stdilib.h>
int glob;
void main (){
int const con;
static int stat;
int ... | 2016/02/22 | [
"https://Stackoverflow.com/questions/35564808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5965371/"
] | Here's another version which I believe is a better way.
```
var testimg = 'images/1.png';
var post;
var img;
function createPost(){
post = $('<div/>',{ class:"col-md-3 col-sm-6 col-xs-12 post" }).appendTo("#posts-div");
}
function addElements(){
img = $('<img/>',{ src:testimg , alt:'post',class:'im... | The variable `post` is defined inside the `createPost()` function, which means that it is out of scope when you try to append it - it only exists within the `createPost()` function. Define `post` outside of the `createPost()` function, and it will become globally accessible, and it should work.
e.g.
```
var testimg ... |
35,564,808 | may i declare an array with a global element in C?
Can i declare with a const type?
It runs on Xcode, however I fear it isn't correct, because glob is not a const type (same thought on static type).
```
#include <stdio.h>
#include <stdilib.h>
int glob;
void main (){
int const con;
static int stat;
int ... | 2016/02/22 | [
"https://Stackoverflow.com/questions/35564808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5965371/"
] | Here's another version which I believe is a better way.
```
var testimg = 'images/1.png';
var post;
var img;
function createPost(){
post = $('<div/>',{ class:"col-md-3 col-sm-6 col-xs-12 post" }).appendTo("#posts-div");
}
function addElements(){
img = $('<img/>',{ src:testimg , alt:'post',class:'im... | Since you're using jQuery your code could be :
```
var testimg = 'images/1.png'
var post = '<div class="col-md-3 col-sm-6 col-xs-12 post"></div>';
var img = '<img src="'+testimg+'" alt="post" class="img-responsive" '/>;
$(post).append(img);
$('#posts-div').append(post);
```
Hope this helps. |
54,228 | When mounting a swap partition on Linux, what does the mount option pri=42 mean?
fstab:
```
/dev/hda1 swap swap pri=42 0 0
``` | 2009/10/12 | [
"https://superuser.com/questions/54228",
"https://superuser.com",
"https://superuser.com/users/13882/"
] | The `pri` is short priority and [determines the order in which multiple swap partitions are used](http://www.brighthub.com/computing/linux/articles/37236.aspx). Partitions with a higher value for `pri` are used first. | assume you have 2 swap-partitions, with 'pri' you can tell the os, which swap partion to use first:
>
> pri=n Specifies the swap space priority. The n variable can
> be 0, 1, 2, 3, 4, with 0 being lowest priority, and 4
> being highest priority.
>
>
> |
54,228 | When mounting a swap partition on Linux, what does the mount option pri=42 mean?
fstab:
```
/dev/hda1 swap swap pri=42 0 0
``` | 2009/10/12 | [
"https://superuser.com/questions/54228",
"https://superuser.com",
"https://superuser.com/users/13882/"
] | Not on any linux distro, I believe ubuntu does not set any swap priority by default, some others might.
You may call **man swapon** to the rescue ... here is an excerpt:
>
> -p priority
>
>
> Specify the priority of the swap device. This option is only available if swapon was compiled and is used under a 1.3.2 or ... | The `pri` is short priority and [determines the order in which multiple swap partitions are used](http://www.brighthub.com/computing/linux/articles/37236.aspx). Partitions with a higher value for `pri` are used first. |
54,228 | When mounting a swap partition on Linux, what does the mount option pri=42 mean?
fstab:
```
/dev/hda1 swap swap pri=42 0 0
``` | 2009/10/12 | [
"https://superuser.com/questions/54228",
"https://superuser.com",
"https://superuser.com/users/13882/"
] | The `pri` is short priority and [determines the order in which multiple swap partitions are used](http://www.brighthub.com/computing/linux/articles/37236.aspx). Partitions with a higher value for `pri` are used first. | I was on the same boat, and in fairness @avelldiroll answer is already perfect.
But, if you are alone on a terminal with no internet, this is the trail to follow:
1. First you start with `man fstab`, and here the relevant portion:
>
> **The fourth field (fs\_mntops).**
>
>
> This field describes the mount options... |
54,228 | When mounting a swap partition on Linux, what does the mount option pri=42 mean?
fstab:
```
/dev/hda1 swap swap pri=42 0 0
``` | 2009/10/12 | [
"https://superuser.com/questions/54228",
"https://superuser.com",
"https://superuser.com/users/13882/"
] | The `pri` is short priority and [determines the order in which multiple swap partitions are used](http://www.brighthub.com/computing/linux/articles/37236.aspx). Partitions with a higher value for `pri` are used first. | One observation.
I have a listing where priority is -2 which I assume is less then 5.
```
swapon -s
Filename Type Size Used Priority
/dev/sda3 partition 2047996 0 -2
/dev/zram0 partition 1455164 0 5
/dev/zram1 partition 1455164 0 ... |
54,228 | When mounting a swap partition on Linux, what does the mount option pri=42 mean?
fstab:
```
/dev/hda1 swap swap pri=42 0 0
``` | 2009/10/12 | [
"https://superuser.com/questions/54228",
"https://superuser.com",
"https://superuser.com/users/13882/"
] | Not on any linux distro, I believe ubuntu does not set any swap priority by default, some others might.
You may call **man swapon** to the rescue ... here is an excerpt:
>
> -p priority
>
>
> Specify the priority of the swap device. This option is only available if swapon was compiled and is used under a 1.3.2 or ... | assume you have 2 swap-partitions, with 'pri' you can tell the os, which swap partion to use first:
>
> pri=n Specifies the swap space priority. The n variable can
> be 0, 1, 2, 3, 4, with 0 being lowest priority, and 4
> being highest priority.
>
>
> |
54,228 | When mounting a swap partition on Linux, what does the mount option pri=42 mean?
fstab:
```
/dev/hda1 swap swap pri=42 0 0
``` | 2009/10/12 | [
"https://superuser.com/questions/54228",
"https://superuser.com",
"https://superuser.com/users/13882/"
] | Not on any linux distro, I believe ubuntu does not set any swap priority by default, some others might.
You may call **man swapon** to the rescue ... here is an excerpt:
>
> -p priority
>
>
> Specify the priority of the swap device. This option is only available if swapon was compiled and is used under a 1.3.2 or ... | I was on the same boat, and in fairness @avelldiroll answer is already perfect.
But, if you are alone on a terminal with no internet, this is the trail to follow:
1. First you start with `man fstab`, and here the relevant portion:
>
> **The fourth field (fs\_mntops).**
>
>
> This field describes the mount options... |
54,228 | When mounting a swap partition on Linux, what does the mount option pri=42 mean?
fstab:
```
/dev/hda1 swap swap pri=42 0 0
``` | 2009/10/12 | [
"https://superuser.com/questions/54228",
"https://superuser.com",
"https://superuser.com/users/13882/"
] | Not on any linux distro, I believe ubuntu does not set any swap priority by default, some others might.
You may call **man swapon** to the rescue ... here is an excerpt:
>
> -p priority
>
>
> Specify the priority of the swap device. This option is only available if swapon was compiled and is used under a 1.3.2 or ... | One observation.
I have a listing where priority is -2 which I assume is less then 5.
```
swapon -s
Filename Type Size Used Priority
/dev/sda3 partition 2047996 0 -2
/dev/zram0 partition 1455164 0 5
/dev/zram1 partition 1455164 0 ... |
11,646,563 | I implemented several buttons in my webpage as i am doing a booking system. I managed to restrict the user click on buttons in my webpage but my problem here is that user now cannot even select a button as when they try to click on the first button, my alert message will pop up asking them to only select one button. Ho... | 2012/07/25 | [
"https://Stackoverflow.com/questions/11646563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508546/"
] | This will always evaluate to `false`, so you always get into the `else` block:
```
int counter = 0;
if (counter > 1)
```
You should change `counter` **after** your code executed, also it should be a field of your class (otherwise any changes to it get lost as currently `counter` is gone once the method exits).
Yo... | Declare `int counter = 0` as global variable. |
11,646,563 | I implemented several buttons in my webpage as i am doing a booking system. I managed to restrict the user click on buttons in my webpage but my problem here is that user now cannot even select a button as when they try to click on the first button, my alert message will pop up asking them to only select one button. Ho... | 2012/07/25 | [
"https://Stackoverflow.com/questions/11646563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508546/"
] | This will always evaluate to `false`, so you always get into the `else` block:
```
int counter = 0;
if (counter > 1)
```
You should change `counter` **after** your code executed, also it should be a field of your class (otherwise any changes to it get lost as currently `counter` is gone once the method exits).
Yo... | you must try with this example for Button1
```
//Save your counter in Viewstate or InputHidden in order to persist
public int Counter
{
get
{
int s = (int)ViewState["Counter"];
return (s == null) ? 0 : s;
}
set
{
ViewState["Counter"] = value;
}
}
protected void Button... |
11,646,563 | I implemented several buttons in my webpage as i am doing a booking system. I managed to restrict the user click on buttons in my webpage but my problem here is that user now cannot even select a button as when they try to click on the first button, my alert message will pop up asking them to only select one button. Ho... | 2012/07/25 | [
"https://Stackoverflow.com/questions/11646563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508546/"
] | Declare `int counter = 0` as global variable. | you must try with this example for Button1
```
//Save your counter in Viewstate or InputHidden in order to persist
public int Counter
{
get
{
int s = (int)ViewState["Counter"];
return (s == null) ? 0 : s;
}
set
{
ViewState["Counter"] = value;
}
}
protected void Button... |
28,385,262 | I'm using native javascript ajax but when I look at what's posted it simply says `[object Object]` and so trying to capture `$_REQUEST['stringSent']` in the php file does nothing
Here's what I'm trying, called using `dataPost('test')`
```
function dataPost(dataToSend) {
var params = { "stringSent": dataToSend };
... | 2015/02/07 | [
"https://Stackoverflow.com/questions/28385262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/973552/"
] | Comment this line :
```
// xmlhttp.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
```
or Change it to :
```
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send('stringSent=' + dataToSend);
``` | Use Jquery Ajax.
```
$.ajax({
url: 'dataCapture.php',
dataType: 'text',
type: 'post',
contentType: 'application/x-www-form-urlencoded',
data: params ,
success: function( data, textStatus, jQxhr ){ $('#response pre').html( data ); },
error: function( jqXhr, textStatus, errorThrown ){ console.log( errorThrown ); }
})... |
7,247,235 | we can search dictionary like
```
var dictionary = new Dictionary<string,string>();
dictionary.Keys.Where( key => key.Contains("a")).ToList();
```
but it return list. i want that linq should return true or false. so what would be the right code that search dictionary with linq. please guide. | 2011/08/30 | [
"https://Stackoverflow.com/questions/7247235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Use the `Any()` operator:
```
dictionary.Keys.Where(key => key.Contains("a")).Any();
```
Or
```
dictionary.Keys.Any(key => key.Contains("a"));
``` | Use `Any` **instead of** `Where`:
```
dictionary.Keys.Any( key => key.Contains("a"));
``` |
7,247,235 | we can search dictionary like
```
var dictionary = new Dictionary<string,string>();
dictionary.Keys.Where( key => key.Contains("a")).ToList();
```
but it return list. i want that linq should return true or false. so what would be the right code that search dictionary with linq. please guide. | 2011/08/30 | [
"https://Stackoverflow.com/questions/7247235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Use the `Any()` operator:
```
dictionary.Keys.Where(key => key.Contains("a")).Any();
```
Or
```
dictionary.Keys.Any(key => key.Contains("a"));
``` | If you're asking if you can determine whether or not any key in the dictionary contains `"a"`, then you can do:
```
dictionary.Keys.Any(key => key.Contains("a"))
``` |
7,247,235 | we can search dictionary like
```
var dictionary = new Dictionary<string,string>();
dictionary.Keys.Where( key => key.Contains("a")).ToList();
```
but it return list. i want that linq should return true or false. so what would be the right code that search dictionary with linq. please guide. | 2011/08/30 | [
"https://Stackoverflow.com/questions/7247235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Use the `Any()` operator:
```
dictionary.Keys.Where(key => key.Contains("a")).Any();
```
Or
```
dictionary.Keys.Any(key => key.Contains("a"));
``` | You can use the .Any() keyword:
```
bool exists = dictionary.Keys.Any(key => key.Contains("a"));
``` |
7,247,235 | we can search dictionary like
```
var dictionary = new Dictionary<string,string>();
dictionary.Keys.Where( key => key.Contains("a")).ToList();
```
but it return list. i want that linq should return true or false. so what would be the right code that search dictionary with linq. please guide. | 2011/08/30 | [
"https://Stackoverflow.com/questions/7247235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Use `Any` **instead of** `Where`:
```
dictionary.Keys.Any( key => key.Contains("a"));
``` | If you're asking if you can determine whether or not any key in the dictionary contains `"a"`, then you can do:
```
dictionary.Keys.Any(key => key.Contains("a"))
``` |
7,247,235 | we can search dictionary like
```
var dictionary = new Dictionary<string,string>();
dictionary.Keys.Where( key => key.Contains("a")).ToList();
```
but it return list. i want that linq should return true or false. so what would be the right code that search dictionary with linq. please guide. | 2011/08/30 | [
"https://Stackoverflow.com/questions/7247235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Use `Any` **instead of** `Where`:
```
dictionary.Keys.Any( key => key.Contains("a"));
``` | You can use the .Any() keyword:
```
bool exists = dictionary.Keys.Any(key => key.Contains("a"));
``` |
7,247,235 | we can search dictionary like
```
var dictionary = new Dictionary<string,string>();
dictionary.Keys.Where( key => key.Contains("a")).ToList();
```
but it return list. i want that linq should return true or false. so what would be the right code that search dictionary with linq. please guide. | 2011/08/30 | [
"https://Stackoverflow.com/questions/7247235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | You can use the .Any() keyword:
```
bool exists = dictionary.Keys.Any(key => key.Contains("a"));
``` | If you're asking if you can determine whether or not any key in the dictionary contains `"a"`, then you can do:
```
dictionary.Keys.Any(key => key.Contains("a"))
``` |
129,080 | Let consider an object which has a field called edit\_counting. We knew that for every record, we have a button called EDIT to update the record. First time I edited and save the record. Now the value of Edit\_counting is should be 1. Like this How many times I edit the record, that many times the field value needs to ... | 2016/06/28 | [
"https://salesforce.stackexchange.com/questions/129080",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/-1/"
] | You can create a custom number field and set the default value to zero. Then create a WFR. Your formula would look something like this
```
OR(
ISCHANGED(Field1__c),
ISCHANGED(Field2__c),
ISCHANGED(Field3__c),
ISCHANGED(Field4__c),
ISCHANGED(Field5__c),
ISCHANGED(Field6__c),
ISCHANGED(Field7__c),
ISCHANGED(Field8__c),
... | To track the changes made in field create workflow as follows :
* Create a Number field for Edit\_counting
* Create a workflow that fires whenever there is a edit made by using this formula `ISCHANGED(tracking_field)`
* Do a field update on number field as `<Edit_counting> + 1 .` |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | This is a working solution for JPA, Hibernate (with annotations).
This is the beginning of the entity class (for the table that has Interval column):
```
@Entity
@Table(name="table_with_interval_col")
@TypeDef(name="interval", typeClass = Interval.class)
public class TableWithIntervalCol implements Serializable {
``... | According to the link you should have a day followed by hours:minutes:seconds. So changing the code to something like the following assuming you never need to have more then 23 hours 59 minutes in the interval.
```
statement.setString(index, "'0 "+ hours +":"
+ intervalFormat.format(minutes) + ":"
+ intervalFormat.f... |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | PostgreSQL has a date\_part / extract function which you can use to return different fields, epoch being one of them. When extracting the epoch from an interval, you receive the number of seconds contained in the interval, and from there you can convert however you wish. I lost my experience with Hibernate, but you can... | According to the link you should have a day followed by hours:minutes:seconds. So changing the code to something like the following assuming you never need to have more then 23 hours 59 minutes in the interval.
```
statement.setString(index, "'0 "+ hours +":"
+ intervalFormat.format(minutes) + ":"
+ intervalFormat.f... |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | Why not just turn it into a numeric and map to a Long?
```
SELECT EXTRACT(epoch FROM my_interval)
``` | According to the link you should have a day followed by hours:minutes:seconds. So changing the code to something like the following assuming you never need to have more then 23 hours 59 minutes in the interval.
```
statement.setString(index, "'0 "+ hours +":"
+ intervalFormat.format(minutes) + ":"
+ intervalFormat.f... |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | You don't have to write your own Hibernate custom type to map the PostgreSQL `interval` column to a Java `Duration` object. All you need to do is use the [Hibernate Ttypes](https://github.com/vladmihalcea/hibernate-types) project.
So, after adding the proper Hibernate dependency:
```
<dependency>
<groupId>com.vla... | According to the link you should have a day followed by hours:minutes:seconds. So changing the code to something like the following assuming you never need to have more then 23 hours 59 minutes in the interval.
```
statement.setString(index, "'0 "+ hours +":"
+ intervalFormat.format(minutes) + ":"
+ intervalFormat.f... |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | This is a working solution for JPA, Hibernate (with annotations).
This is the beginning of the entity class (for the table that has Interval column):
```
@Entity
@Table(name="table_with_interval_col")
@TypeDef(name="interval", typeClass = Interval.class)
public class TableWithIntervalCol implements Serializable {
``... | PostgreSQL has a date\_part / extract function which you can use to return different fields, epoch being one of them. When extracting the epoch from an interval, you receive the number of seconds contained in the interval, and from there you can convert however you wish. I lost my experience with Hibernate, but you can... |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | This is a working solution for JPA, Hibernate (with annotations).
This is the beginning of the entity class (for the table that has Interval column):
```
@Entity
@Table(name="table_with_interval_col")
@TypeDef(name="interval", typeClass = Interval.class)
public class TableWithIntervalCol implements Serializable {
``... | Why not just turn it into a numeric and map to a Long?
```
SELECT EXTRACT(epoch FROM my_interval)
``` |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | Why not just turn it into a numeric and map to a Long?
```
SELECT EXTRACT(epoch FROM my_interval)
``` | PostgreSQL has a date\_part / extract function which you can use to return different fields, epoch being one of them. When extracting the epoch from an interval, you receive the number of seconds contained in the interval, and from there you can convert however you wish. I lost my experience with Hibernate, but you can... |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | You don't have to write your own Hibernate custom type to map the PostgreSQL `interval` column to a Java `Duration` object. All you need to do is use the [Hibernate Ttypes](https://github.com/vladmihalcea/hibernate-types) project.
So, after adding the proper Hibernate dependency:
```
<dependency>
<groupId>com.vla... | PostgreSQL has a date\_part / extract function which you can use to return different fields, epoch being one of them. When extracting the epoch from an interval, you receive the number of seconds contained in the interval, and from there you can convert however you wish. I lost my experience with Hibernate, but you can... |
1,945,615 | Under PostgreSQL, I'm using `PersistentDuration` for the mapping between the sql type interval & duration but it doesn't work.
Another user found the same issue & come with his own class:
```
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException... | 2009/12/22 | [
"https://Stackoverflow.com/questions/1945615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236772/"
] | You don't have to write your own Hibernate custom type to map the PostgreSQL `interval` column to a Java `Duration` object. All you need to do is use the [Hibernate Ttypes](https://github.com/vladmihalcea/hibernate-types) project.
So, after adding the proper Hibernate dependency:
```
<dependency>
<groupId>com.vla... | Why not just turn it into a numeric and map to a Long?
```
SELECT EXTRACT(epoch FROM my_interval)
``` |
71,787,507 | I am trying to make an simple login form using javascript,also don't able to find any error,please help me to succesfully implement it.Here is code
```
function validate()
{
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if (username == "admin" && pa... | 2022/04/07 | [
"https://Stackoverflow.com/questions/71787507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17930921/"
] | You can use this code:
```html
<input id = 'prepFormInput' type='number' className='prepNumber' value={props.prepField.numeral} onChange={props.handlePrep} placeholder='prep time' onkeydown="javascript: return ['Backspace','Delete','ArrowLeft','ArrowRight'].includes(event.code) ? true : !isNaN(Number(event.key)) && ev... | (For react Applications)
If someone has text input and wants to accept only whole numbers. You can use the following code.
```js
const numberInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
const eventCode = event.code.toLowerCase();
if (!(event.code !== null
&& (eventCode.includes("digi... |
58,854,260 | I'm writing my first Azure function (based on .NET Core 2.x), and I'm struggling to extend the app settings with my custom mapping table.
I have a file `local.settings.json`, and I have tried to extend it with a "custom" config section that contains a few "key/value" pairs - something like this:
```
{
"IsEncrypted"... | 2019/11/14 | [
"https://Stackoverflow.com/questions/58854260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13302/"
] | I did something similar using .net core 3.0
local.settings.json
```
{
"AppSettings":{
"MappingTable" : {
"01" : "Value1"
}
}
}
```
Reading appsettings:
```
private void AppSettings()
{
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirec... | ***A R G H ! ! !***
I knew it - such a stupid little mistake - but with rather massive consequences.....
In my startup class, I had this code (plus some more):
```
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddHttpClient(... |
27,199,816 | suppose this is right:
```
std::function< void() > callback = std::bind( &Test::blah, test );
```
can I just do
```
auto callback = std::bind(&Test::blah, test)
```
?
thanks | 2014/11/29 | [
"https://Stackoverflow.com/questions/27199816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2495795/"
] | The return value of `std::bind` is *unspecified* (§20.8.9.1.2), so you're basically forced to use `auto` with it. However, it returns a function object which can be stored in `std::function`, which allows the first line to work. | Yes, in fact all *three* of these could be used:
```
std::function< void() > callback1 = std::bind( &Test::blah, test );
auto callback2 = std::bind(&Test::blah, test);
auto callback3 = [=]() mutable {test.blah();};
```
My choice would be the lambda. |
27,199,816 | suppose this is right:
```
std::function< void() > callback = std::bind( &Test::blah, test );
```
can I just do
```
auto callback = std::bind(&Test::blah, test)
```
?
thanks | 2014/11/29 | [
"https://Stackoverflow.com/questions/27199816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2495795/"
] | The return value of `std::bind` is *unspecified* (§20.8.9.1.2), so you're basically forced to use `auto` with it. However, it returns a function object which can be stored in `std::function`, which allows the first line to work. | Try this:
```
struct f {
virtual void func(auto a) = 0;
};
struct g {
virtual void func(std::function<void()> a) = 0;
};
```
They are two totally different things, and sometimes you can use `auto` but often not. Only function-local variables can be reasonably declared as `auto` (and maybe polylambdas in C++1... |
47,253,027 | *Context*: to achieve full "infrastructure as code", I want to codify the process of requesting a SSL certificate using `certbot`, validating a domain using DNS `TXT` records, uploading the certificate to Amazon Certificate Manager (ACM), and finally attaching the certificate ACM ARN to my Cloudfront distribution. This... | 2017/11/12 | [
"https://Stackoverflow.com/questions/47253027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45974/"
] | You *could* do it at deploy time, but certificates expire so it's best to make this a recurring thing.
When I was faced with this problem, I created a Lambda to upsert the SSL certificate and install it. (it needs a long timeout, but that's fine - it doesn't need to run often). The key it needs can be given as secure ... | Using [Step Functions](https://aws.amazon.com/step-functions/) would be the best choice for this particular use case. Since you have 3 distinct steps, they would be three seperate Lambda functions that Step Functions can pass inputs/outputs between as well as including wait times and retries. |
21,972,860 | How to call this function in Javascript?
As it takes *n* as its outer function's parameter and it also needs another parameter *i* in its function inside, but how to call it?
```
function foo(n) {
return function (i) {
return n += i } }
``` | 2014/02/23 | [
"https://Stackoverflow.com/questions/21972860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841121/"
] | Call the returned value of the function:
```
foo(1)(2);
``` | This is a function that returns a function. Often you would want a reference to that function, Like this
```
foofn = foo(7);
result = foofn(7);
```
You could also just call the function right away
```
result = (foo(7))(7);
```
What the function does? Well that wasn't really your question... |
21,972,860 | How to call this function in Javascript?
As it takes *n* as its outer function's parameter and it also needs another parameter *i* in its function inside, but how to call it?
```
function foo(n) {
return function (i) {
return n += i } }
``` | 2014/02/23 | [
"https://Stackoverflow.com/questions/21972860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841121/"
] | Call the returned value of the function:
```
foo(1)(2);
``` | This is the way we usually use JavaScript closures, first function creates a scope to keep the `n` variable safe to be used in the inner function:
```
var n = 11;
var myfunc = foo(n);
```
now you can call your `myfunc` function, with a simple `i` argument, whereas it uses `n` without you needing to pass it directly ... |
21,972,860 | How to call this function in Javascript?
As it takes *n* as its outer function's parameter and it also needs another parameter *i* in its function inside, but how to call it?
```
function foo(n) {
return function (i) {
return n += i } }
``` | 2014/02/23 | [
"https://Stackoverflow.com/questions/21972860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841121/"
] | It a classic [closure](https://stackoverflow.com/q/111102/1048572) example: it does return a function which has access to the `n` variable.
```
var counter = foo(0);
counter(1); // 1
counter(2); // 3
counter(5); // 8
``` | This is a function that returns a function. Often you would want a reference to that function, Like this
```
foofn = foo(7);
result = foofn(7);
```
You could also just call the function right away
```
result = (foo(7))(7);
```
What the function does? Well that wasn't really your question... |
21,972,860 | How to call this function in Javascript?
As it takes *n* as its outer function's parameter and it also needs another parameter *i* in its function inside, but how to call it?
```
function foo(n) {
return function (i) {
return n += i } }
``` | 2014/02/23 | [
"https://Stackoverflow.com/questions/21972860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841121/"
] | It a classic [closure](https://stackoverflow.com/q/111102/1048572) example: it does return a function which has access to the `n` variable.
```
var counter = foo(0);
counter(1); // 1
counter(2); // 3
counter(5); // 8
``` | This is the way we usually use JavaScript closures, first function creates a scope to keep the `n` variable safe to be used in the inner function:
```
var n = 11;
var myfunc = foo(n);
```
now you can call your `myfunc` function, with a simple `i` argument, whereas it uses `n` without you needing to pass it directly ... |
30,491,617 | I am working on a project and currently working on one of the views which is a page of different categories. Everything is rendering correctly however it's also putting the db info in the page.
Here is the code of my view
```
<div class="categories">
<div class="container blurbs">
<div class="cards row">... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4946228/"
] | Try this code:
```
public int findSong(String title) {
int index = -1;
// Iterate over the elements of the list
for (Song song : songs) {
if (song.getTitle().equals(title)) index = songs.indexOf(song);
}
// If you didn't know here we have if / else
// if index == -1 print song not found... | You could to override equal function for your `Song` class to return `true` if two songs names are equal:
```
public class Song{
//Your other fields and functions ....
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Song))
return false;
if (obj == this)
... |
30,491,617 | I am working on a project and currently working on one of the views which is a page of different categories. Everything is rendering correctly however it's also putting the db info in the page.
Here is the code of my view
```
<div class="categories">
<div class="container blurbs">
<div class="cards row">... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4946228/"
] | ```
public int findSong(String title, List<Song> songs) {
for (Song song : songs) {
if (song == null || song.getTitle() == null) {
continue;
}
if (song.getTitle().equals(title)) {
int index = songs.indexOf(song);
System.out.println(index);
return index;
}
}
... | You could to override equal function for your `Song` class to return `true` if two songs names are equal:
```
public class Song{
//Your other fields and functions ....
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Song))
return false;
if (obj == this)
... |
30,491,617 | I am working on a project and currently working on one of the views which is a page of different categories. Everything is rendering correctly however it's also putting the db info in the page.
Here is the code of my view
```
<div class="categories">
<div class="container blurbs">
<div class="cards row">... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4946228/"
] | Try this code:
```
public int findSong(String title) {
int index = -1;
// Iterate over the elements of the list
for (Song song : songs) {
if (song.getTitle().equals(title)) index = songs.indexOf(song);
}
// If you didn't know here we have if / else
// if index == -1 print song not found... | ```
public int findSong(String searchtitle) {
String str;
int index = 0;
for(Song s : songs){
if(s.title.equalsIgnoreCase(searchtitle))
return index;
index++;
}
}
``` |
30,491,617 | I am working on a project and currently working on one of the views which is a page of different categories. Everything is rendering correctly however it's also putting the db info in the page.
Here is the code of my view
```
<div class="categories">
<div class="container blurbs">
<div class="cards row">... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4946228/"
] | Try this code:
```
public int findSong(String title) {
int index = -1;
// Iterate over the elements of the list
for (Song song : songs) {
if (song.getTitle().equals(title)) index = songs.indexOf(song);
}
// If you didn't know here we have if / else
// if index == -1 print song not found... | ```
public int findSong(String title, List<Song> songs) {
for (Song song : songs) {
if (song == null || song.getTitle() == null) {
continue;
}
if (song.getTitle().equals(title)) {
int index = songs.indexOf(song);
System.out.println(index);
return index;
}
}
... |
30,491,617 | I am working on a project and currently working on one of the views which is a page of different categories. Everything is rendering correctly however it's also putting the db info in the page.
Here is the code of my view
```
<div class="categories">
<div class="container blurbs">
<div class="cards row">... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4946228/"
] | Try this code:
```
public int findSong(String title) {
int index = -1;
// Iterate over the elements of the list
for (Song song : songs) {
if (song.getTitle().equals(title)) index = songs.indexOf(song);
}
// If you didn't know here we have if / else
// if index == -1 print song not found... | ```
import java.util.ArrayList;
import java.util.List;
public class SongDriver
{
public static void main(String[] args)
{
Song song1 = new Song();
Song song2 = new Song();
Song song3 = new Song();
song1.setTitle("song1");
song2.setTitle("help");
song3.setTitle(... |
30,491,617 | I am working on a project and currently working on one of the views which is a page of different categories. Everything is rendering correctly however it's also putting the db info in the page.
Here is the code of my view
```
<div class="categories">
<div class="container blurbs">
<div class="cards row">... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4946228/"
] | ```
public int findSong(String title, List<Song> songs) {
for (Song song : songs) {
if (song == null || song.getTitle() == null) {
continue;
}
if (song.getTitle().equals(title)) {
int index = songs.indexOf(song);
System.out.println(index);
return index;
}
}
... | ```
public int findSong(String searchtitle) {
String str;
int index = 0;
for(Song s : songs){
if(s.title.equalsIgnoreCase(searchtitle))
return index;
index++;
}
}
``` |
30,491,617 | I am working on a project and currently working on one of the views which is a page of different categories. Everything is rendering correctly however it's also putting the db info in the page.
Here is the code of my view
```
<div class="categories">
<div class="container blurbs">
<div class="cards row">... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30491617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4946228/"
] | ```
public int findSong(String title, List<Song> songs) {
for (Song song : songs) {
if (song == null || song.getTitle() == null) {
continue;
}
if (song.getTitle().equals(title)) {
int index = songs.indexOf(song);
System.out.println(index);
return index;
}
}
... | ```
import java.util.ArrayList;
import java.util.List;
public class SongDriver
{
public static void main(String[] args)
{
Song song1 = new Song();
Song song2 = new Song();
Song song3 = new Song();
song1.setTitle("song1");
song2.setTitle("help");
song3.setTitle(... |
18,762,658 | I have created a "People you may know" script in php. I have 2 tables, **users(user\_id, name, surname, email, profile)** and table **friends(friends\_id, user\_one, user\_two)**. I use the following script in order to select people that are friends of my friends:
```
<?php
$friends_of_friends = mysql_query(" SELECT ... | 2013/09/12 | [
"https://Stackoverflow.com/questions/18762658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2491321/"
] | Make use of a **`counter variable`** here like this
```
$i=0; // I have added here
while ($run_friends= mysql_fetch_assoc($friends_of_friends)) {
$friend_friend_id = $run_friends['user_id'];
$i++;// Increment the var
}//end while
echo $i;//Total number of users
?>
``` | $num\_of\_people=mysql\_num\_rows($not\_friends);
echo"$num\_of\_people";
You are printing it wrong, that's a string not the variable.
* Try this way.
echo $num\_of\_people; |
18,762,658 | I have created a "People you may know" script in php. I have 2 tables, **users(user\_id, name, surname, email, profile)** and table **friends(friends\_id, user\_one, user\_two)**. I use the following script in order to select people that are friends of my friends:
```
<?php
$friends_of_friends = mysql_query(" SELECT ... | 2013/09/12 | [
"https://Stackoverflow.com/questions/18762658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2491321/"
] | Shankar Damodaran is right use this
```
$i=0;
while ($run_friends= mysql_fetch_assoc($friends_of_friends)) {
$friend_friend_id = $run_friends['user_id'];
// friends of my friends that are not my friends
$check_friend_query = mysql_query(" SELECT friends_id from friends WHERE (user_one='$session_user_id' AN... | $num\_of\_people=mysql\_num\_rows($not\_friends);
echo"$num\_of\_people";
You are printing it wrong, that's a string not the variable.
* Try this way.
echo $num\_of\_people; |
263,782 | I couldn't find any information on what's the minimum Salesforce license to grant a support person permissions to do Subscriber Support in the LMA.
Can someone please point me to such information? | 2019/05/27 | [
"https://salesforce.stackexchange.com/questions/263782",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/256/"
] | Try clicking on your scratch org name( you have greyed it out) in the bottom bar and then selecting it as default. Or you can run `sfdx force:config:set defaultusername=Org_Alias` command from CLI or any script you are using. I face this issue everytime i create a new scratch org(4-5 times per day) and I always have to... | For me it was because the Salesforce org I was logged in did not have the DevHub features enabled (under Setup/Development/Dev Hub) and also because I was (wrongly) using a DevHub which has a namespace assigned - so impossible to create Scratch Orgs.
You need to create a separate org for that - follow [this link](ht... |
263,782 | I couldn't find any information on what's the minimum Salesforce license to grant a support person permissions to do Subscriber Support in the LMA.
Can someone please point me to such information? | 2019/05/27 | [
"https://salesforce.stackexchange.com/questions/263782",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/256/"
] | For me it was because the Salesforce org I was logged in did not have the DevHub features enabled (under Setup/Development/Dev Hub) and also because I was (wrongly) using a DevHub which has a namespace assigned - so impossible to create Scratch Orgs.
You need to create a separate org for that - follow [this link](ht... | Reauthorizing my DevHub helped in my case. |
263,782 | I couldn't find any information on what's the minimum Salesforce license to grant a support person permissions to do Subscriber Support in the LMA.
Can someone please point me to such information? | 2019/05/27 | [
"https://salesforce.stackexchange.com/questions/263782",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/256/"
] | Try clicking on your scratch org name( you have greyed it out) in the bottom bar and then selecting it as default. Or you can run `sfdx force:config:set defaultusername=Org_Alias` command from CLI or any script you are using. I face this issue everytime i create a new scratch org(4-5 times per day) and I always have to... | Reauthorizing my DevHub helped in my case. |
35,526,773 | I am using Butter Knife in my project along with the Material Design Libraries for the UI.
When attempting to create buttons using the Material Design Library i get a 'Class Cast Exception' because of the usage of Butter Knife.
Is there a way to fix this?
MainActivity.Java
```
@Bind(R.id.switch1) Switch switch;
@O... | 2016/02/20 | [
"https://Stackoverflow.com/questions/35526773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5401668/"
] | You are importing the wrong `Switch` - instead of importing `android.widget.Switch`, you need to import `com.gc.materialdesign.views.Switch` and use that class when defining your `switch` variable. | Remove the line
```
import android.widget.Switch;
```
and replace it with
```
import com.gc.materialdesign.views.Switch;
```
You've simply chosen to import the wrong `Switch` class. |
58,509,682 | When running spring-boot 2.2.0 in debug mode in both Eclipse 2019-06 and IntelliJ 2019.2, attempts to terminate the process via the IDE look like they kill the process (per the IDE), however, the java process is still running (verified by ps -ef | grep java).
When running non debug mode in Eclipse, the process can be ... | 2019/10/22 | [
"https://Stackoverflow.com/questions/58509682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12258871/"
] | With Spring Boot v2.2.0.RELEASE, JVM process forking is enabled by default when starting from the maven plugin:
<https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes#fork-enabled-by-default-in-maven-plugin>
At this time, Intellij's maven plugin in 2019.2 and earlier versions don't appear... | I had the same problem when I moved to 2.2.0 (+ JDK 11).
As @guidadic said : since 2.2.0, the JVM is forked by default.
Unfortunately for me, if I disable forking, I lose some features, like colour in the console, which worked before with no fork. In addition, forking allows to use DevTools, with live reloading, whic... |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | Now $$\tan\frac{\pi}{3}=\frac{\sin\frac{\pi}{3}}{\cos\frac{\pi}{3}}=\frac{\cos\frac{\pi}{6}}{\sin \frac{\pi}{6}}=\frac{\cos \frac{\pi}{6}}{\sqrt{1-\cos^2\frac{\pi}{6}}}=\frac{\frac{\sqrt{3}}{2}}{\sqrt{1-\frac{3}{4}}}=\frac{\sqrt{3}}{2}\cdot \frac{1}{\sqrt{\frac{1}{4}}}=\sqrt{3}$$ | \begin{align}
&\color{red}{\tan\left(\frac\pi3\right)}=\frac{\sin\left(\frac\pi3\right)}{\cos\left(\frac\pi3\right)}=\frac{\sqrt{1-\cos^2\left(\frac\pi3\right)}}{\cos\left(\frac\pi3\right)}=\frac{\sqrt{1-\left(2\color{blue}{\cos\left(\frac\pi6\right)}^2-1\right)^2}}{2\color{blue}{\cos\left(\frac\pi6\right)}^2-1}\\
&=\f... |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | Upto the sign, you can calculate the tan-value as $$\tan(x)=\frac{\sqrt{1-\cos^2(x)}}{\cos(x)}$$
Also note $$\cos(2x)=2\cos^2(x)-1$$ which allows you to calculate $\cos(\frac{\pi}{3})$ from $\cos(\frac{\pi}{6})$ | \begin{align}
&\color{red}{\tan\left(\frac\pi3\right)}=\frac{\sin\left(\frac\pi3\right)}{\cos\left(\frac\pi3\right)}=\frac{\sqrt{1-\cos^2\left(\frac\pi3\right)}}{\cos\left(\frac\pi3\right)}=\frac{\sqrt{1-\left(2\color{blue}{\cos\left(\frac\pi6\right)}^2-1\right)^2}}{2\color{blue}{\cos\left(\frac\pi6\right)}^2-1}\\
&=\f... |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | Now $$\tan\frac{\pi}{3}=\frac{\sin\frac{\pi}{3}}{\cos\frac{\pi}{3}}=\frac{\cos\frac{\pi}{6}}{\sin \frac{\pi}{6}}=\frac{\cos \frac{\pi}{6}}{\sqrt{1-\cos^2\frac{\pi}{6}}}=\frac{\frac{\sqrt{3}}{2}}{\sqrt{1-\frac{3}{4}}}=\frac{\sqrt{3}}{2}\cdot \frac{1}{\sqrt{\frac{1}{4}}}=\sqrt{3}$$ | $\sin(\pi/3) = \sqrt 3/2,$ and $\cos(\pi/3) = 1/2$.
Therefore, $$\tan(\pi/3) = \dfrac{\sin\left(\frac \pi 3\right)}{\cos\left(\frac \pi 3\right)} = \dfrac {\dfrac{\sqrt 3}2}{\dfrac 12}=\sqrt 3$$ |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | Just to use another elementary way, which shows all the passages:
$$\cos(60) = \cos(30+30) = \cos(30)\cos(30) - \sin(30)\sin(30)$$
The value of $\cos(30)$ you know it.
The value of $\sin(30)$ is derived from $\cos^2 + \sin^2 = 1$.
Again, once you found $\cos(60)$ you get the value of $\sin(60)$ for free.
Now you c... | Assume $x = \frac\pi6$, thus $\frac\pi3 = 2x$
$$\tan\left(2x\right) = \frac{\sin\left(2x\right)}{\cos\left(2x\right)} = \frac{2\sin\left(x\right)\cos\left(x\right)}{2\cos^2\left(x\right)-1} = \frac{2\sin\left(x\right)\cos\left(x\right)}{2\cos^2\left(x\right)-1} = \frac{2\sqrt{\left(1-\cos^2\left(x\right)\right)}\cos\l... |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | Upto the sign, you can calculate the tan-value as $$\tan(x)=\frac{\sqrt{1-\cos^2(x)}}{\cos(x)}$$
Also note $$\cos(2x)=2\cos^2(x)-1$$ which allows you to calculate $\cos(\frac{\pi}{3})$ from $\cos(\frac{\pi}{6})$ | $\sin(\pi/3) = \sqrt 3/2,$ and $\cos(\pi/3) = 1/2$.
Therefore, $$\tan(\pi/3) = \dfrac{\sin\left(\frac \pi 3\right)}{\cos\left(\frac \pi 3\right)} = \dfrac {\dfrac{\sqrt 3}2}{\dfrac 12}=\sqrt 3$$ |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | \begin{align}
&\color{red}{\tan\left(\frac\pi3\right)}=\frac{\sin\left(\frac\pi3\right)}{\cos\left(\frac\pi3\right)}=\frac{\sqrt{1-\cos^2\left(\frac\pi3\right)}}{\cos\left(\frac\pi3\right)}=\frac{\sqrt{1-\left(2\color{blue}{\cos\left(\frac\pi6\right)}^2-1\right)^2}}{2\color{blue}{\cos\left(\frac\pi6\right)}^2-1}\\
&=\f... | $\sin(\pi/3) = \sqrt 3/2,$ and $\cos(\pi/3) = 1/2$.
Therefore, $$\tan(\pi/3) = \dfrac{\sin\left(\frac \pi 3\right)}{\cos\left(\frac \pi 3\right)} = \dfrac {\dfrac{\sqrt 3}2}{\dfrac 12}=\sqrt 3$$ |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | Now $$\tan\frac{\pi}{3}=\frac{\sin\frac{\pi}{3}}{\cos\frac{\pi}{3}}=\frac{\cos\frac{\pi}{6}}{\sin \frac{\pi}{6}}=\frac{\cos \frac{\pi}{6}}{\sqrt{1-\cos^2\frac{\pi}{6}}}=\frac{\frac{\sqrt{3}}{2}}{\sqrt{1-\frac{3}{4}}}=\frac{\sqrt{3}}{2}\cdot \frac{1}{\sqrt{\frac{1}{4}}}=\sqrt{3}$$ | Just to use another elementary way, which shows all the passages:
$$\cos(60) = \cos(30+30) = \cos(30)\cos(30) - \sin(30)\sin(30)$$
The value of $\cos(30)$ you know it.
The value of $\sin(30)$ is derived from $\cos^2 + \sin^2 = 1$.
Again, once you found $\cos(60)$ you get the value of $\sin(60)$ for free.
Now you c... |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | Just to use another elementary way, which shows all the passages:
$$\cos(60) = \cos(30+30) = \cos(30)\cos(30) - \sin(30)\sin(30)$$
The value of $\cos(30)$ you know it.
The value of $\sin(30)$ is derived from $\cos^2 + \sin^2 = 1$.
Again, once you found $\cos(60)$ you get the value of $\sin(60)$ for free.
Now you c... | $\sin(\pi/3) = \sqrt 3/2,$ and $\cos(\pi/3) = 1/2$.
Therefore, $$\tan(\pi/3) = \dfrac{\sin\left(\frac \pi 3\right)}{\cos\left(\frac \pi 3\right)} = \dfrac {\dfrac{\sqrt 3}2}{\dfrac 12}=\sqrt 3$$ |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | Now $$\tan\frac{\pi}{3}=\frac{\sin\frac{\pi}{3}}{\cos\frac{\pi}{3}}=\frac{\cos\frac{\pi}{6}}{\sin \frac{\pi}{6}}=\frac{\cos \frac{\pi}{6}}{\sqrt{1-\cos^2\frac{\pi}{6}}}=\frac{\frac{\sqrt{3}}{2}}{\sqrt{1-\frac{3}{4}}}=\frac{\sqrt{3}}{2}\cdot \frac{1}{\sqrt{\frac{1}{4}}}=\sqrt{3}$$ | Assume $x = \frac\pi6$, thus $\frac\pi3 = 2x$
$$\tan\left(2x\right) = \frac{\sin\left(2x\right)}{\cos\left(2x\right)} = \frac{2\sin\left(x\right)\cos\left(x\right)}{2\cos^2\left(x\right)-1} = \frac{2\sin\left(x\right)\cos\left(x\right)}{2\cos^2\left(x\right)-1} = \frac{2\sqrt{\left(1-\cos^2\left(x\right)\right)}\cos\l... |
3,079,899 | Given $\cos30 = \frac{\sqrt3}{2}$ use trigonometric identities to find the exact value of $\tan\frac{\pi}{3}$
I understand that $\cos30 = \frac{\sqrt3}{2}$ from the standard trig values chart and I know that $\frac{\pi}{3}$ is 60 degrees and I know the value of it from the same chart. I'm not understanding how to use ... | 2019/01/19 | [
"https://math.stackexchange.com/questions/3079899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/110755/"
] | \begin{align}
&\color{red}{\tan\left(\frac\pi3\right)}=\frac{\sin\left(\frac\pi3\right)}{\cos\left(\frac\pi3\right)}=\frac{\sqrt{1-\cos^2\left(\frac\pi3\right)}}{\cos\left(\frac\pi3\right)}=\frac{\sqrt{1-\left(2\color{blue}{\cos\left(\frac\pi6\right)}^2-1\right)^2}}{2\color{blue}{\cos\left(\frac\pi6\right)}^2-1}\\
&=\f... | Assume $x = \frac\pi6$, thus $\frac\pi3 = 2x$
$$\tan\left(2x\right) = \frac{\sin\left(2x\right)}{\cos\left(2x\right)} = \frac{2\sin\left(x\right)\cos\left(x\right)}{2\cos^2\left(x\right)-1} = \frac{2\sin\left(x\right)\cos\left(x\right)}{2\cos^2\left(x\right)-1} = \frac{2\sqrt{\left(1-\cos^2\left(x\right)\right)}\cos\l... |
15,461,908 | I wrote a small log-in java program that works with servlets, and JSPs using the MVC pattern that allows me to register and log-in accounts(if we can call them that) to my local mySQL DataBase. I am using sessions to pass values between the servlet and the JSP, and I have a list of if statements on the servlet that wor... | 2013/03/17 | [
"https://Stackoverflow.com/questions/15461908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1565919/"
] | 1. You don't need JavaScript to upload a file
2. I don't see how it would help. Just use a input of type file
3. You can of course use JavaScript, whatever you use at server-side to generate the HTML pages. Embedding JavaScript code inside HTML pages is a bad practice though. You should try to externalize the JS code t... | You can't read files with JS because it doesn't have permission to access the filesystem.
You will have to upload the file into the server and get the parsing done from there.
There are tons of examples for JSP file uploading in the net.
Most complex websites employ the technologies/libraries you have listed so the ... |
193,115 | Can I provide two plots made using two different softwares in a scientific paper? For example, one is plotted using Origin and another is plotted using Python? | 2023/02/02 | [
"https://academia.stackexchange.com/questions/193115",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/165354/"
] | It is not unusual to have plots created with different software if they are used to display different kind of data. But I would not plot the same kind of data in the same paper once with one software and once with another (unless there is a very convincing reason to do so, in case the reason should also be provided). | **Q:** Can I provide two plots made using two different softwares in a scientific paper?
**A:** Unless a publisher (and their review process) tells you otherwise, you can do whatever you want for figures.
Ideally, the plots in your paper will be consistent formatting with each other (e.g., same tick styles, label font... |
193,115 | Can I provide two plots made using two different softwares in a scientific paper? For example, one is plotted using Origin and another is plotted using Python? | 2023/02/02 | [
"https://academia.stackexchange.com/questions/193115",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/165354/"
] | It is not unusual to have plots created with different software if they are used to display different kind of data. But I would not plot the same kind of data in the same paper once with one software and once with another (unless there is a very convincing reason to do so, in case the reason should also be provided). | Using different applications for different plots is not uncommon, especially when there are collaborations among different groups which are accustomed to different applications.
For instance, I have a number of papers published with various groups across the world. I'm used to plotting graphs by using the workflow Mat... |
193,115 | Can I provide two plots made using two different softwares in a scientific paper? For example, one is plotted using Origin and another is plotted using Python? | 2023/02/02 | [
"https://academia.stackexchange.com/questions/193115",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/165354/"
] | It is not unusual to have plots created with different software if they are used to display different kind of data. But I would not plot the same kind of data in the same paper once with one software and once with another (unless there is a very convincing reason to do so, in case the reason should also be provided). | It will depend on how the journal operates. Many journals will be able to accept images you create. Others will want the data for a graph to typeset it themselves. Others will accept images sometimes for some types of figures, and want to plot the data themselves for others. For images, there will be image file formats... |
193,115 | Can I provide two plots made using two different softwares in a scientific paper? For example, one is plotted using Origin and another is plotted using Python? | 2023/02/02 | [
"https://academia.stackexchange.com/questions/193115",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/165354/"
] | Using different applications for different plots is not uncommon, especially when there are collaborations among different groups which are accustomed to different applications.
For instance, I have a number of papers published with various groups across the world. I'm used to plotting graphs by using the workflow Mat... | **Q:** Can I provide two plots made using two different softwares in a scientific paper?
**A:** Unless a publisher (and their review process) tells you otherwise, you can do whatever you want for figures.
Ideally, the plots in your paper will be consistent formatting with each other (e.g., same tick styles, label font... |
193,115 | Can I provide two plots made using two different softwares in a scientific paper? For example, one is plotted using Origin and another is plotted using Python? | 2023/02/02 | [
"https://academia.stackexchange.com/questions/193115",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/165354/"
] | Using different applications for different plots is not uncommon, especially when there are collaborations among different groups which are accustomed to different applications.
For instance, I have a number of papers published with various groups across the world. I'm used to plotting graphs by using the workflow Mat... | It will depend on how the journal operates. Many journals will be able to accept images you create. Others will want the data for a graph to typeset it themselves. Others will accept images sometimes for some types of figures, and want to plot the data themselves for others. For images, there will be image file formats... |
25,261,647 | Is it possible to encrypt/decrypt data with AES without installing extra modules? I need to send/receive data from `C#`, which is encrypted with the `System.Security.Cryptography` reference.
**UPDATE**
I have tried to use PyAES, but that is too old. I updated some things to make that work, but it didn't.
I've also can... | 2014/08/12 | [
"https://Stackoverflow.com/questions/25261647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902480/"
] | The available Cryptographic Services available in the Standard Library are [those](https://docs.python.org/3.4/library/crypto.html). As you can see `AES` is not listed, but is suggest to use [`pycrypto`](https://pypi.python.org/pypi/pycrypto) which is an *extra module*.
You just have to install it using *pip*, or *eas... | Python 3.6 with cryptography module
```
from cryptography.fernet import Fernet
key = Fernet.generate_key()
f = Fernet(key)
token = f.encrypt(b"my deep dark secret")
print(token)
f.decrypt(token)
``` |
25,261,647 | Is it possible to encrypt/decrypt data with AES without installing extra modules? I need to send/receive data from `C#`, which is encrypted with the `System.Security.Cryptography` reference.
**UPDATE**
I have tried to use PyAES, but that is too old. I updated some things to make that work, but it didn't.
I've also can... | 2014/08/12 | [
"https://Stackoverflow.com/questions/25261647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902480/"
] | I'm using [Cryptography](https://cryptography.io/en/latest/#) library.
>
> Cryptography is an actively developed library that provides
> cryptographic recipes and primitives. It supports Python 2.6-2.7,
> Python 3.3+ and PyPy.
>
>
>
[Here is an example](https://cryptography.io/en/latest/hazmat/primitives/symmet... | [Here is a self-contained implementation of AES compatible with Python 3](http://uthcode.googlecode.com/svn-history/r678/trunk/python/py3AES.py).
Example usage:
```
aesmodal = AESModeOfOperation()
key = [143,194,34,208,145,203,230,143,177,246,97,206,145,92,255,84]
iv = [103,35,148,239,76,213,47,118,255,222,123,176,1... |
25,261,647 | Is it possible to encrypt/decrypt data with AES without installing extra modules? I need to send/receive data from `C#`, which is encrypted with the `System.Security.Cryptography` reference.
**UPDATE**
I have tried to use PyAES, but that is too old. I updated some things to make that work, but it didn't.
I've also can... | 2014/08/12 | [
"https://Stackoverflow.com/questions/25261647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902480/"
] | The available Cryptographic Services available in the Standard Library are [those](https://docs.python.org/3.4/library/crypto.html). As you can see `AES` is not listed, but is suggest to use [`pycrypto`](https://pypi.python.org/pypi/pycrypto) which is an *extra module*.
You just have to install it using *pip*, or *eas... | [Here is a self-contained implementation of AES compatible with Python 3](http://uthcode.googlecode.com/svn-history/r678/trunk/python/py3AES.py).
Example usage:
```
aesmodal = AESModeOfOperation()
key = [143,194,34,208,145,203,230,143,177,246,97,206,145,92,255,84]
iv = [103,35,148,239,76,213,47,118,255,222,123,176,1... |
25,261,647 | Is it possible to encrypt/decrypt data with AES without installing extra modules? I need to send/receive data from `C#`, which is encrypted with the `System.Security.Cryptography` reference.
**UPDATE**
I have tried to use PyAES, but that is too old. I updated some things to make that work, but it didn't.
I've also can... | 2014/08/12 | [
"https://Stackoverflow.com/questions/25261647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902480/"
] | I'm using [Cryptography](https://cryptography.io/en/latest/#) library.
>
> Cryptography is an actively developed library that provides
> cryptographic recipes and primitives. It supports Python 2.6-2.7,
> Python 3.3+ and PyPy.
>
>
>
[Here is an example](https://cryptography.io/en/latest/hazmat/primitives/symmet... | Python 3.6 with cryptography module
```
from cryptography.fernet import Fernet
key = Fernet.generate_key()
f = Fernet(key)
token = f.encrypt(b"my deep dark secret")
print(token)
f.decrypt(token)
``` |
25,261,647 | Is it possible to encrypt/decrypt data with AES without installing extra modules? I need to send/receive data from `C#`, which is encrypted with the `System.Security.Cryptography` reference.
**UPDATE**
I have tried to use PyAES, but that is too old. I updated some things to make that work, but it didn't.
I've also can... | 2014/08/12 | [
"https://Stackoverflow.com/questions/25261647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902480/"
] | PYAES should work with any version of Python3.x. No need to modify the library.
Here is a complete working example for pyaes CTR mode for Python3.x
(<https://github.com/ricmoo/pyaes>)
```
import pyaes
# A 256 bit (32 byte) key
key = "This_key_for_demo_purposes_only!"
plaintext = "Text may be any length you wish, no ... | The available Cryptographic Services available in the Standard Library are [those](https://docs.python.org/3.4/library/crypto.html). As you can see `AES` is not listed, but is suggest to use [`pycrypto`](https://pypi.python.org/pypi/pycrypto) which is an *extra module*.
You just have to install it using *pip*, or *eas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.