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
296,084
I have a "block--system-menu-block.html.twig" file, which prints the menu content into the menu. ``` {# Menu. #} {% block content %} {{ content }} {% endblock %} ``` However, I would like each menu item (the resulting `<li>` elements) to get a unique ID. For example: ``` <li id="list-item-1">abc</li> <li id="list...
2020/08/18
[ "https://drupal.stackexchange.com/questions/296084", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/99609/" ]
(I show the annotation used from the [`\Drupal\node\Entity\Node`](https://api.drupal.org/api/drupal/core%21modules%21node%21src%21Entity%21Node.php/class/Node/8.9.x) class to make clear which keys need to be used and as example of values to assign to those keys.) Similarly to what done with nodes, the entity class ann...
After reading apaderno's answer and 2 days of research and development I figured out that some important steps are missing, in my opinion. Therefor I made a more detailed walkthrough. This contains part of apaderno's answer and much parts and copy and past of some code of the node module. I was using Drupal 9.3 to ap...
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
``` toString() ``` Is a method declared in class Object which all classes implicitly inherit from. The toString() method there returns the classname followed by @ followed by the hashCode() in a hex string by default. The Integer class, and many other classes, override this method to provide something useful. List ...
You can't avoid toString (), as that is how java gets the string representation of an object. x+"" calls x.toString().
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
Calling `myObject + ""` is equivilant to calling `myObject.toString() + ""`, so the `+ ""` is just redundant. **Question:** and what about doing it to integer? isn't it casting? **Answer:** It's an implicit call to String.valueOf()
toString() may not always print what you want. If you use it on objects\* that have not been overridden, it'll print the address of the object. You can overwrite toString() to behave as you need.
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
* When you do `+""` on an object you are really calling the `toString()` method. * If you do `+""` on an object that hasn't overwritten `toString()` then the `toString()` method of the `Object` class is called. Producing something like `MyClass@1948cc8c`. That way you know that `+""` is of no use without `toString()`.
The only difference i see with this approach ""+x is that no of intermediate objects can be more compare to just using toString. However this might not be always true because the jvm might perform some optimisation to avoid creation of multiple objects.Refer text in bold below: From [jls-15.18.1](http://docs.oracle.c...
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
Calling `myObject + ""` is equivilant to calling `myObject.toString() + ""`, so the `+ ""` is just redundant. **Question:** and what about doing it to integer? isn't it casting? **Answer:** It's an implicit call to String.valueOf()
they are almost the same except one difference: `myObject+""` will not throw NPE when myObject is null,but `myObject.toString()+""` will.
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
* When you do `+""` on an object you are really calling the `toString()` method. * If you do `+""` on an object that hasn't overwritten `toString()` then the `toString()` method of the `Object` class is called. Producing something like `MyClass@1948cc8c`. That way you know that `+""` is of no use without `toString()`.
toString() may not always print what you want. If you use it on objects\* that have not been overridden, it'll print the address of the object. You can overwrite toString() to behave as you need.
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
Calling `myObject + ""` is equivilant to calling `myObject.toString() + ""`, so the `+ ""` is just redundant. **Question:** and what about doing it to integer? isn't it casting? **Answer:** It's an implicit call to String.valueOf()
The only difference i see with this approach ""+x is that no of intermediate objects can be more compare to just using toString. However this might not be always true because the jvm might perform some optimisation to avoid creation of multiple objects.Refer text in bold below: From [jls-15.18.1](http://docs.oracle.c...
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
* When you do `+""` on an object you are really calling the `toString()` method. * If you do `+""` on an object that hasn't overwritten `toString()` then the `toString()` method of the `Object` class is called. Producing something like `MyClass@1948cc8c`. That way you know that `+""` is of no use without `toString()`.
Calling `myObject + ""` is equivalent to calling `String.valueOf(myObject) + ""`. String.valueOf() in turn is overloaded to do various things dependent on the argument type, including returning "null" for null object arguments, calling argument.toString() for non-null object arguments, or for example Integer.toString(i...
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
The only difference i see with this approach ""+x is that no of intermediate objects can be more compare to just using toString. However this might not be always true because the jvm might perform some optimisation to avoid creation of multiple objects.Refer text in bold below: From [jls-15.18.1](http://docs.oracle.c...
You can't avoid toString (), as that is how java gets the string representation of an object. x+"" calls x.toString().
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
``` toString() ``` Is a method declared in class Object which all classes implicitly inherit from. The toString() method there returns the classname followed by @ followed by the hashCode() in a hex string by default. The Integer class, and many other classes, override this method to provide something useful. List ...
toString() may not always print what you want. If you use it on objects\* that have not been overridden, it'll print the address of the object. You can overwrite toString() to behave as you need.
25,225,946
If I have almost any kind of data type (that I can remember), I can do the following: 1. `int x = 5;` Call function with definition ``` function_name(String x){ //do something } ``` like this **function\_name(x+"")**//can use (+"") to almost any kind that I can remember 2. And sometimes use `.toString()` to ...
2014/08/10
[ "https://Stackoverflow.com/questions/25225946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2770850/" ]
* When you do `+""` on an object you are really calling the `toString()` method. * If you do `+""` on an object that hasn't overwritten `toString()` then the `toString()` method of the `Object` class is called. Producing something like `MyClass@1948cc8c`. That way you know that `+""` is of no use without `toString()`.
they are almost the same except one difference: `myObject+""` will not throw NPE when myObject is null,but `myObject.toString()+""` will.
560,201
Suppose there are 2 scientists who have decided to measure the location of an electron at a same fixed time. Is possible that while one observes the wavepacket localized at (position=*x*) while the other observes the wavepacket localized at (position=*y*). The condition however is position *x* is not equal to *y*.Pleas...
2020/06/18
[ "https://physics.stackexchange.com/questions/560201", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/191417/" ]
I will confess that this I am not certain on this, as this is a quite odd question. but I have formulated what seems like a very reasonable answer. Also the very first thing to mention is that one cannot physically observe the wave-function, we can only predict how it evolves, and then measure a property of a particle,...
The OP specified that the two observers make their measurements simultaneously. Two simultaneous measurements of the same observable are equivalent to a single measurement, which can have only one result. Therefore, the observers must see the same result.
560,201
Suppose there are 2 scientists who have decided to measure the location of an electron at a same fixed time. Is possible that while one observes the wavepacket localized at (position=*x*) while the other observes the wavepacket localized at (position=*y*). The condition however is position *x* is not equal to *y*.Pleas...
2020/06/18
[ "https://physics.stackexchange.com/questions/560201", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/191417/" ]
In order to observe an electron one must interact with it in some way. For example one could shine light at it so that it scattered the light, or one could arrange for it to hit something like a multi-channel array (a charge detector with many small elements). The various observers will study some sort of large-scale s...
I will confess that this I am not certain on this, as this is a quite odd question. but I have formulated what seems like a very reasonable answer. Also the very first thing to mention is that one cannot physically observe the wave-function, we can only predict how it evolves, and then measure a property of a particle,...
560,201
Suppose there are 2 scientists who have decided to measure the location of an electron at a same fixed time. Is possible that while one observes the wavepacket localized at (position=*x*) while the other observes the wavepacket localized at (position=*y*). The condition however is position *x* is not equal to *y*.Pleas...
2020/06/18
[ "https://physics.stackexchange.com/questions/560201", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/191417/" ]
In order to observe an electron one must interact with it in some way. For example one could shine light at it so that it scattered the light, or one could arrange for it to hit something like a multi-channel array (a charge detector with many small elements). The various observers will study some sort of large-scale s...
The OP specified that the two observers make their measurements simultaneously. Two simultaneous measurements of the same observable are equivalent to a single measurement, which can have only one result. Therefore, the observers must see the same result.
68,162,438
Here my code so far, but return null value: ``` for ($i=0 ; $i<1000; $i++){ $link = $obj->results->address_components[$i]; var_dump($link->long_name); } ``` Tried to get json object off child items like in this google maps JSON, for examp...
2021/06/28
[ "https://Stackoverflow.com/questions/68162438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16323084/" ]
You can use `sample` - ``` data <- data.frame( int_end = as.Date("2017-06-14") - 0:364, users = runif(365) + seq(-140, 224)^2 / 10000, user_type=sample(c('active', 'inactive'), 365, replace = TRUE) ) ```
We can also use `sample` in `data.table` ``` library(data.table) setDT(data)[, user_type := sample(c("active", "inactive"), size = .N, replace = TRUE)] ```
68,162,438
Here my code so far, but return null value: ``` for ($i=0 ; $i<1000; $i++){ $link = $obj->results->address_components[$i]; var_dump($link->long_name); } ``` Tried to get json object off child items like in this google maps JSON, for examp...
2021/06/28
[ "https://Stackoverflow.com/questions/68162438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16323084/" ]
You can do: ``` library(dplyr) data <- data %>% mutate(user_type = sample(c("active","inactive"),size = nrow(data),replace = T)) ```
We can also use `sample` in `data.table` ``` library(data.table) setDT(data)[, user_type := sample(c("active", "inactive"), size = .N, replace = TRUE)] ```
28,682,283
I'm creating a system which quizes the user on integration and differentiation using python 3. when i display questions they are in a form like: ``` -25*x**(3/5)/3 + 6*x**(4/3) - 5*x**6/3 + x**2/2 - 4*x ``` How could I change it to a form like: ``` -25x^(3/5)/3 + 6x^(4/3) - 5x^6/3 + x^2/2 - 4x ``` Also I want it ...
2015/02/23
[ "https://Stackoverflow.com/questions/28682283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4589153/" ]
Given your example code, I think what you are asking is, "How do I set a dynamic number of variables after endlocal?" What you ask is not terribly intuitive, but it *is* possible. You can't use delayed expansion when compounding `set` with `endlocal`. A workaround can often be employed to use a `for` loop to `endlocal ...
You're attempting to use [tunneling](http://ss64.org/viewtopic.php?pid=3712#p3712) , but after endlocal you cannot use `!` to expand variables.Try this: ``` @echo off setlocal ENABLEDELAYEDEXPANSION set TB_1=test1 set TB_2=test2 set TB_ALL_VARS= for /F "tokens=1 delims==" %%x in ('set TB_') do ( set TB_ALL_VARS=%%...
61,915,879
I have a function where I'm trying to put some contents of a json file into an element. I receive this array from a function in the backend. My function prints out the same amount of objects, but not the specific items I'm trying to grab. The console log prints out the array just fine, so I know that part is working. ...
2020/05/20
[ "https://Stackoverflow.com/questions/61915879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13578781/" ]
Several issues * res not existing, * type not existing (it is Type and JS is case sensitive) * hmtl += an object does not work A [mcve](https://stackoverflow.com/help/minimal-reproducible-example) would have been useful like this: ```js const data = [ { "Type":"Ford", "Model":"mustang" }, { "Type":"Dodge",...
You're appending a JavaScript object to the html string, which would theoretically evaluate to `"[object Object]"` or something similar. If you want the `{}`s to display in the HTML itself, then simply wrap the object in quotations, or call `JSON.stringify(obj)`, to it. Secondly, you are trying to set the key of the ob...
14,916,400
For this code in a multiple thread environment, is the synchronized(c) necessary? ``` SynchronizedCounter c = new SynchronizedCounter(); synchronized(c){ c.increment(); c.value(); } public class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public sync...
2013/02/16
[ "https://Stackoverflow.com/questions/14916400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2079445/" ]
You need to execute your javascript code when the DOM is fully loaded. And use `modal` instead of `click` ``` $(document).ready(function() { $('#LaunchDemo').modal(options) }); ``` Demo: <http://jsfiddle.net/MgcDU/1998/>
Remove the **href="#myModal"** in the hyperlink tag because that is trying to link you to a part of the page. Also, you shouldn't need to specify the element type in your selector. It will be faster to just search for the element by ID.
14,916,400
For this code in a multiple thread environment, is the synchronized(c) necessary? ``` SynchronizedCounter c = new SynchronizedCounter(); synchronized(c){ c.increment(); c.value(); } public class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public sync...
2013/02/16
[ "https://Stackoverflow.com/questions/14916400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2079445/" ]
It wrong when the with of model was too big. You can try when set the stylesheet for modal class in bootstrap file {width:900} It will happen....
Remove the **href="#myModal"** in the hyperlink tag because that is trying to link you to a part of the page. Also, you shouldn't need to specify the element type in your selector. It will be faster to just search for the element by ID.
14,916,400
For this code in a multiple thread environment, is the synchronized(c) necessary? ``` SynchronizedCounter c = new SynchronizedCounter(); synchronized(c){ c.increment(); c.value(); } public class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public sync...
2013/02/16
[ "https://Stackoverflow.com/questions/14916400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2079445/" ]
Try removing the class `hide` from the modal div: `<div id="myModal" class="modal``hide``fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">`
Remove the **href="#myModal"** in the hyperlink tag because that is trying to link you to a part of the page. Also, you shouldn't need to specify the element type in your selector. It will be faster to just search for the element by ID.
14,916,400
For this code in a multiple thread environment, is the synchronized(c) necessary? ``` SynchronizedCounter c = new SynchronizedCounter(); synchronized(c){ c.increment(); c.value(); } public class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public sync...
2013/02/16
[ "https://Stackoverflow.com/questions/14916400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2079445/" ]
You need to execute your javascript code when the DOM is fully loaded. And use `modal` instead of `click` ``` $(document).ready(function() { $('#LaunchDemo').modal(options) }); ``` Demo: <http://jsfiddle.net/MgcDU/1998/>
It wrong when the with of model was too big. You can try when set the stylesheet for modal class in bootstrap file {width:900} It will happen....
14,916,400
For this code in a multiple thread environment, is the synchronized(c) necessary? ``` SynchronizedCounter c = new SynchronizedCounter(); synchronized(c){ c.increment(); c.value(); } public class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public sync...
2013/02/16
[ "https://Stackoverflow.com/questions/14916400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2079445/" ]
You need to execute your javascript code when the DOM is fully loaded. And use `modal` instead of `click` ``` $(document).ready(function() { $('#LaunchDemo').modal(options) }); ``` Demo: <http://jsfiddle.net/MgcDU/1998/>
Try removing the class `hide` from the modal div: `<div id="myModal" class="modal``hide``fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">`
25,230,363
I have a JavaPairDStream containing key-value pair. I need to convert it into a HashMap.I have tried doing the same with a normal JavaPairRDD by calling "collectAsMap()" function on it and its working but when I am trying to do the same on DStream, it fails. I am trying to achieve the same by converting "JavaPairDStre...
2014/08/10
[ "https://Stackoverflow.com/questions/25230363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2488981/" ]
At compile time, down casting is accepted as both **Map** and **HashMap** are in same inheritance. Although we dont get any compile time errors, we will get ClassCastException at run time. To avoid this problem, you could try this: Code: ``` JavaPairRDD<K, V> javaRDDPair = rddInstance.mapToPair(new PairFunction<T, K...
You could try ``` JavaPairDStream stream =... JavaPairRDD pairRdd=stream.compute(validTime); ``` which is equivalent of a kind of bucketing around validTime instants of type Time , as you are reasoning on a stream. Or, using forEachRDD, then wrap ``` JavaPairRDD<K,V> wrapRDD(RDD<scala.Tuple2<K,V>> rdd) ``` fr...
61,935
Both words mean "beautiful woman", but I guess the reason two words exist is because of some nuance. Am I right ?
2018/10/02
[ "https://japanese.stackexchange.com/questions/61935", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/29500/" ]
I see no semantic difference, but 佳人 is an uncommon outdated word. On BCCWJ, there are over 2000 instances of 美人 and only 28 instances of 佳人, most of which are part of certain old book titles (incl. [佳人之奇遇](https://ja.wikipedia.org/wiki/%E4%BD%B3%E4%BA%BA%E4%B9%8B%E5%A5%87%E9%81%87)) or idioms (incl. [佳人薄命](https://jis...
From super daijirin: > > び-じん [1][0] 【美人】 > > > 美しい容貌の女性。美女。麗人。 > > > 〔古くは,男子もさした。「玉のやうなる―,…もらひまして聟にいたします/浮世草子・胸算用 2」〕 > > > (Woman of beautiful appearance. In old times, was used for boys too.) ... > > か-じん [1][0] 【佳人】 > > > 美しい女の人。 > > > (A beautiful woman) ... Also note the small differences bet...
61,935
Both words mean "beautiful woman", but I guess the reason two words exist is because of some nuance. Am I right ?
2018/10/02
[ "https://japanese.stackexchange.com/questions/61935", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/29500/" ]
From super daijirin: > > び-じん [1][0] 【美人】 > > > 美しい容貌の女性。美女。麗人。 > > > 〔古くは,男子もさした。「玉のやうなる―,…もらひまして聟にいたします/浮世草子・胸算用 2」〕 > > > (Woman of beautiful appearance. In old times, was used for boys too.) ... > > か-じん [1][0] 【佳人】 > > > 美しい女の人。 > > > (A beautiful woman) ... Also note the small differences bet...
According to the dictionary, it seems that 佳人 can only refer to a woman, while 美人 may also refer to a man. <https://dictionary.goo.ne.jp/jn/40900/meaning/m0u/> <https://dictionary.goo.ne.jp/jn/286724/meaning/m0u/>
61,935
Both words mean "beautiful woman", but I guess the reason two words exist is because of some nuance. Am I right ?
2018/10/02
[ "https://japanese.stackexchange.com/questions/61935", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/29500/" ]
From super daijirin: > > び-じん [1][0] 【美人】 > > > 美しい容貌の女性。美女。麗人。 > > > 〔古くは,男子もさした。「玉のやうなる―,…もらひまして聟にいたします/浮世草子・胸算用 2」〕 > > > (Woman of beautiful appearance. In old times, was used for boys too.) ... > > か-じん [1][0] 【佳人】 > > > 美しい女の人。 > > > (A beautiful woman) ... Also note the small differences bet...
Not a native language speaker, but I've seen a phrase in a Chinese historical romance (set in ancient times) that went something like this: meiren (美人) is easy to find, jiaren (佳人) is difficult to seek. Which in this context I interpreted as meiren referring to outer, superficial beauty--i.e. anyone who is very very pr...
61,935
Both words mean "beautiful woman", but I guess the reason two words exist is because of some nuance. Am I right ?
2018/10/02
[ "https://japanese.stackexchange.com/questions/61935", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/29500/" ]
I see no semantic difference, but 佳人 is an uncommon outdated word. On BCCWJ, there are over 2000 instances of 美人 and only 28 instances of 佳人, most of which are part of certain old book titles (incl. [佳人之奇遇](https://ja.wikipedia.org/wiki/%E4%BD%B3%E4%BA%BA%E4%B9%8B%E5%A5%87%E9%81%87)) or idioms (incl. [佳人薄命](https://jis...
According to the dictionary, it seems that 佳人 can only refer to a woman, while 美人 may also refer to a man. <https://dictionary.goo.ne.jp/jn/40900/meaning/m0u/> <https://dictionary.goo.ne.jp/jn/286724/meaning/m0u/>
61,935
Both words mean "beautiful woman", but I guess the reason two words exist is because of some nuance. Am I right ?
2018/10/02
[ "https://japanese.stackexchange.com/questions/61935", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/29500/" ]
I see no semantic difference, but 佳人 is an uncommon outdated word. On BCCWJ, there are over 2000 instances of 美人 and only 28 instances of 佳人, most of which are part of certain old book titles (incl. [佳人之奇遇](https://ja.wikipedia.org/wiki/%E4%BD%B3%E4%BA%BA%E4%B9%8B%E5%A5%87%E9%81%87)) or idioms (incl. [佳人薄命](https://jis...
Not a native language speaker, but I've seen a phrase in a Chinese historical romance (set in ancient times) that went something like this: meiren (美人) is easy to find, jiaren (佳人) is difficult to seek. Which in this context I interpreted as meiren referring to outer, superficial beauty--i.e. anyone who is very very pr...
61,935
Both words mean "beautiful woman", but I guess the reason two words exist is because of some nuance. Am I right ?
2018/10/02
[ "https://japanese.stackexchange.com/questions/61935", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/29500/" ]
Not a native language speaker, but I've seen a phrase in a Chinese historical romance (set in ancient times) that went something like this: meiren (美人) is easy to find, jiaren (佳人) is difficult to seek. Which in this context I interpreted as meiren referring to outer, superficial beauty--i.e. anyone who is very very pr...
According to the dictionary, it seems that 佳人 can only refer to a woman, while 美人 may also refer to a man. <https://dictionary.goo.ne.jp/jn/40900/meaning/m0u/> <https://dictionary.goo.ne.jp/jn/286724/meaning/m0u/>
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
A common design pattern to address this is dependency injection. One form of dependency injection is called constructor injection. For this, create a constructor which accepts the object the class depends on. Then when you instantiate that class, you pass in the object you would like it to operate on (in your case your...
My way of solving this problem is to add a Scanner parameter to the method I am calling of the class that needs to use the Scanner, and then pass the scanner variable as an argument when calling the method. My main method: ``` import java.util.Scanner; public class ScannerTest { public static void main(String[] ...
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
A common design pattern to address this is dependency injection. One form of dependency injection is called constructor injection. For this, create a constructor which accepts the object the class depends on. Then when you instantiate that class, you pass in the object you would like it to operate on (in your case your...
Here is how I do it: 1. Create MyScanner.java in a new package (in this case: mypackage) ```java package mypackage; import java.util.Scanner; public class MyScanner { static Scanner scan = new Scanner(System.in); public static String scan() { return scan.next(); } public static String ...
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
``` public static final Scanner scan = new Scanner(System.in); ``` As you have declared `Scanner` instance as `public` and `static`. So you access it using the Class reference. Code in the other class. ``` String intpu = ClassName.scan.next(); ``` `ClassName` is the name of the class in which it is defined. Ther...
You can pass the Scanner object's reference to that Method in the call. something like `method(Scanner sc)`
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
``` public static final Scanner scan = new Scanner(System.in); ``` As you have declared `Scanner` instance as `public` and `static`. So you access it using the Class reference. Code in the other class. ``` String intpu = ClassName.scan.next(); ``` `ClassName` is the name of the class in which it is defined. Ther...
Here is how I do it: 1. Create MyScanner.java in a new package (in this case: mypackage) ```java package mypackage; import java.util.Scanner; public class MyScanner { static Scanner scan = new Scanner(System.in); public static String scan() { return scan.next(); } public static String ...
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
You can pass the Scanner object's reference to that Method in the call. something like `method(Scanner sc)`
My way of solving this problem is to add a Scanner parameter to the method I am calling of the class that needs to use the Scanner, and then pass the scanner variable as an argument when calling the method. My main method: ``` import java.util.Scanner; public class ScannerTest { public static void main(String[] ...
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
You could try `inheritance`: Super Class: ``` public class superclass { Scanner scan=new Scanner(System.in); //scanner object declared globally //constructor //other methods etc. } ``` Sub Class: ``` public class subclass extends superclass { //the scanner object can be inherited } ``` Using ...
Here is how I do it: 1. Create MyScanner.java in a new package (in this case: mypackage) ```java package mypackage; import java.util.Scanner; public class MyScanner { static Scanner scan = new Scanner(System.in); public static String scan() { return scan.next(); } public static String ...
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
A common design pattern to address this is dependency injection. One form of dependency injection is called constructor injection. For this, create a constructor which accepts the object the class depends on. Then when you instantiate that class, you pass in the object you would like it to operate on (in your case your...
You can pass the Scanner object's reference to that Method in the call. something like `method(Scanner sc)`
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
``` public static final Scanner scan = new Scanner(System.in); ``` As you have declared `Scanner` instance as `public` and `static`. So you access it using the Class reference. Code in the other class. ``` String intpu = ClassName.scan.next(); ``` `ClassName` is the name of the class in which it is defined. Ther...
My way of solving this problem is to add a Scanner parameter to the method I am calling of the class that needs to use the Scanner, and then pass the scanner variable as an argument when calling the method. My main method: ``` import java.util.Scanner; public class ScannerTest { public static void main(String[] ...
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
A common design pattern to address this is dependency injection. One form of dependency injection is called constructor injection. For this, create a constructor which accepts the object the class depends on. Then when you instantiate that class, you pass in the object you would like it to operate on (in your case your...
You could try `inheritance`: Super Class: ``` public class superclass { Scanner scan=new Scanner(System.in); //scanner object declared globally //constructor //other methods etc. } ``` Sub Class: ``` public class subclass extends superclass { //the scanner object can be inherited } ``` Using ...
34,474,045
So I have a simple Scanner object: ``` Scanner scan = new Scanner (System.in); ``` I am trying to use this Scanner object inside a method that I have declared in a different class. Is there anyway this can be done? I have also tried using: ``` public static final Scanner scan = new Scanner(System.in); ``` but thi...
2015/12/26
[ "https://Stackoverflow.com/questions/34474045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5705283/" ]
You could try `inheritance`: Super Class: ``` public class superclass { Scanner scan=new Scanner(System.in); //scanner object declared globally //constructor //other methods etc. } ``` Sub Class: ``` public class subclass extends superclass { //the scanner object can be inherited } ``` Using ...
My way of solving this problem is to add a Scanner parameter to the method I am calling of the class that needs to use the Scanner, and then pass the scanner variable as an argument when calling the method. My main method: ``` import java.util.Scanner; public class ScannerTest { public static void main(String[] ...
63,932,486
table: ``` ID status CREATED TIME OD01 CLOSED 12-09-2020 OD01 OPEN 10-09-2020 OD02 CLOSED 09-09-2020 OD02 CLOSED 07-09-2020 OD03 OPEN 04-09-2020 OD03 OPEN 06-09-2020 ``` I WANT OUTPUT as ID IS SAME AND BOTH THE SHOULD BE CLOSED
2020/09/17
[ "https://Stackoverflow.com/questions/63932486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14292168/" ]
``` select id from your_table group by id having sum(case when status = 'closed' then 1 else 0 end) >= 2 ``` or ``` select id from your_table where status = 'closed' group by id having count(*) >= 2 ```
You can try the below - ``` select id from tablename group by id having max(status)='closed' and min(status)='closed' ``` OR Alternatively you can try this too - using `not exists` ``` select distinct id from tablename t where not exists (select 1 from tablename t1 where t.id=t1.id and status='open') ```
63,932,486
table: ``` ID status CREATED TIME OD01 CLOSED 12-09-2020 OD01 OPEN 10-09-2020 OD02 CLOSED 09-09-2020 OD02 CLOSED 07-09-2020 OD03 OPEN 04-09-2020 OD03 OPEN 06-09-2020 ``` I WANT OUTPUT as ID IS SAME AND BOTH THE SHOULD BE CLOSED
2020/09/17
[ "https://Stackoverflow.com/questions/63932486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14292168/" ]
``` select id from your_table group by id having sum(case when status = 'closed' then 1 else 0 end) >= 2 ``` or ``` select id from your_table where status = 'closed' group by id having count(*) >= 2 ```
> > I WANT OUTPUT as ID IS SAME AND BOTH THE SHOULD BE CLOSED > > > I interpret this as: ``` select id from t group by id having count(*) = 2 and -- exactly two rows min(status) = max(status) and -- status values are the same min(status) = 'closed'; -- the one status value i...
222,187
Jeff Atwood has started [Discourse](http://www.discourse.org/) site which is now in beta phase. Do you plan to integrate a similar concept for discussions, for example a new site where 'not constructive' questions, such as [Django OR Rails [closed]](https://stackoverflow.com/questions/3042259/django-or-rails) could be...
2014/02/20
[ "https://meta.stackexchange.com/questions/222187", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/231242/" ]
First of all Discourse is [not owned by Stack Exchange](http://blog.discourse.org/2013/02/the-discourse-team/). Second Stack Exchange is not [a forum](http://www.discourse.org/about/). If we discourage non constructive question on one site, why should we allow them on another site? Also, we have [Area51](http://area51....
The best products are those that focus on a singular goal. While folks in the past have attempted to turn Stack Exchange into discussion platforms, the Stack Exchange team actively discourages such attempts by shutting down such proposals in Area 51. Without a clear goal, it would be difficult to replicate the success...
222,187
Jeff Atwood has started [Discourse](http://www.discourse.org/) site which is now in beta phase. Do you plan to integrate a similar concept for discussions, for example a new site where 'not constructive' questions, such as [Django OR Rails [closed]](https://stackoverflow.com/questions/3042259/django-or-rails) could be...
2014/02/20
[ "https://meta.stackexchange.com/questions/222187", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/231242/" ]
First of all Discourse is [not owned by Stack Exchange](http://blog.discourse.org/2013/02/the-discourse-team/). Second Stack Exchange is not [a forum](http://www.discourse.org/about/). If we discourage non constructive question on one site, why should we allow them on another site? Also, we have [Area51](http://area51....
The SE Q&A platform has time and again proven insufficient for meta (and Area 51) *discussion*. Hence I think that moving meta sites to a discussion platform -- Discourse or another -- would be a great move. A move that'd make developers cry, but still.
31,129,801
I want to create an api that various clients can connect to it like Web, Mobile platforms etc. My problem is that sometimes things are different with each client. For example i use different method for authentication for Web and Mobile platforms and my question is: > > I have to create different files for each type ...
2015/06/30
[ "https://Stackoverflow.com/questions/31129801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1037845/" ]
``` NO stick to a standard ``` If you are doing an API based you will first have to standardize the calls, you cant have X,Y,Z for a single function for different client. This will one day go out of hand. You must come into a standard agreement about the functions to be used, I am sure that at the client side this w...
There is definitely not 'the one and only' way to create an API. However, checking the type of client is definitely not the way to go, as it would mean checking headers, which can be forged when sending the request. For authentication, if you want to use different methods, your best bet is probably to have different ...
31,129,801
I want to create an api that various clients can connect to it like Web, Mobile platforms etc. My problem is that sometimes things are different with each client. For example i use different method for authentication for Web and Mobile platforms and my question is: > > I have to create different files for each type ...
2015/06/30
[ "https://Stackoverflow.com/questions/31129801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1037845/" ]
Well one of the most and the easiest way i've found to make Web-Service using [YII 2.0 Framework](http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html) What you need to do. 1. Create your database schema 2. Make Active Models using [Gii tool](http://www.yiiframework.com/doc-2.0/guide-tool-gii.html) for eac...
There is definitely not 'the one and only' way to create an API. However, checking the type of client is definitely not the way to go, as it would mean checking headers, which can be forged when sending the request. For authentication, if you want to use different methods, your best bet is probably to have different ...
25,381,753
I have created a database, a table, and entries in that table through basic `SELECT` and `INSERT INTO` commands. To view the entries I am using the basic query: ``` USE test1 SELECT * FROM orders ``` where test1 is Database and orders is Table name. I can see the entries. How can I store the results to a CSV? W...
2014/08/19
[ "https://Stackoverflow.com/questions/25381753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3955991/" ]
You do have the option to output to csv from within management studio, you can return your grid as normal then right click and click "Save results As..." or Using SQLMD as per question [How to export SQL Server 2005 query to CSV](https://stackoverflow.com/questions/799465/how-to-export-sql-server-2005-query-to-csv) ...
If you're not as familiar with SQL and would like a more graphical based approach, you could always use the Import/Export Wizard. Little more user-friendly to people who may be new to SQL.
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
The [cairo](http://www.cairographics.org/) library with the [pycairo](http://cairographics.org/pycairo/) (not py2cairo, that's for python 2) binding works with python 3.x and can produce PDF output (among others).
In the end I find it difficult to work with pycario/pango, pycairo stil misses some method for png's and PIL is not quite yet supported in python3, also carries a lot of dependencies (the idea of using pycario) so I end up porting a python 2 library to python 3, is not very advanced but gets the jobs done for some basi...
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
There is a new kid on the block which look promising. It supports print css features like page break. Try [weasyprint](http://weasyprint.org/)
In the end I find it difficult to work with pycario/pango, pycairo stil misses some method for png's and PIL is not quite yet supported in python3, also carries a lot of dependencies (the idea of using pycario) so I end up porting a python 2 library to python 3, is not very advanced but gets the jobs done for some basi...
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
You could got the HTML/CSS route and use [prince](http://princexml.com/) although it's not free software. If your source is not too complex, you can also try a pure python solution as in <http://code.activestate.com/recipes/189858-python-text-to-pdf-converter/>
You could shell out and call [text2pdf](http://www.eprg.org/pdfcorner/text2pdf/)
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
In the end I find it difficult to work with pycario/pango, pycairo stil misses some method for png's and PIL is not quite yet supported in python3, also carries a lot of dependencies (the idea of using pycario) so I end up porting a python 2 library to python 3, is not very advanced but gets the jobs done for some basi...
Pillow is a pretty good port of PIL to Python 3, and it's now available in Debian experimental and Ubuntu 13.04. That should unblock a Python 3 port of ReportLab, which I would love to see. @nakagami: your github report seems to fail for me with `python3 setup.py build` but it could be shallow. How official is your por...
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
There is a new kid on the block which look promising. It supports print css features like page break. Try [weasyprint](http://weasyprint.org/)
You could got the HTML/CSS route and use [prince](http://princexml.com/) although it's not free software. If your source is not too complex, you can also try a pure python solution as in <http://code.activestate.com/recipes/189858-python-text-to-pdf-converter/>
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
You could got the HTML/CSS route and use [prince](http://princexml.com/) although it's not free software. If your source is not too complex, you can also try a pure python solution as in <http://code.activestate.com/recipes/189858-python-text-to-pdf-converter/>
Port for 2.7 and 3.3 is currently a work in progress: <https://github.com/nakagami/reportlab> PIL has not yet been ported to Python3, so ReportLab will not work completely.
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
In the end I find it difficult to work with pycario/pango, pycairo stil misses some method for png's and PIL is not quite yet supported in python3, also carries a lot of dependencies (the idea of using pycario) so I end up porting a python 2 library to python 3, is not very advanced but gets the jobs done for some basi...
You could shell out and call [text2pdf](http://www.eprg.org/pdfcorner/text2pdf/)
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
The [cairo](http://www.cairographics.org/) library with the [pycairo](http://cairographics.org/pycairo/) (not py2cairo, that's for python 2) binding works with python 3.x and can produce PDF output (among others).
Port for 2.7 and 3.3 is currently a work in progress: <https://github.com/nakagami/reportlab> PIL has not yet been ported to Python3, so ReportLab will not work completely.
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
The [cairo](http://www.cairographics.org/) library with the [pycairo](http://cairographics.org/pycairo/) (not py2cairo, that's for python 2) binding works with python 3.x and can produce PDF output (among others).
You could shell out and call [text2pdf](http://www.eprg.org/pdfcorner/text2pdf/)
12,021,216
I have for some time looking for something to be able to create PDFs and integrate with my current project in Python 3. The usual references are [Reportlab](http://www.reportlab.com/software/opensource/rl-toolkit/) or [pyPDF](http://pybrary.net/pyPdf/). But these two are not yet compatible with Python 3. I do see that ...
2012/08/18
[ "https://Stackoverflow.com/questions/12021216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298371/" ]
There is a new kid on the block which look promising. It supports print css features like page break. Try [weasyprint](http://weasyprint.org/)
Port for 2.7 and 3.3 is currently a work in progress: <https://github.com/nakagami/reportlab> PIL has not yet been ported to Python3, so ReportLab will not work completely.
5,342,948
Right now i have a hibernate model on which i set a filter, then load it. I just need to perform different logic if there is at least one record found, vs if there are no records found. The problem is that loading all matching records can be very time consuming and inefficient. Is there a way to load the first model f...
2011/03/17
[ "https://Stackoverflow.com/questions/5342948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/329737/" ]
This is a pretty poor practice. There is no guarantee that it works on all servletcontainers other than Jetty. Even then, I'm not sure if it works on Jetty. At least, tt would make your webapp unportable to other containers. When the WAR is expanded (it's servletcontainer specific *if* and *where* the WAR will be expa...
You can print the current dir, parent dir using following code: ``` import java.io.File; public class FileOperations { public static void main (String args[]) { File dir1 = new File ("."); File dir2 = new File (".."); try { System.out.println ("Current dir : " + dir1.getCanonicalPath()); System.out.println ("...
5,342,948
Right now i have a hibernate model on which i set a filter, then load it. I just need to perform different logic if there is at least one record found, vs if there are no records found. The problem is that loading all matching records can be very time consuming and inefficient. Is there a way to load the first model f...
2011/03/17
[ "https://Stackoverflow.com/questions/5342948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/329737/" ]
This is a pretty poor practice. There is no guarantee that it works on all servletcontainers other than Jetty. Even then, I'm not sure if it works on Jetty. At least, tt would make your webapp unportable to other containers. When the WAR is expanded (it's servletcontainer specific *if* and *where* the WAR will be expa...
The startup.jar should set the jetty.home [system property](http://communitymapbuilder.org/display/JETTY/SystemProperties). Access it using `System.getProperty("jetty.home")`.
5,342,948
Right now i have a hibernate model on which i set a filter, then load it. I just need to perform different logic if there is at least one record found, vs if there are no records found. The problem is that loading all matching records can be very time consuming and inefficient. Is there a way to load the first model f...
2011/03/17
[ "https://Stackoverflow.com/questions/5342948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/329737/" ]
This is a pretty poor practice. There is no guarantee that it works on all servletcontainers other than Jetty. Even then, I'm not sure if it works on Jetty. At least, tt would make your webapp unportable to other containers. When the WAR is expanded (it's servletcontainer specific *if* and *where* the WAR will be expa...
Though `getRealPath` is likely to return a valid path when running your war file in Jetty, that is likely to be different when you'll switch to a different app server in future. It would be better to make it a configurable option in web.xml, using `init-param` for instance, which would simply contain an absolute path ...
3,706,655
I'd like to trigger a script to update some statistics when a user submits a new record, but I don't want the user to have to wait for the script to finish before being redirected. ``` >-- Time --> > redirect User -> User Does Stuff -> more stuff -> etc / ...
2010/09/14
[ "https://Stackoverflow.com/questions/3706655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/188930/" ]
I did a quick google search for [php background process](http://www.google.nl/search?hl=ja&source=hp&q=php+background+process&aq=f&aqi=&aql=&oq=&gs_rfai=) and most of the hits are suggesting using either [`exec`](http://jp2.php.net/manual/en/function.exec.php) or [`shell_exec`](http://jp2.php.net/manual/en/function.she...
Nice chart but: * We need to know more about your needs (e.g. is it possible to use cron or we need to display the stats asap?) * If you can use cron set up a small interval (5 mins) then poll your database for changes * If you can't use cron try to build your site fully with AJAX so you can safely run background proc...
3,706,655
I'd like to trigger a script to update some statistics when a user submits a new record, but I don't want the user to have to wait for the script to finish before being redirected. ``` >-- Time --> > redirect User -> User Does Stuff -> more stuff -> etc / ...
2010/09/14
[ "https://Stackoverflow.com/questions/3706655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/188930/" ]
If you just need a small code snippet i'd go for something like this: ``` <?php if($new_record) { exec("php /path/updateStats.php ".escapeshellarg($userid)." >/dev/null &"); your_redirect_call_etc(); } ``` redirecting the output stream and the '&' will lead to the exec call running independently from the the scr...
Nice chart but: * We need to know more about your needs (e.g. is it possible to use cron or we need to display the stats asap?) * If you can use cron set up a small interval (5 mins) then poll your database for changes * If you can't use cron try to build your site fully with AJAX so you can safely run background proc...
3,706,655
I'd like to trigger a script to update some statistics when a user submits a new record, but I don't want the user to have to wait for the script to finish before being redirected. ``` >-- Time --> > redirect User -> User Does Stuff -> more stuff -> etc / ...
2010/09/14
[ "https://Stackoverflow.com/questions/3706655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/188930/" ]
I did a quick google search for [php background process](http://www.google.nl/search?hl=ja&source=hp&q=php+background+process&aq=f&aqi=&aql=&oq=&gs_rfai=) and most of the hits are suggesting using either [`exec`](http://jp2.php.net/manual/en/function.exec.php) or [`shell_exec`](http://jp2.php.net/manual/en/function.she...
If you just need a small code snippet i'd go for something like this: ``` <?php if($new_record) { exec("php /path/updateStats.php ".escapeshellarg($userid)." >/dev/null &"); your_redirect_call_etc(); } ``` redirecting the output stream and the '&' will lead to the exec call running independently from the the scr...
8,650,974
So I use the built in local server on my Mac for building sites, and I was recently trying to install PEAR so that I could use SMTP mail functions, but seemed to have screwed something up, and it is now causing problems with my PHP mySQL connection. I was wondering, is there an easy way to just re-install a fresh copy...
2011/12/28
[ "https://Stackoverflow.com/questions/8650974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/708831/" ]
I would recommend using [MAMP](http://www.mamp.info/en/index.html) - it's basically a virtual environment for your entire Apache / MySQL / PHP installation. - I use it for all my development and never had an issue for it. Plus, it is all contained within one folder in your Applications directory, so upgrading / removin...
I'm running Mac OS X Mountain Lion on MBP and I faced some problems with apache myself. Out of the blue it stopped working and searched a lot of forums for answers, none of which gave me any. For this to work you will need the original "httpd-conf" file and the original "httpd-vhosts.conf" file. If you have those all...
33,319,290
I have a problem with the XPath function of pythons lxml. A minimal example is the following python code: ``` from lxml import html, etree text = """ <p class="goal"> <strong>Goal</strong> <br /> <ul><li>test</li></ul> </p> """ tree = html.fromstring(text) thesis_goal = tree.xpa...
2015/10/24
[ "https://Stackoverflow.com/questions/33319290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1232833/" ]
This is because `y` exists in two separate processes, i.e. two separate virtual address spaces. Changing one process won't affect the other process. Compare this with threads, where threads share the same process, i.e. the same virtual address space, change will be seen by all threads.
Static variables are initialized at load time (compile time), not at run time. In the fork(), the memory image is copied, including these initialized static vaiables. The child performs the increment, the parent not.
26,298,822
I have the below string : ``` FIELD,KEY,0,AREA,2,3,4 ``` I need to pick out the values of `key` and `area` and convert them to integer array .. e.g. ``` key = {0}; area = {2,3,4} ``` How could I achieve this?
2014/10/10
[ "https://Stackoverflow.com/questions/26298822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/789320/" ]
Simply: ``` String input = "FIELD,KEY,0,AREA,2,3,4"; String key = input.split(",")[1]; //gets "KEY" String keyValue = input.split(",")[2]; //gets "0" ``` As a homework, I'm leaving you the task to find the expression that gets `"AREA"`.
You can use `#indexOf` and `#split` to do this as ***I guess*** your format of `String` is like this ``` FIELD,KEY,key1,key2,ke3...,AREA,area1,area2,area3... ``` --- ``` String input = "FIELD,KEY,0,AREA,2,3,4"; int indexOfKEY=input.indexOf("KEY"); int indexOfAREA=input.indexOf("AREA"); String key[]=...
26,298,822
I have the below string : ``` FIELD,KEY,0,AREA,2,3,4 ``` I need to pick out the values of `key` and `area` and convert them to integer array .. e.g. ``` key = {0}; area = {2,3,4} ``` How could I achieve this?
2014/10/10
[ "https://Stackoverflow.com/questions/26298822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/789320/" ]
Simply: ``` String input = "FIELD,KEY,0,AREA,2,3,4"; String key = input.split(",")[1]; //gets "KEY" String keyValue = input.split(",")[2]; //gets "0" ``` As a homework, I'm leaving you the task to find the expression that gets `"AREA"`.
How about something like that: ``` static Map<String,List<Integer>> parse(String input) { Map<String,List<Integer>> result = new HashMap<String,List<Integer>>(); String[] items = input.split(","); int i = 0; while (i < items.length) { String name = items[i++]; List<Integer> list = new A...
26,298,822
I have the below string : ``` FIELD,KEY,0,AREA,2,3,4 ``` I need to pick out the values of `key` and `area` and convert them to integer array .. e.g. ``` key = {0}; area = {2,3,4} ``` How could I achieve this?
2014/10/10
[ "https://Stackoverflow.com/questions/26298822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/789320/" ]
You can use `#indexOf` and `#split` to do this as ***I guess*** your format of `String` is like this ``` FIELD,KEY,key1,key2,ke3...,AREA,area1,area2,area3... ``` --- ``` String input = "FIELD,KEY,0,AREA,2,3,4"; int indexOfKEY=input.indexOf("KEY"); int indexOfAREA=input.indexOf("AREA"); String key[]=...
How about something like that: ``` static Map<String,List<Integer>> parse(String input) { Map<String,List<Integer>> result = new HashMap<String,List<Integer>>(); String[] items = input.split(","); int i = 0; while (i < items.length) { String name = items[i++]; List<Integer> list = new A...
47,058,699
**Overview:** In the following code, I am supposed to highlight the last occurrence of an html element with id = "sample" i.e. "This is the last paragraph". However, "This is the first paragraph" gets highlighted instead. **Questions:** 1) Why is $("#sample:last").css("background-color", "yellow") not highlighting ...
2017/11/01
[ "https://Stackoverflow.com/questions/47058699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3551832/" ]
The problem is that you're using id's instead of a class. You can only use an id once. The proper way of doing is this is to give them all the same class and to use the class selector `.` combined with `:last`. ``` <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"> </script> <script> $(...
Because of you using duplicate ID's. Valid markup dose not allow duplicate ID. Id should be unique in a single DOM structure that's why there no :last pseudo class available for ID selector. You should use class instead ID in this case.
64,572,804
I need to concatenate a string and an integer and a string into a variable - in this case an input. The inputs are named as following: ``` DI_Section1_Valve AT %I*: BOOL; DI_Section2_Valve AT %I*: BOOL; DI_Section3_Valve AT %I*: BOOL; ``` Now, I want to loop through these (this is just a short example): ``` For i:...
2020/10/28
[ "https://Stackoverflow.com/questions/64572804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3116510/" ]
That technique is called variable variables. Unfortunately this is not available in ST. There are few ways around it. As I understand Twincat 3 is based on Codesys 3.5. That means UNION is available. There is also a trick that references to `BOOL` does not work as expected and one reference take one byte. So you cannot...
You can't access a variables by using strings. What you can do instead is manually create an array of pointers to the values you want to index, for example: ``` DI_Section1_Valve AT %I*: BOOL; DI_Section2_Valve AT %I*: BOOL; DI_Section3_Valve AT %I*: BOOL; DI_Section_Valves: ARRAY [1..3] OF POINTER TO...
237,095
I'd like to cut out clips from an .mkv video. How can I do that, without recompressing the file?
2011/01/24
[ "https://superuser.com/questions/237095", "https://superuser.com", "https://superuser.com/users/37874/" ]
[FFmpeg](http://ffmpeg.org/) supports MKV, and should let you capture a given portion of the input file without transcoding. Remember that MKV is just a container, so you may need to set the output video and audio codecs to match the input. For example, to cut out 20 seconds starting from 1:50 minutes, use: ``` ffmp...
[Boilsoft's MKV splitter](http://www.boilsoft.com/videosplitter/mkv-splitter.html) is what you need > > Boilsoft Video Splitter is very powerful MKV Splitter and MKV Cutter, split MKV, cut MKV without re-encode, So It is very fast and without any quality loss. > > >
237,095
I'd like to cut out clips from an .mkv video. How can I do that, without recompressing the file?
2011/01/24
[ "https://superuser.com/questions/237095", "https://superuser.com", "https://superuser.com/users/37874/" ]
[Boilsoft's MKV splitter](http://www.boilsoft.com/videosplitter/mkv-splitter.html) is what you need > > Boilsoft Video Splitter is very powerful MKV Splitter and MKV Cutter, split MKV, cut MKV without re-encode, So It is very fast and without any quality loss. > > >
Try this tool called MVK Cutter. You can download it [here](https://www.videohelp.com/software/MKV-Cutter). Basically you can open a MKV file and start cutting unwanted parts.
237,095
I'd like to cut out clips from an .mkv video. How can I do that, without recompressing the file?
2011/01/24
[ "https://superuser.com/questions/237095", "https://superuser.com", "https://superuser.com/users/37874/" ]
[FFmpeg](http://ffmpeg.org/) supports MKV, and should let you capture a given portion of the input file without transcoding. Remember that MKV is just a container, so you may need to set the output video and audio codecs to match the input. For example, to cut out 20 seconds starting from 1:50 minutes, use: ``` ffmp...
Try this tool called MVK Cutter. You can download it [here](https://www.videohelp.com/software/MKV-Cutter). Basically you can open a MKV file and start cutting unwanted parts.
35,088,372
I have a rules engine that takes a string as a name of a rule, and compares it to a string, predicate dictionary. I'm writing a rule that will compare two datetimes and return true if they match, but allow a windows of a configurable number of seconds. Ideally, I'd like for my string/predicate key value pair to look so...
2016/01/29
[ "https://Stackoverflow.com/questions/35088372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2241019/" ]
Assuming that you need a way to count the days, excluding weekend, in an interval of dates, you may try something like this: ``` SELECT SUM( DECODE( TO_CHAR(TO_DATE('01-01-2016', 'dd-mm-yyyy') + LEVEL - 1, 'd'), '6', 0, '7', 0, 1 ) ...
I have not read your entire submission but to remove weekends from a calculation you can use the following: ``` select sum(end_dt - start_dt) * 24 * 60 work_minutes into v_return from t where trunc(start_dt) - trunc(start_dt,'iw') < 5; -- exclude weekends RETURN v_return; ``` This is taken from ...
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
I found the simplest answer to this. Just go gradle.properties file and change the enableUnitTestBinaryResources from true to false ``` android.enableUnitTestBinaryResources=false ``` The snapshot is shown below [![enter image description here](https://i.stack.imgur.com/tL6mc.jpg)](https://i.stack.imgur.com/tL6mc....
Whenever you update your Gradle files do not forget to check the compatible Gradle wrapper `distibutionUrl`, in your case it happened because of the same. distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
**One of the causes of the following error could be that exists an incompatibility with the configured version of the JVM in the project regarding the JDK location.** Error: ``` org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'com.android.application'] Caused by: jav...
In my case I'm using gradle version 7.0.3. It needed to add `kotlin("android")` in `build.gradle.kts`: ``` plugins { id("com.android.application") kotlin("android") //<---------- add this } ``` Then you had to use JDK version 11 ([download here](https://www.oracle.com/java/technologies/downloads/#java11-win...
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
Just go to the `gradle.properties` file and change `enableUnitTestBinaryResources` from `true` to `false` ``` android.enableUnitTestBinaryResources=false ```
First update the gradle to the latest version, if the issue still persists (in my case it did) then do the below- go to gradle.properties file and **comment** the line android.enableUnitTestBinaryResources=true click on sync now. it should solve the issue.
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
On Mac Just Goto : Android Studio -> Preference -> Gradle -> Gradle JDK -> Download JDK -> Ok [![Here is screen](https://i.stack.imgur.com/tC42v.png)](https://i.stack.imgur.com/tC42v.png)
delete `C:\Users\username\.gradle\caches` folder.
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
Inside my project there is a `.gradle` folder which had cached the previous gradle version I was using (5.4.1) and gradle kept using *that* instead of my newly downloaded one (5.6.4). Simply: 1. **Close** Android Studio 2. **Delete** the older gradle version folders from your project. 3. **Restart** Android Studio. E...
In my case I'm using gradle version 7.0.3. It needed to add `kotlin("android")` in `build.gradle.kts`: ``` plugins { id("com.android.application") kotlin("android") //<---------- add this } ``` Then you had to use JDK version 11 ([download here](https://www.oracle.com/java/technologies/downloads/#java11-win...
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
In my case, if your version of build tools in the **build.gradle** file in the root folder like : > > classpath 'com.android.tools.build:gradle:3.x.x' <--- version of tools > > > is not supported by the Gradle installed in your project, you can check the build tools/plugin supported versions [here](https://devel...
First of all, before trying the most complicated things you should make the step easier, in my case this bug just happened on my way until the project contained 'spaces' for example: Replace: ``` C://Users/Silva Neto/OneDrive/Work space/project ``` With: ``` C://Users/SilvaNeto/OneDrive/Workspace/project ``` N...
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
As in Accepted post, the problem solved with updating gradle to 4.4.1. 1. Get Latest Gradle 4.4.1 from [here](https://downloads.gradle.org/distributions/gradle-4.4.1-all.zip) 2. Extract and put it in "C:\Program Files\Android\Android Studio\gradle" 3. Then from android studio go to "File -> Settings -> Build, Excecut...
This answer is only valid if you cloned your project. For example. I had an app for USA only and wanted to clone it for other countries. I copied the project then renamed each project folder with country name. The names were already in excel so using copy-paste some projects gave me this error. When I sorted by name, I...
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
First update the gradle to the latest version, if the issue still persists (in my case it did) then do the below- go to gradle.properties file and **comment** the line android.enableUnitTestBinaryResources=true click on sync now. it should solve the issue.
**non of above solution not worked for me but this is worked for me** just add in `gradle.properties` this line in `android.overridePathCheck=true` for more info : <https://www.programmersought.com/article/59853994468/>
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
i fixed it by upgrade to `gradle-5.6.4-all.zip` in project\gradle\wrapper\gradle-wrapper.properties ``` #Wed Mar 11 15:20:29 WAT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gra...
Add the following to the top of your `app/build.gradle` file ``` apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' ```
37,086,806
I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors. > > Error:(1, 1) A problem occurred evaluating project ':app'. > > > Failed to apply plugin [id 'com.android.application'] > > > Could not create plugin of type 'AppPlugin'. > > > I try this...
2016/05/07
[ "https://Stackoverflow.com/questions/37086806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216719/" ]
i fixed it by upgrade to `gradle-5.6.4-all.zip` in project\gradle\wrapper\gradle-wrapper.properties ``` #Wed Mar 11 15:20:29 WAT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gra...
you just need to change your project.gradle file. And sync your Gradle. ``` dependencies { classpath 'com.android.tools.build:gradle:2.2.2' } ```
5,626,914
Is there a similar way to write this regex without using possessive quantifiers (ie ++ and \*+ ? ``` boost::regex testing123("\"value\":\"((?:[^\\\"\\\\]++|\\\\.)*+)\""); ``` I think this is comparable(?): ``` boost::regex testing123("\"value\":\"(?>(?:(?>[^\\\"\\\\]+)|\\\\.)*)\""); ``` Update: It's trying to ma...
2011/04/11
[ "https://Stackoverflow.com/questions/5626914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121546/" ]
Possessive quantifiers are just syntactic sugar for atomic grouping, i.e. `(ab)*+` is equivalent to `(?>(ab)*)`. Using this, you can rewrite your whole expression without using possessive quantifiers.
I've found that it is a valuable skill to know how to write regular expressions using as few bells and whistles as possible: ``` "value":"([^\"]|\.)*" ``` What this is essentially saying is: * Match `"value":"` (the easy part) * Match zero or more occurances of: + Anything other than a `\` or `"`, OR + Match a `\...
379,973
Walter Lewin in one of his lectures (8.02 lect 5 <https://youtu.be/JhV-GOS4y8g?t=25m46s>) draws an example of a solid conducting heart. [![heart with cavity](https://i.stack.imgur.com/jn5wa.png)](https://i.stack.imgur.com/jn5wa.png) He then asks whether there would be any charge on the inner surface of the heart or ...
2018/01/14
[ "https://physics.stackexchange.com/questions/379973", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/179711/" ]
So as you probably already know, one of the properties of a conductor is that there cannot be any non-zero electric field inside the conducting material. Let us consider there to be a Gaussian surface inside of the heart-shape conductor (i.e. $\oint \vec E \cdot d\vec a = Q\_e /\epsilon\_0 $). Since there cannot be any...
There would be a non-zero electric field inside the heart if there were charges on the inner boundary. As you know, there can be no electric field inside a conductor.
37,795,389
``` def max(xs: List[Int]): Int = { if (xs.isEmpty) throw new java.util.NoSuchElementException("List is Empty") else max1(0,xs) def max1(num :Int, x : List[Int]) : Int = { if(x.isEmpty) return num else if(num>x.head) max1(num,x.tail) else max1(x.head,x.tail) } } ``` I am trying to Im...
2016/06/13
[ "https://Stackoverflow.com/questions/37795389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5475320/" ]
Put the definition of `max1` before the `if` statement. The return value of a function is the result of the last statement in its body. The way you have it now, the last statement is `def`, and it's result is `Unit`.
You can use these code to solve that problem. ``` object Maximum { def apply(numbers: List[Int]): Int = { if (numbers.isEmpty) throw new Exception("List shouldn't be empty") max(numbers) } private def max(numbers: List[Int], maxNumb: Int = 0): Int = numbers match { case x::xs => if (x > maxNumb) max...
37,795,389
``` def max(xs: List[Int]): Int = { if (xs.isEmpty) throw new java.util.NoSuchElementException("List is Empty") else max1(0,xs) def max1(num :Int, x : List[Int]) : Int = { if(x.isEmpty) return num else if(num>x.head) max1(num,x.tail) else max1(x.head,x.tail) } } ``` I am trying to Im...
2016/06/13
[ "https://Stackoverflow.com/questions/37795389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5475320/" ]
Put the definition of `max1` before the `if` statement. The return value of a function is the result of the last statement in its body. The way you have it now, the last statement is `def`, and it's result is `Unit`.
You can use user **require()** For example with this more idiomatic recursion code: ``` def max(xs: List[Int]): Int = { require( xs.nonEmpty, ">>> Empty List <<<" ) def max1( num:Int, x:List[Int] ) : Int = x match { case Nil => num case y :: ys => max1( (if( num>y ) num else y), ys ) } max1(0,xs) } ...
37,795,389
``` def max(xs: List[Int]): Int = { if (xs.isEmpty) throw new java.util.NoSuchElementException("List is Empty") else max1(0,xs) def max1(num :Int, x : List[Int]) : Int = { if(x.isEmpty) return num else if(num>x.head) max1(num,x.tail) else max1(x.head,x.tail) } } ``` I am trying to Im...
2016/06/13
[ "https://Stackoverflow.com/questions/37795389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5475320/" ]
Put the definition of `max1` before the `if` statement. The return value of a function is the result of the last statement in its body. The way you have it now, the last statement is `def`, and it's result is `Unit`.
Define ``` trait XInt case class N(i: Int) extends XInt case object NoInt extends XInt ``` and on pattern-matching an empty list return `NoInt` and otherwise an `N` instance.
37,795,389
``` def max(xs: List[Int]): Int = { if (xs.isEmpty) throw new java.util.NoSuchElementException("List is Empty") else max1(0,xs) def max1(num :Int, x : List[Int]) : Int = { if(x.isEmpty) return num else if(num>x.head) max1(num,x.tail) else max1(x.head,x.tail) } } ``` I am trying to Im...
2016/06/13
[ "https://Stackoverflow.com/questions/37795389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5475320/" ]
You can use user **require()** For example with this more idiomatic recursion code: ``` def max(xs: List[Int]): Int = { require( xs.nonEmpty, ">>> Empty List <<<" ) def max1( num:Int, x:List[Int] ) : Int = x match { case Nil => num case y :: ys => max1( (if( num>y ) num else y), ys ) } max1(0,xs) } ...
You can use these code to solve that problem. ``` object Maximum { def apply(numbers: List[Int]): Int = { if (numbers.isEmpty) throw new Exception("List shouldn't be empty") max(numbers) } private def max(numbers: List[Int], maxNumb: Int = 0): Int = numbers match { case x::xs => if (x > maxNumb) max...
37,795,389
``` def max(xs: List[Int]): Int = { if (xs.isEmpty) throw new java.util.NoSuchElementException("List is Empty") else max1(0,xs) def max1(num :Int, x : List[Int]) : Int = { if(x.isEmpty) return num else if(num>x.head) max1(num,x.tail) else max1(x.head,x.tail) } } ``` I am trying to Im...
2016/06/13
[ "https://Stackoverflow.com/questions/37795389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5475320/" ]
You can use user **require()** For example with this more idiomatic recursion code: ``` def max(xs: List[Int]): Int = { require( xs.nonEmpty, ">>> Empty List <<<" ) def max1( num:Int, x:List[Int] ) : Int = x match { case Nil => num case y :: ys => max1( (if( num>y ) num else y), ys ) } max1(0,xs) } ...
Define ``` trait XInt case class N(i: Int) extends XInt case object NoInt extends XInt ``` and on pattern-matching an empty list return `NoInt` and otherwise an `N` instance.
348,876
Suppose I have low level classes A, B, and C that are independent of each other. The functions in them take some input and does some computation and returns some output. Now suppose I want to create an executable where it read in some data and output some statistics with the flow of input->A.func1->B.func1->C.func1-...
2017/05/13
[ "https://softwareengineering.stackexchange.com/questions/348876", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/185036/" ]
There is nothing here that convinces me that you need any classes at all. What you're describing is functional composition: `a(b(c(x)))` Yes the code can be that simple. If you're in a functional language. But since you've mentioned classes no less that 12 times I assume you're in some kind of OO paradigm. Not sure i...
I see the following abstractions in your post. 1. Application Data -- possibly divided into Input Data and Output Data 2. Input Reader 3. Compute Engine - ABC 4. Helper classes of ABC - a, b, and c. 5. Output Writer To implement what you are shooting for, `main` can be as simple as: ``` int main() { InputData inp...
348,876
Suppose I have low level classes A, B, and C that are independent of each other. The functions in them take some input and does some computation and returns some output. Now suppose I want to create an executable where it read in some data and output some statistics with the flow of input->A.func1->B.func1->C.func1-...
2017/05/13
[ "https://softwareengineering.stackexchange.com/questions/348876", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/185036/" ]
Neither 1. nor 2. is always "better". Here is how I would typically make the decision: * start without an additional class ABC and call functions from A, B and C directly from main. If the orchestration logic is very simple, no need to change it. * as soon as the logic in `main` becomes more **complex**, needs **unit ...
There is nothing here that convinces me that you need any classes at all. What you're describing is functional composition: `a(b(c(x)))` Yes the code can be that simple. If you're in a functional language. But since you've mentioned classes no less that 12 times I assume you're in some kind of OO paradigm. Not sure i...
348,876
Suppose I have low level classes A, B, and C that are independent of each other. The functions in them take some input and does some computation and returns some output. Now suppose I want to create an executable where it read in some data and output some statistics with the flow of input->A.func1->B.func1->C.func1-...
2017/05/13
[ "https://softwareengineering.stackexchange.com/questions/348876", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/185036/" ]
Neither 1. nor 2. is always "better". Here is how I would typically make the decision: * start without an additional class ABC and call functions from A, B and C directly from main. If the orchestration logic is very simple, no need to change it. * as soon as the logic in `main` becomes more **complex**, needs **unit ...
I see the following abstractions in your post. 1. Application Data -- possibly divided into Input Data and Output Data 2. Input Reader 3. Compute Engine - ABC 4. Helper classes of ABC - a, b, and c. 5. Output Writer To implement what you are shooting for, `main` can be as simple as: ``` int main() { InputData inp...
316,382
Scenario: A user registers on a website and opts in to SMS. They provide a phone number and agree to the SMS Terms (as well as providing other unrelated for this scenario information). Problem: The data flows into SMFC via API Event. Using this, I can set up a Journey to fire off communications. HOWEVER, how do I a...
2020/08/10
[ "https://salesforce.stackexchange.com/questions/316382", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/87160/" ]
Your scenario is not well suited to Journey Builder. In order to send the Double Opt-In message from Journey Builder, you'd have to opt the contact into a keyword. What you're trying to do is eminently achievable using other tools at your disposal within Marketing Cloud. You have a variety of templates to choose from ...
If I understood correctly, you have a "form" in your website where the customer agree with the terms to receive SMS messages that is connected with a API event related with a Journey (consequently connected with a Data Extension) and you would like to create a Double Opt in scenario, Am I right? In this case, you can ...
11,067,193
when using a DBaaS (database as a service) such as Xeround with a Rails app hosted on EC2 instances, how is it possible to limit the number of concurrent connections to the database (according to the DB service plan limits) ? is it necessary to do so at all ? I know that ActiveRecord connections pool is per process an...
2012/06/16
[ "https://Stackoverflow.com/questions/11067193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1133291/" ]
Unfortunately there is no way to correctly limit the number of connections across multiple clients (applications). The only way, which is pretty much static and empirical, is to divide the number of max allowed connection by the number of apps and set the result as the connections limit per application.
Use a [Connection pool](http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/ConnectionPool.html) base class for managing Active Record database connections.
17,976,988
I'd like to create two vagrant machines via two vagrant files, and be able to ssh into them via PuTTY. I thought it might be as simple as port forwarding one of them via, say, port 2223 instead of 2222, and using two PuTTY connections. Despite my vagrant ssh-config looking like this: ``` HostName 127.0.0.1 User vagr...
2013/07/31
[ "https://Stackoverflow.com/questions/17976988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/353792/" ]
As per Vagrant Base Box specification, the default networking mode is NAT and port forwarding for SSH is enabled (guest 22 => host 2222). What you've done, changing the sshd\_config file within the guest won't work because that only changes the SSH port within the guest to 2223, **NOT** the host. For the 2nd vagrant ...
You can set any port you like by putting this in your vagrantfile: ``` config.vm.network "forwarded_port", guest: 22, host: 2223 ``` replacing 2223 with your port of choice - different for each VM, obviously. Note that this is in addition to the standard 2222 port forwarding, which will still be mapped for every V...
40,867
I am a novice runner and below is my running plan to achieve Half-marathon distance: ``` Mon - Rest Tue - 3km Wed - 5km Thur - 5km Friday - Cross training Sat. - Long Run(16km) Sun. - Rest /Cross training ``` Last week my long run was 15km and the week before it was 14km. I am planning to ...
2019/08/28
[ "https://fitness.stackexchange.com/questions/40867", "https://fitness.stackexchange.com", "https://fitness.stackexchange.com/users/31838/" ]
I'd take a look at the free [half marathon training plans](https://www.halhigdon.com/training/half-marathon-training/) from Hal Higdon. Plans are available for all skill levels. The general formula for the beginner plans is as follows: ``` Monday: rest Tuesday: 3 to 6 km run Wednesday: half of long run distance T...
You could also use Nike Running app, it has plans like the distance you want to run, it uses also height, weight, distance to generate the plan according to your needs. No, I don't work at Nike, I'm just a fellow runner. There are other similar running apps you can check as well. Good luck.
40,867
I am a novice runner and below is my running plan to achieve Half-marathon distance: ``` Mon - Rest Tue - 3km Wed - 5km Thur - 5km Friday - Cross training Sat. - Long Run(16km) Sun. - Rest /Cross training ``` Last week my long run was 15km and the week before it was 14km. I am planning to ...
2019/08/28
[ "https://fitness.stackexchange.com/questions/40867", "https://fitness.stackexchange.com", "https://fitness.stackexchange.com/users/31838/" ]
I'd take a look at the free [half marathon training plans](https://www.halhigdon.com/training/half-marathon-training/) from Hal Higdon. Plans are available for all skill levels. The general formula for the beginner plans is as follows: ``` Monday: rest Tuesday: 3 to 6 km run Wednesday: half of long run distance T...
The essential part of training for any marathon runner is endurance. You have to build the stamina required for the run you have selected; it can be a 5K, 10K, half marathon, or a full. For a beginner; I will suggest the following plan, [![enter image description here](https://i.stack.imgur.com/zkRvc.png)](https://i.s...
138,658
I'm applying for a graduate position. One professor answered my email and asked me some questions. Two of them are listed below: > > What are your short- and long-term academic/professional goals? > > > What are your short- and long-term personal goals? > > > I can talk about my professional goals in the first ...
2019/10/17
[ "https://academia.stackexchange.com/questions/138658", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/115210/" ]
I agree that the question could be interpreted as inappropriate. But, while it's impossible to know the professor's intention (were they trying to screen out applicants who want to start families, etc.?), I think it's safe to answer the question ASSUMING that they are interested in your academic goals that may not be d...
This sounds like an inappropriate question. This professor doesn’t seem to understand the meaning of the word “personal”, which is defined to mean “of or concerning one's private life, relationships, and emotions rather than matters connected with one's public or professional career”. I can’t tell you how you should a...