qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
50,250,475
I have the following scala object definition: ``` case class RecursiveSettings ( var recursiveFrom: Int, var recursiveTo: Int, var nonRecursiveFrom: Int, var nonRecursiveTo: Int, var betweenReach: Int, var scoresamephrase: Boolean ) ``` and I'm trying to get the variables from an ArrayBuf...
2018/05/09
[ "https://Stackoverflow.com/questions/50250475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9437756/" ]
You can get css file from below code: ``` <?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array...
Wrap with add\_action and this might work `<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_register_style('css-ui',get_template_directory_uri().'/assets/css/style.css' ); wp_enqueue_style('css-ui' ); }`
50,250,475
I have the following scala object definition: ``` case class RecursiveSettings ( var recursiveFrom: Int, var recursiveTo: Int, var nonRecursiveFrom: Int, var nonRecursiveTo: Int, var betweenReach: Int, var scoresamephrase: Boolean ) ``` and I'm trying to get the variables from an ArrayBuf...
2018/05/09
[ "https://Stackoverflow.com/questions/50250475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9437756/" ]
Still you have selected the answer I would like to answer on your last desire that you want this to work in a proper way that WordPress do. Please check **wp\_footer** is called before **body** tag closed or not. Action Hook **wp\_enqueue\_scripts** will called in **wp\_footer** function. Please try once and let me kno...
Wrap with add\_action and this might work `<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_register_style('css-ui',get_template_directory_uri().'/assets/css/style.css' ); wp_enqueue_style('css-ui' ); }`
21,712,652
Why doens't the following code throw a runtimeException? ``` public class Test2 extends Test { public static void main(String[] args) { char[] array = new char[]{'A', '\t', 'e', 'I', 'O', 'u', '\n', 'p'}; int count = 0; for (char c : array) { switch (c) { case 'A': con...
2014/02/11
[ "https://Stackoverflow.com/questions/21712652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1598149/" ]
> > This means there is an empty "default" in every switch or something? > > > Sort of. If no `case` matches the specified value, and there's no `default` case, nothing happens - it's as simple as that. From [section 14.11 of the JLS](http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.11): > > ...
Why do you expect any exception here? If value of `c` is not mentioned in any `case` statement nothing happens on current iteration of your loop, `switch` passes through and loop is going to the next iteration.
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
There's nothing in the framework, no. I would try to centralize the checks in as small a public API as possible, and then treat the data as valid for the rest of the time - just as you would for something like null checking. Of course, you still need to be careful if you perform any operations which could *create* a ne...
There isn't any support in the framework to declare `BigInteger` as `unsigned`. However, you could create a static method to check if the number is negative or not. ``` public static void ValidateBigIntForUnsigned(BigInteger bigInteger) { if(bigInteger.Sign < 0) throw new Exception("Only unsigned numbers are...
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
If you only use a reasonably small subset of the the BigInteger API, writing your own wrapper class is easy if laborious. Here is some sample code to demonstrate that it needn't be that big an operation: ``` public struct UnsignedBigInteger { private BigInteger value; private UnsignedBigInteger(BigInteger n) {...
There isn't any support in the framework to declare `BigInteger` as `unsigned`. However, you could create a static method to check if the number is negative or not. ``` public static void ValidateBigIntForUnsigned(BigInteger bigInteger) { if(bigInteger.Sign < 0) throw new Exception("Only unsigned numbers are...
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
Well, let's have a look at a simple example ``` uint a=1; uint b=2; uint c=a-b; Console.WriteLine(c); ``` gives you the output `4294967295` (=2^32-1). But what if you had an unsigned BigInteger with similar behaviour? ``` UBigInteger a(1); UBigInteger b(2); U...
There isn't any support in the framework to declare `BigInteger` as `unsigned`. However, you could create a static method to check if the number is negative or not. ``` public static void ValidateBigIntForUnsigned(BigInteger bigInteger) { if(bigInteger.Sign < 0) throw new Exception("Only unsigned numbers are...
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
There's nothing in the framework, no. I would try to centralize the checks in as small a public API as possible, and then treat the data as valid for the rest of the time - just as you would for something like null checking. Of course, you still need to be careful if you perform any operations which could *create* a ne...
If you only use a reasonably small subset of the the BigInteger API, writing your own wrapper class is easy if laborious. Here is some sample code to demonstrate that it needn't be that big an operation: ``` public struct UnsignedBigInteger { private BigInteger value; private UnsignedBigInteger(BigInteger n) {...
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
There's nothing in the framework, no. I would try to centralize the checks in as small a public API as possible, and then treat the data as valid for the rest of the time - just as you would for something like null checking. Of course, you still need to be careful if you perform any operations which could *create* a ne...
Well, let's have a look at a simple example ``` uint a=1; uint b=2; uint c=a-b; Console.WriteLine(c); ``` gives you the output `4294967295` (=2^32-1). But what if you had an unsigned BigInteger with similar behaviour? ``` UBigInteger a(1); UBigInteger b(2); U...
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
There's nothing in the framework, no. I would try to centralize the checks in as small a public API as possible, and then treat the data as valid for the rest of the time - just as you would for something like null checking. Of course, you still need to be careful if you perform any operations which could *create* a ne...
If negative values present such a problem, is possible to eliminate them somehow so that bad data(the negative values) doesn't even reach your logic ? This will eliminate the check all together. Could you post a short snippet of what you are doing ?
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
Well, let's have a look at a simple example ``` uint a=1; uint b=2; uint c=a-b; Console.WriteLine(c); ``` gives you the output `4294967295` (=2^32-1). But what if you had an unsigned BigInteger with similar behaviour? ``` UBigInteger a(1); UBigInteger b(2); U...
If you only use a reasonably small subset of the the BigInteger API, writing your own wrapper class is easy if laborious. Here is some sample code to demonstrate that it needn't be that big an operation: ``` public struct UnsignedBigInteger { private BigInteger value; private UnsignedBigInteger(BigInteger n) {...
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
If you only use a reasonably small subset of the the BigInteger API, writing your own wrapper class is easy if laborious. Here is some sample code to demonstrate that it needn't be that big an operation: ``` public struct UnsignedBigInteger { private BigInteger value; private UnsignedBigInteger(BigInteger n) {...
If negative values present such a problem, is possible to eliminate them somehow so that bad data(the negative values) doesn't even reach your logic ? This will eliminate the check all together. Could you post a short snippet of what you are doing ?
5,945,628
I'm familiar with the System.Numerics.BigInteger class, but in my app, I'm only ever dealing with positive integers. Negative integers are an error case, and it'd be nice if there was an unsigned equivalent of the BigInteger type so I could remove all of these checks. Does one exist?
2011/05/10
[ "https://Stackoverflow.com/questions/5945628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
Well, let's have a look at a simple example ``` uint a=1; uint b=2; uint c=a-b; Console.WriteLine(c); ``` gives you the output `4294967295` (=2^32-1). But what if you had an unsigned BigInteger with similar behaviour? ``` UBigInteger a(1); UBigInteger b(2); U...
If negative values present such a problem, is possible to eliminate them somehow so that bad data(the negative values) doesn't even reach your logic ? This will eliminate the check all together. Could you post a short snippet of what you are doing ?
909,804
I have some files I downloaded recently and I want to name. It is possible to do something like: ``` rename 's/ /_/g' $(ls -t | head -n5) ``` Actually, I would like to rename last downloaded 5 files. Any idea?
2017/04/28
[ "https://askubuntu.com/questions/909804", "https://askubuntu.com", "https://askubuntu.com/users/600715/" ]
First, I have to note, parsing `ls` is generally not recommended. Its output is meant for human consumption, and this solution will fail for some legitimate file names (like those which contain newline characters, for example) With that said, the simplest solution does seem to be using `ls` (as `find` does not offer a...
As already pointed out, [parsing `ls` is fragile](http://mywiki.wooledge.org/ParsingLs). It will break if your file names have any type of weirdness (spaces, newlines, control characters etc). Since you want to replace spaces with `_`, your suggested approach will fail. A safe way to do this would be: ``` stat --print...
909,804
I have some files I downloaded recently and I want to name. It is possible to do something like: ``` rename 's/ /_/g' $(ls -t | head -n5) ``` Actually, I would like to rename last downloaded 5 files. Any idea?
2017/04/28
[ "https://askubuntu.com/questions/909804", "https://askubuntu.com", "https://askubuntu.com/users/600715/" ]
First, I have to note, parsing `ls` is generally not recommended. Its output is meant for human consumption, and this solution will fail for some legitimate file names (like those which contain newline characters, for example) With that said, the simplest solution does seem to be using `ls` (as `find` does not offer a...
I just gave `ls -q` a try: ``` IFS=' ' for file in `ls -tr1q|tail -n5`; do rename 's/ /_/g' "$file" done ``` Does the desired rename, even for filenames with newline or other control characters, although it gives an error: ``` Unsuccessful stat on filename containing newline at /usr/bin/rename line 59 ``` (with...
909,804
I have some files I downloaded recently and I want to name. It is possible to do something like: ``` rename 's/ /_/g' $(ls -t | head -n5) ``` Actually, I would like to rename last downloaded 5 files. Any idea?
2017/04/28
[ "https://askubuntu.com/questions/909804", "https://askubuntu.com", "https://askubuntu.com/users/600715/" ]
As already pointed out, [parsing `ls` is fragile](http://mywiki.wooledge.org/ParsingLs). It will break if your file names have any type of weirdness (spaces, newlines, control characters etc). Since you want to replace spaces with `_`, your suggested approach will fail. A safe way to do this would be: ``` stat --print...
I just gave `ls -q` a try: ``` IFS=' ' for file in `ls -tr1q|tail -n5`; do rename 's/ /_/g' "$file" done ``` Does the desired rename, even for filenames with newline or other control characters, although it gives an error: ``` Unsuccessful stat on filename containing newline at /usr/bin/rename line 59 ``` (with...
27,690,503
When below code executes i=0, j=0 and length = 9 and loops = 3 Surprisingly with each line, i increased by 2 rather than 1. Can you tell why? ``` String arr[] = stringToSplit.split(delimiter); int length = arr.length; int loops = length/4+length%4; for(int i=0,j=0; j<loops && i<length...
2014/12/29
[ "https://Stackoverflow.com/questions/27690503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3534593/" ]
You have 4 `i++` statements in each iteration, so it's actually incremented up to 4 times (as long as `i<length`).
`i++` is the same as: ``` int temp = i; i = i + 1; ← i is actually changed ¯\_(ツ)_/¯ return temp; ``` `i` is incremented 4 times in your code.
27,690,503
When below code executes i=0, j=0 and length = 9 and loops = 3 Surprisingly with each line, i increased by 2 rather than 1. Can you tell why? ``` String arr[] = stringToSplit.split(delimiter); int length = arr.length; int loops = length/4+length%4; for(int i=0,j=0; j<loops && i<length...
2014/12/29
[ "https://Stackoverflow.com/questions/27690503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3534593/" ]
You have 4 `i++` statements in each iteration, so it's actually incremented up to 4 times (as long as `i<length`).
Got the fix : ``` for(int i=0,j=0; j<loops && i<length; j++){ DummyClass dummyClass= new DummyClass (); MyHelper.addInMappedElement(i<length?arr[i++].toString():null, value1, dummyClass) ; MyHelper.addInMappedElement(i<length?arr[i++].toString():null, value2, dummyClass) ; MyHelper.add...
16,566,613
I have the following HTML: ``` <ul id="sort3" class="droptrue connectedSortable ui-sortable" data-update-url="http://localhost:5000/workorders/sort " data-wostatus-id="236"> <li class="workorder" id="workorder_37" style=""> <div class=" 3" data-maxsynch="E"> ``` The following picks up the data wostatus\_id...
2013/05/15
[ "https://Stackoverflow.com/questions/16566613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2386121/" ]
You could try one of the following: ``` 1) $(this).find('div[data-maxsynch]').first().data('data-maxsynch'); 2) $(this).find('div[data-maxsynch]').first().attr('data-maxsynch'); ``` This locates the first nested div that contains the ***data-maxsynch*** data attribute and pulls its value.
You probably want `:first-of-type` instead of `:first`
16,566,613
I have the following HTML: ``` <ul id="sort3" class="droptrue connectedSortable ui-sortable" data-update-url="http://localhost:5000/workorders/sort " data-wostatus-id="236"> <li class="workorder" id="workorder_37" style=""> <div class=" 3" data-maxsynch="E"> ``` The following picks up the data wostatus\_id...
2013/05/15
[ "https://Stackoverflow.com/questions/16566613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2386121/" ]
You could try one of the following: ``` 1) $(this).find('div[data-maxsynch]').first().data('data-maxsynch'); 2) $(this).find('div[data-maxsynch]').first().attr('data-maxsynch'); ``` This locates the first nested div that contains the ***data-maxsynch*** data attribute and pulls its value.
Try ``` $(this).find("div[data-maxsynch]").data('maxsynch') ``` Demo: [Fiddle](http://jsfiddle.net/arunpjohny/qUEpW/)
14,754,092
In play 2.1 reads are used to marshall Json to objects. But how can I do this when the case class has only one field. The ideom that works for more fields does not work, as with one field 'and' is not used. Thus I do not get a FunctionBuilder. The following code gives me a type mismatch. How can I fix this? ``` case ...
2013/02/07
[ "https://Stackoverflow.com/questions/14754092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/320156/" ]
Json combinators doesn't work for single field case class. Pascal (writer of this API) has explained this situation here <https://groups.google.com/forum/?fromgroups=#!starred/play-framework/hGrveOkbJ6U> There are some workarounds which works, like this one: ``` case class A(value: List[Int]) val areads = (__ \ 'val...
Based on @yokomizor's answer, I found the simplest solution to create a `Formatter` to be ``` case class Person(name: String) val personFormatter: Format[Person] = (__ \ "full_name").format[String].inmap(Person.apply, unlift(Person.unapply)) ```
14,754,092
In play 2.1 reads are used to marshall Json to objects. But how can I do this when the case class has only one field. The ideom that works for more fields does not work, as with one field 'and' is not used. Thus I do not get a FunctionBuilder. The following code gives me a type mismatch. How can I fix this? ``` case ...
2013/02/07
[ "https://Stackoverflow.com/questions/14754092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/320156/" ]
Json combinators doesn't work for single field case class. Pascal (writer of this API) has explained this situation here <https://groups.google.com/forum/?fromgroups=#!starred/play-framework/hGrveOkbJ6U> There are some workarounds which works, like this one: ``` case class A(value: List[Int]) val areads = (__ \ 'val...
Even simpler solution than the accepted one: ``` case class A(value: String) val reads = (__ \ "key").read[String].map(A.apply) ```
14,754,092
In play 2.1 reads are used to marshall Json to objects. But how can I do this when the case class has only one field. The ideom that works for more fields does not work, as with one field 'and' is not used. Thus I do not get a FunctionBuilder. The following code gives me a type mismatch. How can I fix this? ``` case ...
2013/02/07
[ "https://Stackoverflow.com/questions/14754092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/320156/" ]
As Julien answered, you can read single field case classes using this: ``` case class Person(name: String) val personReads: Reads[Person] = (__ \ "name").read[String].map { name => Person(name) } ``` Just a complement, if you want to write: ``` val personWrites: Writes[Person] = (__ \ "name").write[String].c...
Based on @yokomizor's answer, I found the simplest solution to create a `Formatter` to be ``` case class Person(name: String) val personFormatter: Format[Person] = (__ \ "full_name").format[String].inmap(Person.apply, unlift(Person.unapply)) ```
14,754,092
In play 2.1 reads are used to marshall Json to objects. But how can I do this when the case class has only one field. The ideom that works for more fields does not work, as with one field 'and' is not used. Thus I do not get a FunctionBuilder. The following code gives me a type mismatch. How can I fix this? ``` case ...
2013/02/07
[ "https://Stackoverflow.com/questions/14754092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/320156/" ]
As Julien answered, you can read single field case classes using this: ``` case class Person(name: String) val personReads: Reads[Person] = (__ \ "name").read[String].map { name => Person(name) } ``` Just a complement, if you want to write: ``` val personWrites: Writes[Person] = (__ \ "name").write[String].c...
Even simpler solution than the accepted one: ``` case class A(value: String) val reads = (__ \ "key").read[String].map(A.apply) ```
14,754,092
In play 2.1 reads are used to marshall Json to objects. But how can I do this when the case class has only one field. The ideom that works for more fields does not work, as with one field 'and' is not used. Thus I do not get a FunctionBuilder. The following code gives me a type mismatch. How can I fix this? ``` case ...
2013/02/07
[ "https://Stackoverflow.com/questions/14754092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/320156/" ]
Based on @yokomizor's answer, I found the simplest solution to create a `Formatter` to be ``` case class Person(name: String) val personFormatter: Format[Person] = (__ \ "full_name").format[String].inmap(Person.apply, unlift(Person.unapply)) ```
Even simpler solution than the accepted one: ``` case class A(value: String) val reads = (__ \ "key").read[String].map(A.apply) ```
20,275
My young daughter and I love doing jigsaw puzzles together. The other day, we had a quite difficult one: 7 by 7 pieces! We started as usual by splitting the pieces into 2 stacks: the edge pieces on one side, the middle pieces on the other side. Before putting the edges together, we noticed that there were almost the ...
2015/08/19
[ "https://puzzling.stackexchange.com/questions/20275", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/9315/" ]
What you're looking for are numbers $X$ and $Y$ where $2X + 2(Y-2) = (X-2)\*(Y-2)$. This is generalized; a few possible (and practical) solutions would be: * $5$ by $12$, with $30$ of both edge and middle pieces. * $6$ by $8$, with $24$ of both edge and middle pieces.
For an n x m puzzle, the number of edge pieces, E, is defined by > > $2n+2(m-2)$ > > > and the number of middle pieces, M, is then defined by > > $nm-E$ > > > If we want to find a puzzle size for which E=M, then we are looking for the case where > > $nm-E=E \implies nm=2E \implies nm=4n+4m-8$ > > ...
20,275
My young daughter and I love doing jigsaw puzzles together. The other day, we had a quite difficult one: 7 by 7 pieces! We started as usual by splitting the pieces into 2 stacks: the edge pieces on one side, the middle pieces on the other side. Before putting the edges together, we noticed that there were almost the ...
2015/08/19
[ "https://puzzling.stackexchange.com/questions/20275", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/9315/" ]
What you're looking for are numbers $X$ and $Y$ where $2X + 2(Y-2) = (X-2)\*(Y-2)$. This is generalized; a few possible (and practical) solutions would be: * $5$ by $12$, with $30$ of both edge and middle pieces. * $6$ by $8$, with $24$ of both edge and middle pieces.
Our goal is to find such $n$ and $m$ that $nm = 2(n-2)(m-2)$. They can't be equal of course. Assuming $n<m$, then $\dfrac n{n-2} > \sqrt2$, so $n<8$. Then again, $2(n-2) > n$, therefore $4<n<8$. The equality $\frac{2n-4}n = \frac m{m-2}$ can be modified as $\frac{n-4}n = \frac2{m-2}$, so $\frac{2n}{n-4}$ must be a...
36,960
I am using [`bpy.ops.mesh.extrude_region_move`](http://www.blender.org/api/blender_python_api_2_75a_release/bpy.ops.mesh.html?highlight=bpy.ops.mesh.extrude_region_move#bpy.ops.mesh.extrude_region_move) to extrude a selected region along their averaged normal. I don't set the **value**-component of `TRANSFORM_OT_transl...
2015/09/03
[ "https://blender.stackexchange.com/questions/36960", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/13978/" ]
This looks at the TRANSFORM\_OT\_translate.value Vector as shown in the 'INFO' reports. If the operator was cancelled it returns (0, 0, 0) else has a length. ``` import bpy wm = bpy.context.window_manager print("TESTing Extrude Op") for op in wm.operators: if op.bl_idname == 'MESH_OT_extrude_region_move': #name...
@batFinger's Solution was correct. I only want to present my solution because I also used a Timer to check every half second if the Operator is in the `wm.operators` list. ``` def execute(self, context): bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={ ...
2,985,513
I want to log web site visits' IP, datetime, client and refferer data to access database but I'm planning to log every days log data in separate tables in example logs for 06.06.2010 will be logged in 2010\_06\_06 named table. When date is changed I'll create a table named 2010\_06\_07. But the problem is if this table...
2010/06/06
[ "https://Stackoverflow.com/questions/2985513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259881/" ]
You can use the hidden system table MSysObjects to check if a table exists: ``` If Not IsNull(DlookUp("Name","MSysObjects","Name='TableName'")) Then 'Table Exists ``` However, I agree that it is a very bad idea to create a new table every day. EDIT: I should add that tables have a type 1, 4 or 6 and it is possi...
Here's another solution, will be a bit faster than looping over all of the tables. ``` Public Function doesTableExist(strTableName As String) As Boolean Dim db As DAO.Database Dim td As DAO.TableDef Set db = CurrentDb On Error Resume Next Set td = db.TableDefs(strTableName) doesTableExist = (Er...
2,985,513
I want to log web site visits' IP, datetime, client and refferer data to access database but I'm planning to log every days log data in separate tables in example logs for 06.06.2010 will be logged in 2010\_06\_06 named table. When date is changed I'll create a table named 2010\_06\_07. But the problem is if this table...
2010/06/06
[ "https://Stackoverflow.com/questions/2985513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259881/" ]
Here's another solution, will be a bit faster than looping over all of the tables. ``` Public Function doesTableExist(strTableName As String) As Boolean Dim db As DAO.Database Dim td As DAO.TableDef Set db = CurrentDb On Error Resume Next Set td = db.TableDefs(strTableName) doesTableExist = (Er...
I have found querying system tables or tabledefs to be unreliable and introduce unpredictable behaviour in scripts where tables get regularly created and dropped. Based on my results, my hypothesis is that these tables aren't necessarily updated at the exact instant a `CREATE` or `DROP` is executed, or that concurrenc...
2,985,513
I want to log web site visits' IP, datetime, client and refferer data to access database but I'm planning to log every days log data in separate tables in example logs for 06.06.2010 will be logged in 2010\_06\_06 named table. When date is changed I'll create a table named 2010\_06\_07. But the problem is if this table...
2010/06/06
[ "https://Stackoverflow.com/questions/2985513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259881/" ]
Here's another solution, will be a bit faster than looping over all of the tables. ``` Public Function doesTableExist(strTableName As String) As Boolean Dim db As DAO.Database Dim td As DAO.TableDef Set db = CurrentDb On Error Resume Next Set td = db.TableDefs(strTableName) doesTableExist = (Er...
This question is quite old but I found that no answer is satisfying, because: * they do not handle the case of "bad" linked tables, where the linked table points to a non existing db or table. * since linked tables are potentially huge, we must be able to check them with a fast query. So here is my simple but more co...
2,985,513
I want to log web site visits' IP, datetime, client and refferer data to access database but I'm planning to log every days log data in separate tables in example logs for 06.06.2010 will be logged in 2010\_06\_06 named table. When date is changed I'll create a table named 2010\_06\_07. But the problem is if this table...
2010/06/06
[ "https://Stackoverflow.com/questions/2985513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259881/" ]
You can use the hidden system table MSysObjects to check if a table exists: ``` If Not IsNull(DlookUp("Name","MSysObjects","Name='TableName'")) Then 'Table Exists ``` However, I agree that it is a very bad idea to create a new table every day. EDIT: I should add that tables have a type 1, 4 or 6 and it is possi...
I tested various methods for finding out if a table exists several years ago. Here is the code for all of them as I implemented, including my simple test routine. ```vb Public Function TableExists(strTableName As String, Optional ysnRefresh As Boolean, Optional db As DAO.Database) As Boolean ' Originally Based...
2,985,513
I want to log web site visits' IP, datetime, client and refferer data to access database but I'm planning to log every days log data in separate tables in example logs for 06.06.2010 will be logged in 2010\_06\_06 named table. When date is changed I'll create a table named 2010\_06\_07. But the problem is if this table...
2010/06/06
[ "https://Stackoverflow.com/questions/2985513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259881/" ]
You can use the hidden system table MSysObjects to check if a table exists: ``` If Not IsNull(DlookUp("Name","MSysObjects","Name='TableName'")) Then 'Table Exists ``` However, I agree that it is a very bad idea to create a new table every day. EDIT: I should add that tables have a type 1, 4 or 6 and it is possi...
I have found querying system tables or tabledefs to be unreliable and introduce unpredictable behaviour in scripts where tables get regularly created and dropped. Based on my results, my hypothesis is that these tables aren't necessarily updated at the exact instant a `CREATE` or `DROP` is executed, or that concurrenc...
2,985,513
I want to log web site visits' IP, datetime, client and refferer data to access database but I'm planning to log every days log data in separate tables in example logs for 06.06.2010 will be logged in 2010\_06\_06 named table. When date is changed I'll create a table named 2010\_06\_07. But the problem is if this table...
2010/06/06
[ "https://Stackoverflow.com/questions/2985513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259881/" ]
You can use the hidden system table MSysObjects to check if a table exists: ``` If Not IsNull(DlookUp("Name","MSysObjects","Name='TableName'")) Then 'Table Exists ``` However, I agree that it is a very bad idea to create a new table every day. EDIT: I should add that tables have a type 1, 4 or 6 and it is possi...
This question is quite old but I found that no answer is satisfying, because: * they do not handle the case of "bad" linked tables, where the linked table points to a non existing db or table. * since linked tables are potentially huge, we must be able to check them with a fast query. So here is my simple but more co...
2,985,513
I want to log web site visits' IP, datetime, client and refferer data to access database but I'm planning to log every days log data in separate tables in example logs for 06.06.2010 will be logged in 2010\_06\_06 named table. When date is changed I'll create a table named 2010\_06\_07. But the problem is if this table...
2010/06/06
[ "https://Stackoverflow.com/questions/2985513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259881/" ]
I tested various methods for finding out if a table exists several years ago. Here is the code for all of them as I implemented, including my simple test routine. ```vb Public Function TableExists(strTableName As String, Optional ysnRefresh As Boolean, Optional db As DAO.Database) As Boolean ' Originally Based...
I have found querying system tables or tabledefs to be unreliable and introduce unpredictable behaviour in scripts where tables get regularly created and dropped. Based on my results, my hypothesis is that these tables aren't necessarily updated at the exact instant a `CREATE` or `DROP` is executed, or that concurrenc...
2,985,513
I want to log web site visits' IP, datetime, client and refferer data to access database but I'm planning to log every days log data in separate tables in example logs for 06.06.2010 will be logged in 2010\_06\_06 named table. When date is changed I'll create a table named 2010\_06\_07. But the problem is if this table...
2010/06/06
[ "https://Stackoverflow.com/questions/2985513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259881/" ]
I tested various methods for finding out if a table exists several years ago. Here is the code for all of them as I implemented, including my simple test routine. ```vb Public Function TableExists(strTableName As String, Optional ysnRefresh As Boolean, Optional db As DAO.Database) As Boolean ' Originally Based...
This question is quite old but I found that no answer is satisfying, because: * they do not handle the case of "bad" linked tables, where the linked table points to a non existing db or table. * since linked tables are potentially huge, we must be able to check them with a fast query. So here is my simple but more co...
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
You need to configure correctly your IDE. **Requirements** ``` <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.4.0</version> </dependency> ``` Do not use **JUnit 5** that offers your IDE. If you add it as library, you will get: ``` No tests fou...
If you have/had JUnit 4, check the import for annotation `@Test`: `import org.junit.Test;` For JUnit 5 import should be: `import org.junit.jupiter.api.Test;` It was my issue for this question
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
same issue. For my case. First, it's the @Test annotation, should be `org.junit.jupiter.api.Test`, not `org.junit.Test`. Second, I added `@RunWith(SpringRunner.class)` in the head of the test class, after I remove it, the order of test cases run as expected.
For example, by using Spring Boot you can use **@FixMethodOrder(MethodSorters.JVM)** instead of **@TestMethodOrder(MethodOrderer.OrderAnnotation.class)**. All of tests are run in the order they appear. ``` @FixMethodOrder(MethodSorters.JVM) public class MyTest{ @Test public void zzzz(){} @Test public voi...
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
From the docs <https://junit.org/junit5/docs/current/api/org/junit/jupiter/api/TestMethodOrder.html> ``` @TestMethodOrder(MethodOrderer.OrderAnnotation.class) class OrderedTests { @Test @Order(1) void nullValues() {} @Test @Order(2) void emptyValues() {} @Test @Order(3) ...
you need to configure correctly your pom.xml. See mine : ``` <properties> <!-- Dependency versions --> <junit.jupiter.version>5.6.0</junit.jupiter.version> <maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version> <!-- Java 10 --> <maven.compiler.source>1.10</maven.compiler.source> ...
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
You need to configure correctly your IDE. **Requirements** ``` <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.4.0</version> </dependency> ``` Do not use **JUnit 5** that offers your IDE. If you add it as library, you will get: ``` No tests fou...
I have faced the same issue. But, I found the problem where exactly is on my case. Wrongly import the "Order" class. **Wrong One** ``` import org.springframework.core.annotation.Order; ``` **Right one** ``` *import org.junit.jupiter.api.Order;* ``` Also, please verify the following five classes with proper impor...
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
From the docs <https://junit.org/junit5/docs/current/api/org/junit/jupiter/api/TestMethodOrder.html> ``` @TestMethodOrder(MethodOrderer.OrderAnnotation.class) class OrderedTests { @Test @Order(1) void nullValues() {} @Test @Order(2) void emptyValues() {} @Test @Order(3) ...
After applying all the settings based on previous recommended solution. I'm still having the same reverse or random **@order** execution. **Pom.xml** ``` <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.3.RELEASE</version> </parent> <de...
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
I have faced the same issue. But, I found the problem where exactly is on my case. Wrongly import the "Order" class. **Wrong One** ``` import org.springframework.core.annotation.Order; ``` **Right one** ``` *import org.junit.jupiter.api.Order;* ``` Also, please verify the following five classes with proper impor...
same issue. For my case. First, it's the @Test annotation, should be `org.junit.jupiter.api.Test`, not `org.junit.Test`. Second, I added `@RunWith(SpringRunner.class)` in the head of the test class, after I remove it, the order of test cases run as expected.
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
You need to configure correctly your IDE. **Requirements** ``` <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.4.0</version> </dependency> ``` Do not use **JUnit 5** that offers your IDE. If you add it as library, you will get: ``` No tests fou...
After applying all the settings based on previous recommended solution. I'm still having the same reverse or random **@order** execution. **Pom.xml** ``` <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.3.RELEASE</version> </parent> <de...
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
If you have/had JUnit 4, check the import for annotation `@Test`: `import org.junit.Test;` For JUnit 5 import should be: `import org.junit.jupiter.api.Test;` It was my issue for this question
same issue. For my case. First, it's the @Test annotation, should be `org.junit.jupiter.api.Test`, not `org.junit.Test`. Second, I added `@RunWith(SpringRunner.class)` in the head of the test class, after I remove it, the order of test cases run as expected.
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
You need to configure correctly your IDE. **Requirements** ``` <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.4.0</version> </dependency> ``` Do not use **JUnit 5** that offers your IDE. If you add it as library, you will get: ``` No tests fou...
same issue. For my case. First, it's the @Test annotation, should be `org.junit.jupiter.api.Test`, not `org.junit.Test`. Second, I added `@RunWith(SpringRunner.class)` in the head of the test class, after I remove it, the order of test cases run as expected.
54,947,645
I'm having a problem with following integration test ``` import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @SpringBootTest @ActiveProfiles("test") @TestMethodOrder(OrderAnnotation.class) public class FooServiceIT { @Test ...
2019/03/01
[ "https://Stackoverflow.com/questions/54947645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3750108/" ]
I have faced the same issue. But, I found the problem where exactly is on my case. Wrongly import the "Order" class. **Wrong One** ``` import org.springframework.core.annotation.Order; ``` **Right one** ``` *import org.junit.jupiter.api.Order;* ``` Also, please verify the following five classes with proper impor...
For example, by using Spring Boot you can use **@FixMethodOrder(MethodSorters.JVM)** instead of **@TestMethodOrder(MethodOrderer.OrderAnnotation.class)**. All of tests are run in the order they appear. ``` @FixMethodOrder(MethodSorters.JVM) public class MyTest{ @Test public void zzzz(){} @Test public voi...
7,907
I need a free wordpress plugin that will allow the users to upvote or down vote every post. Something similar to stackoverflow.com If not give me suggestions of how to create one. I am a java programmer and have never coded anything in PHP.
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7907", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1789/" ]
[GD Star Rating](http://wordpress.org/extend/plugins/gd-star-rating/) ( plugin is no longer in development ) was pretty comprehensive.
Can't answer completely now, but i could achieve a vote on/off functionality by implementing a "custom comment type". It behaves very much like a comment, except it doesn't get listed/counted as a normal comment and can be retrieved independently from the comments table. If you are interested I can post some code (qu...
7,907
I need a free wordpress plugin that will allow the users to upvote or down vote every post. Something similar to stackoverflow.com If not give me suggestions of how to create one. I am a java programmer and have never coded anything in PHP.
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7907", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1789/" ]
For all of my rating uses i use WP-PostRatings <http://wordpress.org/extend/plugins/wp-postratings/>
Can't answer completely now, but i could achieve a vote on/off functionality by implementing a "custom comment type". It behaves very much like a comment, except it doesn't get listed/counted as a normal comment and can be retrieved independently from the comments table. If you are interested I can post some code (qu...
70,047,756
Here's the code ``` import React, { Component, useImperativeHandle } from 'react'; class SearchBar extends Component { render() { return <input onChange={this.onInputChange} />; } onInputChange(event) { console.log(event) } } export default SearchBar; ``` There's no error still on input nothing get the console ...
2021/11/20
[ "https://Stackoverflow.com/questions/70047756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14943786/" ]
You need to bind your event handler to your class component as below ``` import React, { Component, useImperativeHandle } from 'react'; class SearchBar extends Component { constructor(props) { super(props); this.onInputChange = this.onInputChangebind(this); //You NEEDED THIS } render() { retur...
Works on my side... i highlighted the console.log outputs as shown on picture [![enter image description here](https://i.stack.imgur.com/xnhb6.png)](https://i.stack.imgur.com/xnhb6.png) otherwise if you needed to see the words you typed on the input tag you can just do `console.log(event.target.value)` `instead of con...
31,541,340
``` def hello(world, bob) p hello "#{world}" p hello "#{bob}" end ``` When I run that code it sees only one argument. How do change my method so I can return `"Hello world"` and `"Hello bob"`.
2015/07/21
[ "https://Stackoverflow.com/questions/31541340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139378/" ]
You could have it take an unlimited amount of input as well with `*args` ``` def hello(*args) args.each do |word| puts "Hello #{word}" end end ``` If you want to have the word `and` in between you could do it like this. ``` def hello(*args) args = args.map do |word| "Hello #{word}" end puts ar...
Bcs. in your code you have `p hello "#{world}"` and this code is same like `hello("world")`. so you call method `hello` with one parram. ``` def hello(world, bob) p "Hello #{world}" p "Hello #{bob}" end hello("World", "Bob") # => Hello World # => Hello Bob ``` If you wanna return this two strings you just modif...
31,541,340
``` def hello(world, bob) p hello "#{world}" p hello "#{bob}" end ``` When I run that code it sees only one argument. How do change my method so I can return `"Hello world"` and `"Hello bob"`.
2015/07/21
[ "https://Stackoverflow.com/questions/31541340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139378/" ]
You could have it take an unlimited amount of input as well with `*args` ``` def hello(*args) args.each do |word| puts "Hello #{word}" end end ``` If you want to have the word `and` in between you could do it like this. ``` def hello(*args) args = args.map do |word| "Hello #{word}" end puts ar...
This method will return `Hello world` & `Hello bob` ``` def hello(first, second) puts "Hello #{first}" puts "Hello #{second}" end hello("world", "bob") => Hello world Hello bob ``` ![Example](https://i.stack.imgur.com/YiYC4.png)
60,420
(Note: I'm from the UK so whilst we get some news about America our news cycle isn't dominated by their affairs) So, in 2020 there was the US elections, Biden won, but Trump is refusing to concede and is basically alleging there was massive voter fraud to prevent his win. If you look at it from the perspective of a b...
2020/11/20
[ "https://politics.stackexchange.com/questions/60420", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/35216/" ]
(Contra to Brian's answer) there were a few clashes, like this one in DC [on Nov 14](https://www.npr.org/2020/11/14/934957728/trump-supporters-descend-on-d-c-for-events-contesting-election-results): > > The demonstrations unfolded peacefully for most of the day, but counterprotesters clashed with the president's supp...
(EDIT 1/10: A lot has changed since November, this answer reflects the information available at that time.) **No**, there have been no such riots so far. (EDIT 11/20: The incident in Fizz's answer is the most notable exception I've seen so far.) For the reasons outlined in the question, an ongoing risk does exists to ...
60,420
(Note: I'm from the UK so whilst we get some news about America our news cycle isn't dominated by their affairs) So, in 2020 there was the US elections, Biden won, but Trump is refusing to concede and is basically alleging there was massive voter fraud to prevent his win. If you look at it from the perspective of a b...
2020/11/20
[ "https://politics.stackexchange.com/questions/60420", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/35216/" ]
(EDIT 1/10: A lot has changed since November, this answer reflects the information available at that time.) **No**, there have been no such riots so far. (EDIT 11/20: The incident in Fizz's answer is the most notable exception I've seen so far.) For the reasons outlined in the question, an ongoing risk does exists to ...
No, there have not been any riots. Since that may seem surprising considering there are a lot of extremely invested people on both sides you need to consider the current overall position. At the moment both sides are being told "it's fine, the courts will take care of it." So Biden supporters are not happy about the...
60,420
(Note: I'm from the UK so whilst we get some news about America our news cycle isn't dominated by their affairs) So, in 2020 there was the US elections, Biden won, but Trump is refusing to concede and is basically alleging there was massive voter fraud to prevent his win. If you look at it from the perspective of a b...
2020/11/20
[ "https://politics.stackexchange.com/questions/60420", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/35216/" ]
(Contra to Brian's answer) there were a few clashes, like this one in DC [on Nov 14](https://www.npr.org/2020/11/14/934957728/trump-supporters-descend-on-d-c-for-events-contesting-election-results): > > The demonstrations unfolded peacefully for most of the day, but counterprotesters clashed with the president's supp...
No, there have not been any riots. Since that may seem surprising considering there are a lot of extremely invested people on both sides you need to consider the current overall position. At the moment both sides are being told "it's fine, the courts will take care of it." So Biden supporters are not happy about the...
60,420
(Note: I'm from the UK so whilst we get some news about America our news cycle isn't dominated by their affairs) So, in 2020 there was the US elections, Biden won, but Trump is refusing to concede and is basically alleging there was massive voter fraud to prevent his win. If you look at it from the perspective of a b...
2020/11/20
[ "https://politics.stackexchange.com/questions/60420", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/35216/" ]
(Contra to Brian's answer) there were a few clashes, like this one in DC [on Nov 14](https://www.npr.org/2020/11/14/934957728/trump-supporters-descend-on-d-c-for-events-contesting-election-results): > > The demonstrations unfolded peacefully for most of the day, but counterprotesters clashed with the president's supp...
There was a [violent riot](https://en.wikipedia.org/wiki/2021_storming_of_the_United_States_Capitol) in Washington, DC on January 6, 2021. The BBC [reports](https://www.bbc.com/news/world-us-canada-55578092), > > Trump supporters converged on Capitol Hill on Wednesday to express their rage over Joe Biden's victory i...
60,420
(Note: I'm from the UK so whilst we get some news about America our news cycle isn't dominated by their affairs) So, in 2020 there was the US elections, Biden won, but Trump is refusing to concede and is basically alleging there was massive voter fraud to prevent his win. If you look at it from the perspective of a b...
2020/11/20
[ "https://politics.stackexchange.com/questions/60420", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/35216/" ]
There was a [violent riot](https://en.wikipedia.org/wiki/2021_storming_of_the_United_States_Capitol) in Washington, DC on January 6, 2021. The BBC [reports](https://www.bbc.com/news/world-us-canada-55578092), > > Trump supporters converged on Capitol Hill on Wednesday to express their rage over Joe Biden's victory i...
No, there have not been any riots. Since that may seem surprising considering there are a lot of extremely invested people on both sides you need to consider the current overall position. At the moment both sides are being told "it's fine, the courts will take care of it." So Biden supporters are not happy about the...
1,030,766
My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it?
2009/06/23
[ "https://Stackoverflow.com/questions/1030766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39655/" ]
I would say that each class manages it's own properties. So subclass class should release it's properties and base class releases it's own. Once subclass is released it will not access base class properties, it technically does not exists anymore. Standard way of writing dealloc is: ``` - (void)dealloc { // releas...
I'm pretty new to Objective-C, so I'm also curious what the best answer is here. I would think that you should set the property to `nil` in the parent class `-dealloc`, where the property is synthesized. If you're retaining it in the subclass for some reason, you should also release it in the subclass, but setting the ...
1,030,766
My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it?
2009/06/23
[ "https://Stackoverflow.com/questions/1030766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39655/" ]
If the properties are only used by the subclass, they should be defined in the subclass (not the parent class) and the subclass should release them within it's -(void)dealloc function. You'd have something like this: ``` - (void)dealloc { [username release]; [password release]; [super dealloc]; } ``` Note t...
I'm pretty new to Objective-C, so I'm also curious what the best answer is here. I would think that you should set the property to `nil` in the parent class `-dealloc`, where the property is synthesized. If you're retaining it in the subclass for some reason, you should also release it in the subclass, but setting the ...
1,030,766
My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it?
2009/06/23
[ "https://Stackoverflow.com/questions/1030766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39655/" ]
I would say that each class manages it's own properties. So subclass class should release it's properties and base class releases it's own. Once subclass is released it will not access base class properties, it technically does not exists anymore. Standard way of writing dealloc is: ``` - (void)dealloc { // releas...
If the properties are only used by the subclass, they should be defined in the subclass (not the parent class) and the subclass should release them within it's -(void)dealloc function. You'd have something like this: ``` - (void)dealloc { [username release]; [password release]; [super dealloc]; } ``` Note t...
1,030,766
My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it?
2009/06/23
[ "https://Stackoverflow.com/questions/1030766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39655/" ]
I would say that each class manages it's own properties. So subclass class should release it's properties and base class releases it's own. Once subclass is released it will not access base class properties, it technically does not exists anymore. Standard way of writing dealloc is: ``` - (void)dealloc { // releas...
In a given block, the number of calls to retain, copy, alloc should be balanced by calls to release, autorelease. If you retain something in the subclass, release it in the subclass, and if in the base class... I'm paraphrasing that from memory from an article on stepwise.
1,030,766
My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it?
2009/06/23
[ "https://Stackoverflow.com/questions/1030766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39655/" ]
I would say that each class manages it's own properties. So subclass class should release it's properties and base class releases it's own. Once subclass is released it will not access base class properties, it technically does not exists anymore. Standard way of writing dealloc is: ``` - (void)dealloc { // releas...
Short answer: In the base class. Long answer: Objects are "owned" by other objects. To own an object, you have to allocate or retain it (with retain, alloc, new, or copy). The owner is responsible for disposing of the memory with a release or autorelease. There should be one release/autorelease for every allocation/re...
1,030,766
My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it?
2009/06/23
[ "https://Stackoverflow.com/questions/1030766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39655/" ]
If the properties are only used by the subclass, they should be defined in the subclass (not the parent class) and the subclass should release them within it's -(void)dealloc function. You'd have something like this: ``` - (void)dealloc { [username release]; [password release]; [super dealloc]; } ``` Note t...
In a given block, the number of calls to retain, copy, alloc should be balanced by calls to release, autorelease. If you retain something in the subclass, release it in the subclass, and if in the base class... I'm paraphrasing that from memory from an article on stepwise.
1,030,766
My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it?
2009/06/23
[ "https://Stackoverflow.com/questions/1030766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39655/" ]
If the properties are only used by the subclass, they should be defined in the subclass (not the parent class) and the subclass should release them within it's -(void)dealloc function. You'd have something like this: ``` - (void)dealloc { [username release]; [password release]; [super dealloc]; } ``` Note t...
Short answer: In the base class. Long answer: Objects are "owned" by other objects. To own an object, you have to allocate or retain it (with retain, alloc, new, or copy). The owner is responsible for disposing of the memory with a release or autorelease. There should be one release/autorelease for every allocation/re...
4,414
What are some ways a SPO can attack the Cardano blockchain? E.g. in Bitcoin, a miner could intentionally exclude certain transactions to the extend that the miner's hash power allows. Is something like this possible in Cardano? What about other forms of attack? What discourages such attacks or mitigates the harm they c...
2021/11/04
[ "https://cardano.stackexchange.com/questions/4414", "https://cardano.stackexchange.com", "https://cardano.stackexchange.com/users/234/" ]
I am still researching if it is possible for a SPO to choose and exclude transactions when they are elected to create the block. I am pretty sure it isn't something you can just do 'out of the box,' I believe you would need to modify the client code of your block producer. With that said, **if** they could do that, it ...
Decentralization is the mitigation against attacks in almost all of these systems, they all assume that a centralized player has not gained the power to control consensus. An SPO could theoretically re-write their block producers software to do anything, like award themselves a million ADA. But it doesnt have any effe...
4,414
What are some ways a SPO can attack the Cardano blockchain? E.g. in Bitcoin, a miner could intentionally exclude certain transactions to the extend that the miner's hash power allows. Is something like this possible in Cardano? What about other forms of attack? What discourages such attacks or mitigates the harm they c...
2021/11/04
[ "https://cardano.stackexchange.com/questions/4414", "https://cardano.stackexchange.com", "https://cardano.stackexchange.com/users/234/" ]
I am still researching if it is possible for a SPO to choose and exclude transactions when they are elected to create the block. I am pretty sure it isn't something you can just do 'out of the box,' I believe you would need to modify the client code of your block producer. With that said, **if** they could do that, it ...
The most feasible (and most well-established) method by which any kind of validator (be it a miner, SPO, etc) can game the system is through Miner Extractable Value (MEV), a.k.a front-running. It is an endemic (though non-catastrophic) problem for any public blockchain network that is maintained in a trust-less fashion...
48,795,689
We use this type of filtering algorithm a lot for embedded machine control. Does anyone know a name for this type of algorithm? It is somewhat similar to a leaky-bucket algorithm. Given the periodic occurrence of an event, this 'filtering' algorithm allows a ‘bad’ event to be “undone” by a subsequent ‘good’ event. If ...
2018/02/14
[ "https://Stackoverflow.com/questions/48795689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9361964/" ]
Your UPDATE statement is wrong: ``` "UPDATE `contacts` SET email = '$email2' AND phone = '$number2' AND address = '$address2' AND name = '$name2' WHERE id = '$del_id'" ``` Try this instead ================ ``` // Please sanitize the data $email2 = filter_var( $email2, FILTER_SANITIZE_EMAIL ); $name2 = preg_re...
Replace your `$query` line. ``` $query = "UPDATE `contacts` SET email = '$email2', phone = '$number2', address = '$address2', name = '$name2' WHERE id = '$del_id'"; ``` `AND` can be used in `WHERE` clause.
48,795,689
We use this type of filtering algorithm a lot for embedded machine control. Does anyone know a name for this type of algorithm? It is somewhat similar to a leaky-bucket algorithm. Given the periodic occurrence of an event, this 'filtering' algorithm allows a ‘bad’ event to be “undone” by a subsequent ‘good’ event. If ...
2018/02/14
[ "https://Stackoverflow.com/questions/48795689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9361964/" ]
Your UPDATE statement is wrong: ``` "UPDATE `contacts` SET email = '$email2' AND phone = '$number2' AND address = '$address2' AND name = '$name2' WHERE id = '$del_id'" ``` Try this instead ================ ``` // Please sanitize the data $email2 = filter_var( $email2, FILTER_SANITIZE_EMAIL ); $name2 = preg_re...
``` $query = "UPDATE `users` SET `userpassword` = CONCAT(`userpassword`, 'a') WHERE `user_id` = 1"; ``` READ THE GUIDELINES
30,553,569
So what I want to do is "Update the 'usertype' column in the 'user' table `WHERE` the email(/user) value is obtained from the textbox" ``` JButton GrantButton = new JButton("Grant Seller Access"); GrantButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { ...
2015/05/31
[ "https://Stackoverflow.com/questions/30553569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4957628/" ]
I'm going to attempt to answer your question with what I think you want. First, I think you need to use the [JavaScript button group](http://getbootstrap.com/javascript/#buttons-checkbox-radio) from Bootstrap in order to get the behavior you want. You can change them to [vertical](http://getbootstrap.com/components/#...
This may be helpful for you ``` <body> <div class='answer-body form-group' > <input type="radio" value="5" name="user_response[answer_id]" id="user_response_answer_id_5" /> <label class="btn btn-primary" data-toggle="button" id="btn1" onclick="func(this.previousSibling.previousSibling.id, this.id)" for="user...
42,909,530
I am mixing C with C++ source code using GNU. `_Decimal64` is recognised fine in C, but not in C++. C++ complains `error: '_Decimal64' does not name a type`. Is there any way I can fix this? Should I consider it a compiler bug? **Update 20-Mar-2017 18:19**: None of the answers meet my requirements so far. I don't wa...
2017/03/20
[ "https://Stackoverflow.com/questions/42909530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4037492/" ]
For C++ "decimal64" use `std::decimal::decimal64` the standard says: <https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-api-4.6/a00454.html>
I've asked around, and I think I've solved the problem. The equivalent of `_Decimal64` in C is `__decfloat64` in C++. I present an example which allows the interop of decimals in C and C++. It may look more complicated than necessary, but I wanted to demonstrate how one might use it in a real project. Here are the fi...
42,909,530
I am mixing C with C++ source code using GNU. `_Decimal64` is recognised fine in C, but not in C++. C++ complains `error: '_Decimal64' does not name a type`. Is there any way I can fix this? Should I consider it a compiler bug? **Update 20-Mar-2017 18:19**: None of the answers meet my requirements so far. I don't wa...
2017/03/20
[ "https://Stackoverflow.com/questions/42909530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4037492/" ]
`_Decimal64` is neither standard C++ nor standard C. It is simply proposed in the [TR 24732 document](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1312.pdf). Ok, gcc supports it at least when compiling C source. The C++ counterpart seems to be [TR 24733](http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n284...
I've asked around, and I think I've solved the problem. The equivalent of `_Decimal64` in C is `__decfloat64` in C++. I present an example which allows the interop of decimals in C and C++. It may look more complicated than necessary, but I wanted to demonstrate how one might use it in a real project. Here are the fi...
42,909,530
I am mixing C with C++ source code using GNU. `_Decimal64` is recognised fine in C, but not in C++. C++ complains `error: '_Decimal64' does not name a type`. Is there any way I can fix this? Should I consider it a compiler bug? **Update 20-Mar-2017 18:19**: None of the answers meet my requirements so far. I don't wa...
2017/03/20
[ "https://Stackoverflow.com/questions/42909530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4037492/" ]
We have it in this header file ``` #include <decimal/decimal> ``` and Use it as `std::decimal::decimal64 var;` `decimal` `namespace` is in `namespace` `std` The source code can be found [here](https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-api-4.5/a00850_source.html) for future reference
I've asked around, and I think I've solved the problem. The equivalent of `_Decimal64` in C is `__decfloat64` in C++. I present an example which allows the interop of decimals in C and C++. It may look more complicated than necessary, but I wanted to demonstrate how one might use it in a real project. Here are the fi...
10,080,067
I am creating a site where you hover the mouse over an image and it shows an element (in this case by expanding its height from 0 to 154px). ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").mouseover(function(){ jQuery("#dropdown-menu-create .toggle").animate({height:"154px...
2012/04/09
[ "https://Stackoverflow.com/questions/10080067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1252559/" ]
Try using the [.mouseenter](http://api.jquery.com/mouseenter/) event instead of the .mouseover I think that will do!
adding a .stop() before your .animate() will help fix this. by stopping the previous animation this prevents the animation firing multiple times if the user moves their mouse over the element many times quickly
10,080,067
I am creating a site where you hover the mouse over an image and it shows an element (in this case by expanding its height from 0 to 154px). ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").mouseover(function(){ jQuery("#dropdown-menu-create .toggle").animate({height:"154px...
2012/04/09
[ "https://Stackoverflow.com/questions/10080067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1252559/" ]
You may need to use `mouseenter` instead of `mouseover` and `mouseleave` instead of `mouseout` Or you may try and use `.hover` function as below, ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").hover(function(){ //mouseenter jQuery("#dropdown-menu-create .toggle").animate...
adding a .stop() before your .animate() will help fix this. by stopping the previous animation this prevents the animation firing multiple times if the user moves their mouse over the element many times quickly
10,080,067
I am creating a site where you hover the mouse over an image and it shows an element (in this case by expanding its height from 0 to 154px). ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").mouseover(function(){ jQuery("#dropdown-menu-create .toggle").animate({height:"154px...
2012/04/09
[ "https://Stackoverflow.com/questions/10080067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1252559/" ]
Try using the [.mouseenter](http://api.jquery.com/mouseenter/) event instead of the .mouseover I think that will do!
You may need to use `mouseenter` instead of `mouseover` and `mouseleave` instead of `mouseout` Or you may try and use `.hover` function as below, ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").hover(function(){ //mouseenter jQuery("#dropdown-menu-create .toggle").animate...
10,080,067
I am creating a site where you hover the mouse over an image and it shows an element (in this case by expanding its height from 0 to 154px). ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").mouseover(function(){ jQuery("#dropdown-menu-create .toggle").animate({height:"154px...
2012/04/09
[ "https://Stackoverflow.com/questions/10080067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1252559/" ]
Try using the [.mouseenter](http://api.jquery.com/mouseenter/) event instead of the .mouseover I think that will do!
Since you are trying to implement this on a container, your correct event handler are `mouseenter` and `mouseleave`. Example: ``` $("#dropdown-menu-create .dropimage").mouseenter(function(){ $("#dropdown-menu-create .toggle").animate({height:"154px"},200); }); $("#dropdown-menu-create .dropimage").mouseleave(func...
10,080,067
I am creating a site where you hover the mouse over an image and it shows an element (in this case by expanding its height from 0 to 154px). ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").mouseover(function(){ jQuery("#dropdown-menu-create .toggle").animate({height:"154px...
2012/04/09
[ "https://Stackoverflow.com/questions/10080067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1252559/" ]
Try using the [.mouseenter](http://api.jquery.com/mouseenter/) event instead of the .mouseover I think that will do!
Although this may not be completely relevant, I had a similar issue. Everything I would move my most over the div, the event would fire. To solve it, I realized that when the 'hover' event was triggered, the toggled div had become the one my mouse was over. To fix it, I just added an event on that one to fade it out on...
10,080,067
I am creating a site where you hover the mouse over an image and it shows an element (in this case by expanding its height from 0 to 154px). ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").mouseover(function(){ jQuery("#dropdown-menu-create .toggle").animate({height:"154px...
2012/04/09
[ "https://Stackoverflow.com/questions/10080067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1252559/" ]
You may need to use `mouseenter` instead of `mouseover` and `mouseleave` instead of `mouseout` Or you may try and use `.hover` function as below, ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").hover(function(){ //mouseenter jQuery("#dropdown-menu-create .toggle").animate...
Since you are trying to implement this on a container, your correct event handler are `mouseenter` and `mouseleave`. Example: ``` $("#dropdown-menu-create .dropimage").mouseenter(function(){ $("#dropdown-menu-create .toggle").animate({height:"154px"},200); }); $("#dropdown-menu-create .dropimage").mouseleave(func...
10,080,067
I am creating a site where you hover the mouse over an image and it shows an element (in this case by expanding its height from 0 to 154px). ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").mouseover(function(){ jQuery("#dropdown-menu-create .toggle").animate({height:"154px...
2012/04/09
[ "https://Stackoverflow.com/questions/10080067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1252559/" ]
You may need to use `mouseenter` instead of `mouseover` and `mouseleave` instead of `mouseout` Or you may try and use `.hover` function as below, ``` jQuery(document).ready(function(){ jQuery("#dropdown-menu-create .dropimage").hover(function(){ //mouseenter jQuery("#dropdown-menu-create .toggle").animate...
Although this may not be completely relevant, I had a similar issue. Everything I would move my most over the div, the event would fire. To solve it, I realized that when the 'hover' event was triggered, the toggled div had become the one my mouse was over. To fix it, I just added an event on that one to fade it out on...
46,006,671
``` void f(void); int x = 15213; int main() { f(); printf("x = %d\n", x); return 0; } /* bar3.c */ int x; void f() { x = 15212; } ``` In the above code the output which i am getting is 15212. I dont understand how? First the main function calls f() define in another c file. In f() the va...
2017/09/01
[ "https://Stackoverflow.com/questions/46006671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8366023/" ]
You've defined the variable `x` with *external* linkage in 2 translation units. The behaviour of the program is therefore **undefined**. [C11 6.9p5](http://port70.net/%7Ensz/c/c11/n1570.html#6.9p5): > > 5. An external definition is an external declaration that is also a definition of a function (other than an inline ...
Because `x` is defined outside the scope of any function, it therefore has global scope. So the running of `f()` to assign its value actually changes its value as shown. When `main()` runs the first thing it does is call `f()` which changes the value (some may argue as a side effect). That's why, the initialized value...
66,121,977
I want to call the Autoit.exe file in the java class. I kept the AutoIt.exe file inside the executable package and read it in UploadProfile.java class. ``` // Label: image driver.findElement(By.id("uploadimage")).click(); //for 1mb file uploading Runtime.getRuntime().exec("D:\\netxploretesting\\unifytreewebautomation\...
2021/02/09
[ "https://Stackoverflow.com/questions/66121977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12569370/" ]
You can distribute exe with your package and keep it in sources but it is actually a sort of bad practice. However if you have no options I can suggest the following way: 1. Put your `exe` file to `resources` folder 2. Within the code implement copying the file from `resources` to some place in the file system. 3. Exe...
if you want to run executable file as per system changes. then save the executable file at project level. and then call System.getPropert("user.dir") this will return your project path. then add the package path which contains executable file. like below. Runtime.getRuntime().exec(System.getProperty("user.dir")+"your p...
73,526,796
I have a Device class like so, that I pass data from a websocket to. The data from the websocket isn't always the same, so what I want to do is only update the value of each item in the class, if it is not None. As an example, the `message_data` might be the below on the first message ```json { "ssdp": "foo", "ip...
2022/08/29
[ "https://Stackoverflow.com/questions/73526796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979099/" ]
You never show exactly how you use your `class Device`, so I'm going to have to guess: You create a new `Device` from data, and later you get new data and want to do an update. This constitutes two completely different operations, and `Device` already has these two operations, but `Info` does not. Here is my code wi...
```py @dataclass class Info: ssdp: str ip: str @staticmethod def update(data, info): return Info( ssdp=data.get('SSDP', info.ssdp), ip=data.get('ip', info.ip), ) class Device: def __init__(self, data): self.info = Info(None, None) self.update...
73,526,796
I have a Device class like so, that I pass data from a websocket to. The data from the websocket isn't always the same, so what I want to do is only update the value of each item in the class, if it is not None. As an example, the `message_data` might be the below on the first message ```json { "ssdp": "foo", "ip...
2022/08/29
[ "https://Stackoverflow.com/questions/73526796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979099/" ]
You never show exactly how you use your `class Device`, so I'm going to have to guess: You create a new `Device` from data, and later you get new data and want to do an update. This constitutes two completely different operations, and `Device` already has these two operations, but `Info` does not. Here is my code wi...
Try with these redefined new classes: ``` from dataclasses import dataclass, fields, replace from operator import attrgetter @dataclass class Info: ssdp: str = None ip: str = None class Device: def __init__(self, data): self.info = Info() self.update_from_dict(data) def update_from_d...
73,526,796
I have a Device class like so, that I pass data from a websocket to. The data from the websocket isn't always the same, so what I want to do is only update the value of each item in the class, if it is not None. As an example, the `message_data` might be the below on the first message ```json { "ssdp": "foo", "ip...
2022/08/29
[ "https://Stackoverflow.com/questions/73526796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979099/" ]
You never show exactly how you use your `class Device`, so I'm going to have to guess: You create a new `Device` from data, and later you get new data and want to do an update. This constitutes two completely different operations, and `Device` already has these two operations, but `Info` does not. Here is my code wi...
You can try with this readapted version of your code: ``` from dataclasses import dataclass @dataclass class Info: ssdp: str = None ip: str = None def from_dict(self, data): self.ssdp = data['ssdp'] if 'ssdp' in data.keys() else self.ssdp[0], self.ip = data['ip'] if 'ip' in data.keys() ...
27,410,483
I building my first application with c# and sp.net MVC 5, so far so good :) Now I have a problem, we using 2 User Tables, first one contains the username, other the user data. ``` string user = User.Identity.Name; var data = db.FE_Benutzer; var collection = data.Where(o => o.Benutzername == user).Sel...
2014/12/10
[ "https://Stackoverflow.com/questions/27410483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/290326/" ]
Entity Framework doesn't know how to turn `ElementAt` into SQL. See this answer for more information: [Getting the first result from a LINQ query - why does ElementAt<T>(0) fails when First<T>() succeeds?](https://stackoverflow.com/questions/2650150/getting-the-first-result-from-a-linq-query-why-does-elementatt0-fails-...
Try ``` dataHauptbereich.Where(o => collection.ElementAt(0).hauptbereiche.Any(h => h.ID == o.ID)) ``` Or ``` dataHauptbereich.Where(o => collection.Any(c => c.hauptbereiche.Any(h => h.ID == o.ID))) ```
27,410,483
I building my first application with c# and sp.net MVC 5, so far so good :) Now I have a problem, we using 2 User Tables, first one contains the username, other the user data. ``` string user = User.Identity.Name; var data = db.FE_Benutzer; var collection = data.Where(o => o.Benutzername == user).Sel...
2014/12/10
[ "https://Stackoverflow.com/questions/27410483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/290326/" ]
Try ``` dataHauptbereich.Where(o => collection.ElementAt(0).hauptbereiche.Any(h => h.ID == o.ID)) ``` Or ``` dataHauptbereich.Where(o => collection.Any(c => c.hauptbereiche.Any(h => h.ID == o.ID))) ```
I'm having a bit of a time deciphering exactly what you're trying to achieve with your code here, but it looks to me like your simply querying `Hauptbereich`s that belong to a particular user. Your first query selects an anonymous object composed of `id`, `name` and `hauptbereiche`, but of these you only ever use the `...
27,410,483
I building my first application with c# and sp.net MVC 5, so far so good :) Now I have a problem, we using 2 User Tables, first one contains the username, other the user data. ``` string user = User.Identity.Name; var data = db.FE_Benutzer; var collection = data.Where(o => o.Benutzername == user).Sel...
2014/12/10
[ "https://Stackoverflow.com/questions/27410483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/290326/" ]
Entity Framework doesn't know how to turn `ElementAt` into SQL. See this answer for more information: [Getting the first result from a LINQ query - why does ElementAt<T>(0) fails when First<T>() succeeds?](https://stackoverflow.com/questions/2650150/getting-the-first-result-from-a-linq-query-why-does-elementatt0-fails-...
I'm having a bit of a time deciphering exactly what you're trying to achieve with your code here, but it looks to me like your simply querying `Hauptbereich`s that belong to a particular user. Your first query selects an anonymous object composed of `id`, `name` and `hauptbereiche`, but of these you only ever use the `...
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
`COUNT` does count duplicates in all DBMS I'm aware of, but. > > Is there any reason for a professor to teach this behaviour > > > Yes, there is a reason. In the original relational theory (that underlies all modern relational DBMSes) *relation* is a *set* in mathematical sense of this word. That means that no re...
If the table had looked like this, ``` | product | |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | null | A31 | ``` you could expect the query to return 2, at least in Oracle DB, as nulls are not counted. Duplicates are however counted just fine.
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
Either your professor made a mistake or you misunderstood what she said. In the context of relational DBMSes, as implemented by various vendors, the aggregate function `COUNT(<expression>)` returns the number of non-NULL values of `<expression>` in the result set (or a group). There is a special case of `COUNT(*)`, w...
If the table had looked like this, ``` | product | |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | null | A31 | ``` you could expect the query to return 2, at least in Oracle DB, as nulls are not counted. Duplicates are however counted just fine.
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
This is how it works in MS SQL Server > > COUNT(\*) returns the number of items in a group. This includes NULL > values and duplicates. > > > COUNT(ALL expression) evaluates expression for each row in a group and > returns the number of nonnull values. > > > COUNT(DISTINCT expression) evaluates expression for ...
maybe she mean in conjunction with unique, But Count does COUNT DUPLICATES. There are some teachers who do not know their stuff, no worries just inform your classmates/friends so that when they go on to higher db and real life they wont forget, better yet send an anonymous message to your teacher asking her that they d...
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
Either your professor made a mistake or you misunderstood what she said. In the context of relational DBMSes, as implemented by various vendors, the aggregate function `COUNT(<expression>)` returns the number of non-NULL values of `<expression>` in the result set (or a group). There is a special case of `COUNT(*)`, w...
maybe she mean in conjunction with unique, But Count does COUNT DUPLICATES. There are some teachers who do not know their stuff, no worries just inform your classmates/friends so that when they go on to higher db and real life they wont forget, better yet send an anonymous message to your teacher asking her that they d...
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
`COUNT` does count duplicates in all DBMS I'm aware of, but. > > Is there any reason for a professor to teach this behaviour > > > Yes, there is a reason. In the original relational theory (that underlies all modern relational DBMSes) *relation* is a *set* in mathematical sense of this word. That means that no re...
This is how it works in MS SQL Server > > COUNT(\*) returns the number of items in a group. This includes NULL > values and duplicates. > > > COUNT(ALL expression) evaluates expression for each row in a group and > returns the number of nonnull values. > > > COUNT(DISTINCT expression) evaluates expression for ...
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
If your professor is talking about SQL, the statement is wrong. `COUNT(x)` will return the number of rows where x `IS NOT NULL` including duplicates. `COUNT(*) or COUNT([constant])` is a special case that will count the rows, even those where every column is `NULL`. However, duplicates are always counted, unless you sp...
This is how it works in MS SQL Server > > COUNT(\*) returns the number of items in a group. This includes NULL > values and duplicates. > > > COUNT(ALL expression) evaluates expression for each row in a group and > returns the number of nonnull values. > > > COUNT(DISTINCT expression) evaluates expression for ...
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
`COUNT` does count duplicates in all DBMS I'm aware of, but. > > Is there any reason for a professor to teach this behaviour > > > Yes, there is a reason. In the original relational theory (that underlies all modern relational DBMSes) *relation* is a *set* in mathematical sense of this word. That means that no re...
If your professor is talking about SQL, the statement is wrong. `COUNT(x)` will return the number of rows where x `IS NOT NULL` including duplicates. `COUNT(*) or COUNT([constant])` is a special case that will count the rows, even those where every column is `NULL`. However, duplicates are always counted, unless you sp...
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
If your professor is talking about SQL, the statement is wrong. `COUNT(x)` will return the number of rows where x `IS NOT NULL` including duplicates. `COUNT(*) or COUNT([constant])` is a special case that will count the rows, even those where every column is `NULL`. However, duplicates are always counted, unless you sp...
maybe she mean in conjunction with unique, But Count does COUNT DUPLICATES. There are some teachers who do not know their stuff, no worries just inform your classmates/friends so that when they go on to higher db and real life they wont forget, better yet send an anonymous message to your teacher asking her that they d...
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
If your professor is talking about SQL, the statement is wrong. `COUNT(x)` will return the number of rows where x `IS NOT NULL` including duplicates. `COUNT(*) or COUNT([constant])` is a special case that will count the rows, even those where every column is `NULL`. However, duplicates are always counted, unless you sp...
If the table had looked like this, ``` | product | |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | null | A31 | ``` you could expect the query to return 2, at least in Oracle DB, as nulls are not counted. Duplicates are however counted just fine.
182,420
My professor taught me this SQL statement: ``` SELECT COUNT(length) FROM product ``` will return `2` with the following dataset: ``` product |id | length | code | |-------------------| | 1 | 11 | X00 | | 2 | 11 | C02 | | 3 | 40 | A31 | ``` She justified it by saying that `COUNT` doesn't count dupli...
2017/08/01
[ "https://dba.stackexchange.com/questions/182420", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/131794/" ]
Either your professor made a mistake or you misunderstood what she said. In the context of relational DBMSes, as implemented by various vendors, the aggregate function `COUNT(<expression>)` returns the number of non-NULL values of `<expression>` in the result set (or a group). There is a special case of `COUNT(*)`, w...
This is how it works in MS SQL Server > > COUNT(\*) returns the number of items in a group. This includes NULL > values and duplicates. > > > COUNT(ALL expression) evaluates expression for each row in a group and > returns the number of nonnull values. > > > COUNT(DISTINCT expression) evaluates expression for ...
44,957,110
I am very new to stackoverflow. I want to create this form which uploads information to the database. When I click submit it does not get uploaded. I have checked my connections file and that is correct. Code below. Please help. ``` <?php include("/connections/db_conx.php"); if ( isset($_POST['submit']) ) { $title...
2017/07/06
[ "https://Stackoverflow.com/questions/44957110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8266997/" ]
Here is the code you need to use: ``` <?php include("/connections/db_conx.php"); if(isset($_POST['submit'])) { $title = mysqli_real_escape_string($db_conx, $_POST['title']); $text = mysqli_real_escape_string($db_conx, $_POST['text']); $picture = mysqli_real_escape_string($db_conx, ...
Try This : ``` $title = mysqli_real_escape_string($db_conx, $_POST['title']); $text = mysqli_real_escape_string($db_conx, $_POST['text']); $picture = mysqli_real_escape_string($db_conx, $_POST['picture']); $sql = "INSERT INTO news (title, text, picture) VALUES('$title','$text','$picture')"; $query = mysqli_query ($...
39,876,644
Using the Retrofit library to consume a service, I've added the code for my interface, model and also how I use the interface. I keep getting a GSON throwing “Expected BEGIN\_OBJECT but was BEGIN\_ARRAY” Interface ``` @GET("api/RetrofitAndroidArrayResponse") Call<student> getStudentDetails(); ``` Model publi...
2016/10/05
[ "https://Stackoverflow.com/questions/39876644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2495948/" ]
The response which you are receiving is in the Array format but you have your model as a Student object. Please provide the JSON response you received. Use HttpLoggingInterceptor to log the response.
Thank you for your help It stupid error. The call expected an object and was pointing to url that returned a list of objects. I just changed the url and it worked find ``` @GET("api/RetrofitAndroidObjectResponse") Call<Student> getStudentDetails(); ```
11,272,152
In the code below the SelectionChanged event is fired before the end of RowsAdded,how can I make the Event atomic? ``` private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1]; dataG...
2012/06/30
[ "https://Stackoverflow.com/questions/11272152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/871082/" ]
`SelectionChanged` is fired in the middle of handling `RowsAdded` because you are causing a SelectionChanged by changing the current cell *within* `dataGridView1_RowsAdded`. Adding a row doesn't cause both events to be fired -- you're causing the second event while handling the first one. (In fact, you're probably caus...
You can override the event you want to conrol and then put an if condition in the overriden event and control when it fires and when it does not. mahdi
32,670
The code below just senses when the network is available and enables/disables a button on the UI. If I am registered to the `NetworkAvailability` event for the life of the program, will it cause a memory leak? I heard it might but didn't understand why. ``` System.Net.NetworkInformation.NetworkChange.NetworkAvailabili...
2013/10/14
[ "https://codereview.stackexchange.com/questions/32670", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/29643/" ]
This code is not ready for review, as it's not working—it visits some rules more than once. If you need help writing a [topological sort algorithm](http://en.wikipedia.org/wiki/Topological_sort), Stack Overflow is the right place, not Code Review. But I'll make one important observation about your code: there is no do...
Variable names ============== You mean the dependencies of a rule with `dep`, so use that as variable name. Variable names are a very important part of the documentation of the code. `dep` and `ii` are not so good variable names `visited` ========= To keep the visited nodes, I would use a `set`, since this is the co...
52,276,473
We need to load test an web application using `SignalR` in few components with transport mode as long polling. My script gets hang in connect step. Connect step is `GET- /signalr/connect?transport=foreverFrame&clientProtocol=1.5&connectionToken=ZW6cj17pImmCjGGBQSQNy%2Bdiy7DKDUy4i4R1AE78c%2FTitzS6QgiPoX6fM3zBOrDK11hyx0Q...
2018/09/11
[ "https://Stackoverflow.com/questions/52276473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7773394/" ]
Use a for loop over [Map.entries](https://api.dartlang.org/stable/2.0.0/dart-core/Map/entries.html) instead of forEach. Provided you are in an async function, await-ing in the body of a for loop will pause the iteration. The entry object will also allow you to access both the key and value. ``` Future<void> myFunction...
You could also use `map` like: ``` const futures = myMap.map((a, b) => myAsyncFunc()); await Future.wait(futures); callFunc(); ```