qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
43,002,688
If you create your own `Iterable` container class and retrieve a `java.util.Iterator` over its elements, is there any coding pattern according to which any further additions of elements in the container should **not** be accessible from the `Iterator`? I'm thinking "no way, absolutely not, in fact the `Iterator` should...
2017/03/24
[ "https://Stackoverflow.com/questions/43002688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1379730/" ]
> > Is it perhaps the case that a fail-fast Iterator should throw an > Exception if `next()` is called after a new addition is made? > > > Correct. I believe if you try and do that with any of Java's inbuilt [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html)s you'll get a [ConcurrentM...
User Michael answered my question in the comment above. Fail-fast Iterators should do exactly the latter. Now when one should prefer Fail-fast over Fail-safe, I'm not sure, but given that containers are mutable by definition, I believe Fail-Fast might be the only way to go.
2,665,047
(Note that this question is an edited version of a previous question, which I cannot delete because answers have been submitted.) Suppose $p$ is an odd prime. How does one prove that $p$ does not divide $2^{p} - 1$?
2018/02/24
[ "https://math.stackexchange.com/questions/2665047", "https://math.stackexchange.com", "https://math.stackexchange.com/users/197045/" ]
Since $p$ is odd it is not divisible by $2$ and so by transitivity it is not divisible by $2^{p-1}$.
it is $$2^{p-1}$$ and even number (product of factors $2$) and $$p$$ is an odd number.
2,665,047
(Note that this question is an edited version of a previous question, which I cannot delete because answers have been submitted.) Suppose $p$ is an odd prime. How does one prove that $p$ does not divide $2^{p} - 1$?
2018/02/24
[ "https://math.stackexchange.com/questions/2665047", "https://math.stackexchange.com", "https://math.stackexchange.com/users/197045/" ]
Since $p$ is odd it is not divisible by $2$ and so by transitivity it is not divisible by $2^{p-1}$.
Hint (now you've finally stabilised the question): [Fermat's little theorem](https://en.wikipedia.org/wiki/Fermat%27s_little_theorem) tells you that $p$ does divide $2^p - 2$.
2,665,047
(Note that this question is an edited version of a previous question, which I cannot delete because answers have been submitted.) Suppose $p$ is an odd prime. How does one prove that $p$ does not divide $2^{p} - 1$?
2018/02/24
[ "https://math.stackexchange.com/questions/2665047", "https://math.stackexchange.com", "https://math.stackexchange.com/users/197045/" ]
it is $$2^{p-1}$$ and even number (product of factors $2$) and $$p$$ is an odd number.
Hint (now you've finally stabilised the question): [Fermat's little theorem](https://en.wikipedia.org/wiki/Fermat%27s_little_theorem) tells you that $p$ does divide $2^p - 2$.
49,880,453
[The Spring Boot documentation](https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-typesafe-configuration-properties) says that to use the `@ConfigurationProperties` annotation > > You also need to list the properties classes to regist...
2018/04/17
[ "https://Stackoverflow.com/questions/49880453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6727003/" ]
As M. Deinum referred `@EnableConfigurationProperties` Is for enabling support of `@ConfigurationProperties`. If you take a look to the annotation Java Doc you can see: > > Enable support for ConfigurationProperties annotated beans. ConfigurationProperties beans can be registered in the standard way (for example usin...
If we look at the code below: `@Configuration @EnableConfigurationProperties @ConfigurationProperties(prefix="ar1") public class ar1Settings { }` * **@Configuration** tells Spring to treat this as a configuration class and register it as a Bean * **@EnableConfigurationProperties** tells Spring to treat this class a...
49,880,453
[The Spring Boot documentation](https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-typesafe-configuration-properties) says that to use the `@ConfigurationProperties` annotation > > You also need to list the properties classes to regist...
2018/04/17
[ "https://Stackoverflow.com/questions/49880453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6727003/" ]
It took me a while to reach to this post but would like to add here so that others may get benefited. `@ConfigurationProperties` - Used to bind a class with an externalized property file. Very powerful and must be used to separate out bean classes with configuration entity class. `@Configuration` - Creates a Spring b...
If we look at the code below: `@Configuration @EnableConfigurationProperties @ConfigurationProperties(prefix="ar1") public class ar1Settings { }` * **@Configuration** tells Spring to treat this as a configuration class and register it as a Bean * **@EnableConfigurationProperties** tells Spring to treat this class a...
49,880,453
[The Spring Boot documentation](https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-typesafe-configuration-properties) says that to use the `@ConfigurationProperties` annotation > > You also need to list the properties classes to regist...
2018/04/17
[ "https://Stackoverflow.com/questions/49880453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6727003/" ]
As M. Deinum referred `@EnableConfigurationProperties` Is for enabling support of `@ConfigurationProperties`. If you take a look to the annotation Java Doc you can see: > > Enable support for ConfigurationProperties annotated beans. ConfigurationProperties beans can be registered in the standard way (for example usin...
It took me a while to reach to this post but would like to add here so that others may get benefited. `@ConfigurationProperties` - Used to bind a class with an externalized property file. Very powerful and must be used to separate out bean classes with configuration entity class. `@Configuration` - Creates a Spring b...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
You could use variable variables and loop through your code. But this means you'll have to come up with some sort of standardized validation scheme for your code ``` $validateFields = array('email', 'username', 'userId'); //list of fields to validate $rules = array( 'username' => array('type'=> 'regex', 'rule' => '/...
I don't think you can rewrite this specific piece code in a substantially better way. But, looking at the larger picture there are possible improvements. Looking at the class variables this is probably either a form class or a model instance of some sorts, and you're trying to validate the data before saving it. You c...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
I don't think you can rewrite this specific piece code in a substantially better way. But, looking at the larger picture there are possible improvements. Looking at the class variables this is probably either a form class or a model instance of some sorts, and you're trying to validate the data before saving it. You c...
I dont think you can avoid this multiple If Statements as I see this **is where you validating the fields.** Other Alternative for multimple if statements was **Swtich statement**, I am not sure that is feasible for this situation as you are passing String as an Arguments, where as Switch wont take String as an Argu...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
At first you should extract your error strings into defines or, better, class constants. ``` define('ERR_BAD_NAME','Name should be valid letters and should be between 3 and 25 characters'); define('ERR_BAD_EMAIL','Invalid email address'); define('ERR_EMAIL_IN_USE','Email already exist'); define('ERR_BAD_PASSWD','Passw...
I dont think you can avoid this multiple If Statements as I see this **is where you validating the fields.** Other Alternative for multimple if statements was **Swtich statement**, I am not sure that is feasible for this situation as you are passing String as an Arguments, where as Switch wont take String as an Argu...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
I don't think you can rewrite this specific piece code in a substantially better way. But, looking at the larger picture there are possible improvements. Looking at the class variables this is probably either a form class or a model instance of some sorts, and you're trying to validate the data before saving it. You c...
Here's a mockup of a much much neater code solution, I'm not compiling it since.. it's not my life's work, but it's definitely the sort of path you want to be taking, since you have soooo much repeating yourself in your code. But yeah, this is very close to what yours is doing now, I just lost some ID checks and other...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
You could use variable variables and loop through your code. But this means you'll have to come up with some sort of standardized validation scheme for your code ``` $validateFields = array('email', 'username', 'userId'); //list of fields to validate $rules = array( 'username' => array('type'=> 'regex', 'rule' => '/...
At first you should extract your error strings into defines or, better, class constants. ``` define('ERR_BAD_NAME','Name should be valid letters and should be between 3 and 25 characters'); define('ERR_BAD_EMAIL','Invalid email address'); define('ERR_EMAIL_IN_USE','Email already exist'); define('ERR_BAD_PASSWD','Passw...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
You could use variable variables and loop through your code. But this means you'll have to come up with some sort of standardized validation scheme for your code ``` $validateFields = array('email', 'username', 'userId'); //list of fields to validate $rules = array( 'username' => array('type'=> 'regex', 'rule' => '/...
Here's a mockup of a much much neater code solution, I'm not compiling it since.. it's not my life's work, but it's definitely the sort of path you want to be taking, since you have soooo much repeating yourself in your code. But yeah, this is very close to what yours is doing now, I just lost some ID checks and other...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
At first you should extract your error strings into defines or, better, class constants. ``` define('ERR_BAD_NAME','Name should be valid letters and should be between 3 and 25 characters'); define('ERR_BAD_EMAIL','Invalid email address'); define('ERR_EMAIL_IN_USE','Email already exist'); define('ERR_BAD_PASSWD','Passw...
Here's a mockup of a much much neater code solution, I'm not compiling it since.. it's not my life's work, but it's definitely the sort of path you want to be taking, since you have soooo much repeating yourself in your code. But yeah, this is very close to what yours is doing now, I just lost some ID checks and other...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
At first you should extract your error strings into defines or, better, class constants. ``` define('ERR_BAD_NAME','Name should be valid letters and should be between 3 and 25 characters'); define('ERR_BAD_EMAIL','Invalid email address'); define('ERR_EMAIL_IN_USE','Email already exist'); define('ERR_BAD_PASSWD','Passw...
if you want to les use of if condition you can use select case with if block line case 1 if block case 2 if block if will help you in better way
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
You could use variable variables and loop through your code. But this means you'll have to come up with some sort of standardized validation scheme for your code ``` $validateFields = array('email', 'username', 'userId'); //list of fields to validate $rules = array( 'username' => array('type'=> 'regex', 'rule' => '/...
I dont think you can avoid this multiple If Statements as I see this **is where you validating the fields.** Other Alternative for multimple if statements was **Swtich statement**, I am not sure that is feasible for this situation as you are passing String as an Arguments, where as Switch wont take String as an Argu...
5,973,867
i have a php class method which determines whether if a class property have got any value. if it holds any value then it will validate and iterate $this->error class property. here is the class method i am using. ``` public function validate() { if(!empty($this->name)) { if(!preg_match('/^[a-zA-z ]{3,50}$/...
2011/05/12
[ "https://Stackoverflow.com/questions/5973867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396476/" ]
You could use variable variables and loop through your code. But this means you'll have to come up with some sort of standardized validation scheme for your code ``` $validateFields = array('email', 'username', 'userId'); //list of fields to validate $rules = array( 'username' => array('type'=> 'regex', 'rule' => '/...
if you want to les use of if condition you can use select case with if block line case 1 if block case 2 if block if will help you in better way
6,438,199
I've been trying to resolve this issue for a while and haven't been successful yet. I've got a basic ASP.NET WebService which I'm trying to call from javascript as such. ``` using System; using System.Web; using System.Web.Services.Protocols; using System.Web.Services; using System.Web.Script.Services; namespace Rand...
2011/06/22
[ "https://Stackoverflow.com/questions/6438199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/810138/" ]
If you are **not** using .NET 4 then you need to do configuration entries to enable script service. See <http://msdn.microsoft.com/en-us/library/bb398998(v=VS.90).aspx>. So make sure that you have following section in web.config. ``` <system.web> ... <httpHandlers> <remove verb="*" path="*.asmx"/> <add ve...
I have found in the past that putting () after ScriptService in the attribute declared on the web service class has *seemingly* solved certain bizarre problems. No idea why it might have worked but worth a try in your case too. i.e. ``` [WebService(Namespace = "http://localhost:2900/")] [WebServiceBinding(ConformsTo ...
6,438,199
I've been trying to resolve this issue for a while and haven't been successful yet. I've got a basic ASP.NET WebService which I'm trying to call from javascript as such. ``` using System; using System.Web; using System.Web.Services.Protocols; using System.Web.Services; using System.Web.Script.Services; namespace Rand...
2011/06/22
[ "https://Stackoverflow.com/questions/6438199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/810138/" ]
Try applying [ScriptMethod] attribute on the PieTable method, this usually solves my problems when calling webmethods with JQuery. <http://msdn.microsoft.com/en-us/library/system.web.script.services.scriptmethodattribute.aspx> ``` [WebMethod] [ScriptMethod] public string PieTable(string table) { return table ...
I have found in the past that putting () after ScriptService in the attribute declared on the web service class has *seemingly* solved certain bizarre problems. No idea why it might have worked but worth a try in your case too. i.e. ``` [WebService(Namespace = "http://localhost:2900/")] [WebServiceBinding(ConformsTo ...
562,609
I am new to Nginx and have a reverse proxy to an upstream glassfish server. I am trying to set up a custom 503 page for when the app is down for maintenance. I have been failing to do so for several hours now. The maintenance.html page contains a css and jpg link. These are showing up when I am forwarded to the mainten...
2013/12/19
[ "https://serverfault.com/questions/562609", "https://serverfault.com", "https://serverfault.com/users/167626/" ]
You say you're doing this: > > > ``` > location ~ ^/static/ { > internal; > } > > ``` > > The `internal` keyword means that this `location` is only visible for internal requests, which your `error_page` requests are. If you want to be able to access `/static/` directly from the web-browser, which would seem...
I think the best approach is to do the following things: * Use `inline CSS` * Convert your images to `Base64` After doing this, you can embed the generated Base64 string into the `background-image` CSS rule as follows: ```css background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEADI.....==) ``` You can ...
562,609
I am new to Nginx and have a reverse proxy to an upstream glassfish server. I am trying to set up a custom 503 page for when the app is down for maintenance. I have been failing to do so for several hours now. The maintenance.html page contains a css and jpg link. These are showing up when I am forwarded to the mainten...
2013/12/19
[ "https://serverfault.com/questions/562609", "https://serverfault.com", "https://serverfault.com/users/167626/" ]
I recently wanted to do the same thing (show a nicer maintenance/error-page with images, CSS and custom fonts). What I ended up doing was using an internal location block like this: ``` server { … error_page 502 = @maintenance; location @maintenance { root /path/to/maintenance-site; if (!-f $request_...
I think the best approach is to do the following things: * Use `inline CSS` * Convert your images to `Base64` After doing this, you can embed the generated Base64 string into the `background-image` CSS rule as follows: ```css background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEADI.....==) ``` You can ...
55,893
I have a device which sits on pins 10/11 of Arduino UNO. I am trying to send commands from my PC using Arduino to relay my commands to the device via Serial. The problem is that if I use speed 9600 both for device and USB communication, then my commands gets damaged. Some letters are replaced by strange symbols, etc....
2018/09/06
[ "https://arduino.stackexchange.com/questions/55893", "https://arduino.stackexchange.com", "https://arduino.stackexchange.com/users/49331/" ]
I spent some time playing with your code and it seems your code actually loops the serial therefore if they are both set at 9600 as example and you print what the other one is sending like in your code you end up in a loop if you want to read what your serial is sending it is better put that values in a variable and se...
If you are confident with the device you connected to your Arduino Uno in terms of it has a reliable serial communication firmware running on it, You might need some buffering before relaying your commands; ``` #define RECORD_SIZE 100 void loop() { RelayDataIfAvaliable(); } void RelayDataIfAvaliable() { static...
4,640,787
I have an abstract template method: ``` class abstract MyTemplate { public void something(Object obj) { doSomething(obj) } protected void doSomething(Object obj); } class MyImpl extends MyTemplate { protected void doSomething(Object obj) { System.out.println("i am dealing with...
2011/01/09
[ "https://Stackoverflow.com/questions/4640787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/463300/" ]
Well you really can't do it. Java can't do double dispatch out of the box. The problem is that the binding of the method calls is usually done mostly at compile time. Here <http://en.wikipedia.org/wiki/Double_dispatch> and here <http://www.javaperformancetuning.com/articles/ddispatch2.shtml>
Its not possible. doSomething(Object obj) in MyImpl is the method that overrides the doSomething in MyTemplate. Use the instanceof-operator in doSomething(Object obj) in MyImpl. It is better style anyway.
4,640,787
I have an abstract template method: ``` class abstract MyTemplate { public void something(Object obj) { doSomething(obj) } protected void doSomething(Object obj); } class MyImpl extends MyTemplate { protected void doSomething(Object obj) { System.out.println("i am dealing with...
2011/01/09
[ "https://Stackoverflow.com/questions/4640787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/463300/" ]
Well you really can't do it. Java can't do double dispatch out of the box. The problem is that the binding of the method calls is usually done mostly at compile time. Here <http://en.wikipedia.org/wiki/Double_dispatch> and here <http://www.javaperformancetuning.com/articles/ddispatch2.shtml>
In short, you can't. Other answers explained why. An alternative might be to use generics instead and rely on a specific subtype of your abstract class for handling Strings (or another specific class). For example: ``` abstract public class MyTemplate<T> { abstract public void doSomething(T t); } public class MyT...
4,640,787
I have an abstract template method: ``` class abstract MyTemplate { public void something(Object obj) { doSomething(obj) } protected void doSomething(Object obj); } class MyImpl extends MyTemplate { protected void doSomething(Object obj) { System.out.println("i am dealing with...
2011/01/09
[ "https://Stackoverflow.com/questions/4640787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/463300/" ]
Well you really can't do it. Java can't do double dispatch out of the box. The problem is that the binding of the method calls is usually done mostly at compile time. Here <http://en.wikipedia.org/wiki/Double_dispatch> and here <http://www.javaperformancetuning.com/articles/ddispatch2.shtml>
The java compiler uses the compile time type of the method arguments to create the method call, which in your example is Object and not String. The runtime type of the arguments is ignored by method calls. You could either try the [visitor pattern](http://en.wikipedia.org/wiki/Visitor_pattern) if you control all input...
15,456,717
I am trying to refresh the data on a tableview that is using core data on a view controller (View Controller 1). The save button (UIButton) which is used to save the values into core data is on a different view controller (View Controller 2). They are both on the same screen on the iPad at the same time but have separ...
2013/03/17
[ "https://Stackoverflow.com/questions/15456717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593583/" ]
You do not need to recreate the viewcontroller as you are doing now. When the `NSManagedObjectContext` completes a save operation, it posts a notification. You can have any object register to receive these notifications. Consider this if re-setting the delegate of the `fetchedResultsController` would not be an option ...
You probably don't want to create a new instance of `ViewController2` when your goal is for the instance you already have to refresh. In fact, your problem is in `ViewController2`, not here. Make sure `ViewController2` is set as the delegate of its fetched results controller, and then update your table view from the f...
750,159
If I am given a string of letters `'abcd'` and I want to convert this to a vector of numbers `V = [1,2,3,4]` which corresponds to the position of letters in the alphabet table, how can I do this?
2009/04/15
[ "https://Stackoverflow.com/questions/750159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To map 'a' to 1, 'b' to 2, etc., use the [DOUBLE](http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html) function to recast the character back to its ASCII code number, then shift the value: ``` V = double(charString)-96; ``` **EDIT:** Actually, you don't even need the call to DOUBLE. Characters will...
use `uint8`, then subtract the char value of 'a', then push that onto a vector. [link](http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_prog/f2-47856.html&http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=matlab+string+manipulat...
750,159
If I am given a string of letters `'abcd'` and I want to convert this to a vector of numbers `V = [1,2,3,4]` which corresponds to the position of letters in the alphabet table, how can I do this?
2009/04/15
[ "https://Stackoverflow.com/questions/750159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Just subtract 'a'. Add one to map 'a' to 1. The subtraction sends the results into a double. ``` V = C - 'a' + 1; ``` For example, ``` C = 'helloworld'; C - 'a' + 1 ans = 8 5 12 12 15 23 15 18 12 4 ```
use `uint8`, then subtract the char value of 'a', then push that onto a vector. [link](http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_prog/f2-47856.html&http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=matlab+string+manipulat...
750,159
If I am given a string of letters `'abcd'` and I want to convert this to a vector of numbers `V = [1,2,3,4]` which corresponds to the position of letters in the alphabet table, how can I do this?
2009/04/15
[ "https://Stackoverflow.com/questions/750159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Just subtract 'a'. Add one to map 'a' to 1. The subtraction sends the results into a double. ``` V = C - 'a' + 1; ``` For example, ``` C = 'helloworld'; C - 'a' + 1 ans = 8 5 12 12 15 23 15 18 12 4 ```
To map 'a' to 1, 'b' to 2, etc., use the [DOUBLE](http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html) function to recast the character back to its ASCII code number, then shift the value: ``` V = double(charString)-96; ``` **EDIT:** Actually, you don't even need the call to DOUBLE. Characters will...
13,697,449
``` public static void print(String id) { try{ FileWriter fstream = new FileWriter("out.txt"); BufferedWriter out = new BufferedWriter(fstream); out.write(id +"\n"); out.close(); }catch (Exception e){ } } ``` I call this method hundreds of thousands of times during run-t...
2012/12/04
[ "https://Stackoverflow.com/questions/13697449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1165790/" ]
State of your toggle button will be cleared to it's default value from webservice data each time when you sroll it out of the screen, because views of all not currently visible rows are deleted and will be recreated with default values. You need to save state of you toggle button. For example, you can save it in object...
save your position of View when u check the toggle button of that respective view...and in getView() write this code ``` if(yourposition==position) tbtnStatus.setChecked(true); ``` Suppose you clicked 3rd position toggle..save 3 as yourposition and when u will scroll getView gets called and will satify the c...
31,027,705
I am struggling to parse a json output with Java and gson, but I am really stuck. I would appreciate any suugestion. This is my sample JSON file: ``` { "sportId": 29, "last": 26142386, "league": [ { "id": 1833, "events": [ { "id": 383911973, "starts": "...
2015/06/24
[ "https://Stackoverflow.com/questions/31027705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5044640/" ]
The real answer here is to not do it this way. Have you looked at Hibernate? It's like Entity for C#. It allows you to interact with your relational database as an object oriented entity structure, which is how we're used to thinking about things. Typically, when you have a set of data as input and need to put that...
Try jackson to parse JSON to java object, you get some help from here where a similar JSON was parsed to couple of java objects. [JSON parsing example using jackson](https://stackoverflow.com/a/30979270/1129313) Try it and let me know if you find any issue.
31,027,705
I am struggling to parse a json output with Java and gson, but I am really stuck. I would appreciate any suugestion. This is my sample JSON file: ``` { "sportId": 29, "last": 26142386, "league": [ { "id": 1833, "events": [ { "id": 383911973, "starts": "...
2015/06/24
[ "https://Stackoverflow.com/questions/31027705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5044640/" ]
The real answer here is to not do it this way. Have you looked at Hibernate? It's like Entity for C#. It allows you to interact with your relational database as an object oriented entity structure, which is how we're used to thinking about things. Typically, when you have a set of data as input and need to put that...
Ok, I figured out how to do the iteration: ``` for (Leagues leg : Leagues) { System.out.println(leg.getLeagueId()); ArrayList<Events> Events = leg.getListOfEvents(); for (Events event : Events) { System.out.println(event.getEventId()); System.out.println(event.getHome()...
3,378,033
When I was looking to the System.Linq.Expression capabilities (creating expression trees in code, compiling them, executing them) I was asking myself if this is possible for class creation as well - specifically generic classes. I would expect something like Expression.Class() or Expression.GenericClass(). Looking at ...
2010/07/31
[ "https://Stackoverflow.com/questions/3378033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/180315/" ]
There is an example of how to do this in All-In-One Framework codeplex project <http://1code.codeplex.com/> ``` // Define the assembly and the module. AppDomain appDomain = AppDomain.CurrentDomain; AssemblyName assemblyName = new AssemblyName("EmittedAssembly"); AssemblyBuilder assembly = appDomain.DefineDynamicAssem...
You should look into the [CSharpCodeProvider](http://support.microsoft.com/kb/304655) or you can look into the [dynamic](http://msdn.microsoft.com/en-us/library/system.dynamic.dynamicobject.aspx) feature of .Net4. Both will allow you to create new object types in code which can be instantiated.
29,832,957
I have inspected a lot of buttons using a technique where their icon is defined by text through the "before" pseudo-element, something like this: ``` element:before { content: "\e604"; } ``` That code is suposed to draw a star. I added that to my code, but the icon is not drawn. ``` .button { text-align: c...
2015/04/23
[ "https://Stackoverflow.com/questions/29832957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1701077/" ]
What is actually showing up is a font. ``` content:"\e604"; ``` The statement above will just render the glyph (or char) that relates to the \e604 unicode. So, unless you specifically have a font specified and included (Such as [glyphicons](http://glyphicons.com/) or [font-awesome](http://fortawesome.github.io/Fo...
In your example fiddle, you missed the class on the button. It should be this: ``` <div class="button admin__add"></div> ``` Other than that, you need to set the font-family in the `.admin__add:before` css I created [this fiddle](http://jsfiddle.net/egeszqw6/1/), using font awesome as an example
41,181,783
This is in my main activity class, I can pass and retrieve data in my other class through shared preferences but I cant clear the shared preferences in my other class. Also tell me how to check that my shared preferences are cleared. ``` SharedPreferences sharedPreferences; public static final String MyPREFERENCES = "...
2016/12/16
[ "https://Stackoverflow.com/questions/41181783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7305961/" ]
In your code, ``` memset(lptr->array, NULL, INITIAL_LIST_SIZE*sizeof(void *)); ``` is wrong, as the second argument is expected to be an `int`, you're passing a pointer. The conversion is a highly implementation defined behaviour, and in most of the cases, it would invoke UB. Related, quoting `C11`, chapter §7.19 ...
It's valid on all major platforms, except for one thing: Don't pass `NULL` as the value to set. Remember that the `memset` function operates on the individual *bytes* of the memory, and you should set all the bytes to zero (`0`). It is however not strictly technically valid. On most major platforms a null pointer is e...
24,481,433
Given this database schema ``` CREATE TABLE a ( datum INTEGER NOT NULL REFERENCES datum_details(id), processed_datum INTEGER REFERENCES datum_details(id), -- other columns PRIMARY KEY(datum) ); CREATE INDEX a__processed ON a(processed_datum); CREATE TABLE b ( locale TEXT NOT NULL,...
2014/06/30
[ "https://Stackoverflow.com/questions/24481433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388520/" ]
You might be able to do better with an exception *join*, essentially (DB2 has this as an actual join type, everybody else has to use this form): ``` INSERT INTO b (locale, datum) SELECT y.locale, x.datum FROM (SELECT DISTINCT processed_datum FROM a WHERE processed_datum IS NOT NULL) x(datum) CROSS JOIN (...
The `not exists` variant suggested by **Clockwork-Muse** frequently outperforms the others. But I guess the bulk of the cost lies in the `primary key` and `b__datum` indexes building concurrently to the insertion. It is cheaper to build the indexes at once. Try dropping the primary key and the index before the inserti...
24,481,433
Given this database schema ``` CREATE TABLE a ( datum INTEGER NOT NULL REFERENCES datum_details(id), processed_datum INTEGER REFERENCES datum_details(id), -- other columns PRIMARY KEY(datum) ); CREATE INDEX a__processed ON a(processed_datum); CREATE TABLE b ( locale TEXT NOT NULL,...
2014/06/30
[ "https://Stackoverflow.com/questions/24481433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388520/" ]
You might be able to do better with an exception *join*, essentially (DB2 has this as an actual join type, everybody else has to use this form): ``` INSERT INTO b (locale, datum) SELECT y.locale, x.datum FROM (SELECT DISTINCT processed_datum FROM a WHERE processed_datum IS NOT NULL) x(datum) CROSS JOIN (...
``` CREATE TABLE a ( datum INTEGER NOT NULL -- REFERENCES datum_details(id) , processed_datum INTEGER -- REFERENCES datum_details(id) -- other columns , PRIMARY KEY(datum) ); CREATE INDEX a__processed ON a(processed_datum); CREATE TABLE b ( locale TEXT NOT NULL , datum ...
24,481,433
Given this database schema ``` CREATE TABLE a ( datum INTEGER NOT NULL REFERENCES datum_details(id), processed_datum INTEGER REFERENCES datum_details(id), -- other columns PRIMARY KEY(datum) ); CREATE INDEX a__processed ON a(processed_datum); CREATE TABLE b ( locale TEXT NOT NULL,...
2014/06/30
[ "https://Stackoverflow.com/questions/24481433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388520/" ]
The `not exists` variant suggested by **Clockwork-Muse** frequently outperforms the others. But I guess the bulk of the cost lies in the `primary key` and `b__datum` indexes building concurrently to the insertion. It is cheaper to build the indexes at once. Try dropping the primary key and the index before the inserti...
``` CREATE TABLE a ( datum INTEGER NOT NULL -- REFERENCES datum_details(id) , processed_datum INTEGER -- REFERENCES datum_details(id) -- other columns , PRIMARY KEY(datum) ); CREATE INDEX a__processed ON a(processed_datum); CREATE TABLE b ( locale TEXT NOT NULL , datum ...
16,168,310
I need some info as soon as you can to help me sort out an issue. I have designed an application in PHP which queries a mysql database and returns responses as json. I have load tested the json response in both pylot and apache jmeter and it was fine. I am using persistent connections using PHP's PDO. However even thou...
2013/04/23
[ "https://Stackoverflow.com/questions/16168310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/965276/" ]
Since there was no answer i ended up using native php functions which worked. imgpng has a 2nd parameter if you wish to saved the file to your server instead. Since they were being printed on a click of the button i just prompted a browser download ``` private function overlay2($template, $source_image) { $src ...
i had the same problem. Issue is on PNG 24 bits images. Try to use **PNG 16 bits** to avoid the problem. Maybe Gif image will work too (not tested). Codeigniter image library is a nice class.
71,694,137
I'm working on a function that gets the map of string key and it's hex value. I got the string key part working, but I'm having trouble getting the hex part to work. This is my function so far: ``` function Get-Contents4_h{ [cmdletbinding()] Param ([string]$fileContent) #define Error_Failed_To_Do_A ...
2022/03/31
[ "https://Stackoverflow.com/questions/71694137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1012914/" ]
You need to remove the `[...]` range construct around `0x\w` - the `0x` occurs exactly once in the input string, and the following characters appears *at least* once - but the expression `[0x\w]*` could be satisfied by an empty string (thanks to the `*`, 0-or-more quantifier). I'd suggest matching the whole line at on...
This works for me. The square brackets match any one character inside them at a time. The pattern with the square brackets has 18 matches in this line, the first match being empty string ''. Regex101.com says the same thing (null). <https://regex101.com/r/PZ8Y8C/1> This would work `0x[\w]*`, but then you might as well ...
44,999,436
I would like to convert a string to an `int` and calling the function from `main`. Where the first character is a letter declaring the base of the number and the rest of the characters in the string are the number. I am able to get the function to work separately, but when using the `main` function to call it will not ...
2017/07/09
[ "https://Stackoverflow.com/questions/44999436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6900516/" ]
I suppose your code cannot be compiled because some errors. The first one is in the line ``` int str_to_int(inputbase) ``` where `inputbase` are defined without type. If this changed to ``` int str_to_int(char * inputbase) ``` the next point for improvement is in line ``` num1[50] = inputbase; ``` assign...
The prototype for your function `str_to_int()` should specify the type of `intputbase`. You are passing a string and there is no reason for `str_to_int` to modify this string, so the type should be `const char *inputbase`. Furthermore, you do not need a local copy for the string, just access the first character to det...
41,319
I would like to generate a shortned version of one of my column (Content\_\_C) from SOQL in my Apex Controller. This is the code I have currently which does not work? ``` public list<News__c> lstItem; public string excerpt; public list<News__c> getNewsItems(){ lstItem = new list<News__c>(); lstItem = [SELECT...
2014/06/23
[ "https://salesforce.stackexchange.com/questions/41319", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/8296/" ]
you controller should be modified as : ``` public list<News__c> lstItem; public string excerpt; public list<News__c> lstItem {get;set;} public map<id,string> newsmap{get;set;} public list<News__c> getNewsItems(){ lstItem = new list<News__c>(); lstItem = [SELECT Id, Name, Title__C, Content__c, Publish_Date__c,...
Create a Wrapper class for your news items and put them in it: ``` public List<NewsWrapper> getNewsItems() { lstItem = new List<NewsWrapper>(); for (News__c item: [SELECT Id, Name, Title__C, Content__c, Publish_Date__c, (Select Id, Name, LastModifiedDate From Attachments ...
946,537
Assume that $W\_t$ is Brownian motion (1-D) and that $t<T$. How can I compute $$E(W\_t||W\_T|),$$ the conditional expectation of $W\_t$ given $|W\_T|$, i.e. with respect to the $\sigma$-algebra $F$ induced by $|W\_T|$? > > The $\sigma$-algebra induced by $|W\_T|$ would be formed by sets of the form $S\cup S'$, wher...
2014/09/26
[ "https://math.stackexchange.com/questions/946537", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
The distributions of $(W\_t,W\_T)$ and $(-W\_t,-W\_T)$ coincide hence the distributions of $(W\_t,|W\_T|)$ and $(-W\_t,|W\_T|)$ coincide. Conditional expectations depend only on distributions$^{(\ast)}$ hence $E(W\_t\mid|W\_T|)=E(-W\_t\mid|W\_T|)=-E(W\_t\mid|W\_T|)$, which implies $E(W\_t\mid|W\_T|)=0$. The argument s...
Another way of looking at it is to write $W\_t = W\_t \mathbf{1}\_{ \left( W\_T > 0 \right)} + W\_t \mathbf{1}\_{ \left( W\_T < 0 \right)} $, then using the conditional expectation formula $$ \mathbf{E}\left[ X \vert A\right] = \frac{ \mathbf{E} \left[ X \mathbf{1}\_{A} \right ]}{\mathbf{P}(A)}, $$ for events $A = \le...
36,761,621
Here is what I exactly want: ``` A = [1,2,3] for a in A: if a > 1: del a print(A) ``` I want list a to be [1], however it will still be [1,2,3]. So my real goal is to delete current element I get now. I know there is one usage of 'del' liking this: ``` A = [1,2,3] for i, a in enumerate(A): if a...
2016/04/21
[ "https://Stackoverflow.com/questions/36761621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5927858/" ]
``` B = filter(lambda x: x <= 1, A) ``` Then `B` is all elements that less than or equal 1 of `A`.
``` >>> [i for i in [1,2,3] if i<=1] [1] >>> list(filter(lambda x:x<=1, [1,2,3])) [1] >>> ``` all list elements that are `>1` are filtered out
36,761,621
Here is what I exactly want: ``` A = [1,2,3] for a in A: if a > 1: del a print(A) ``` I want list a to be [1], however it will still be [1,2,3]. So my real goal is to delete current element I get now. I know there is one usage of 'del' liking this: ``` A = [1,2,3] for i, a in enumerate(A): if a...
2016/04/21
[ "https://Stackoverflow.com/questions/36761621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5927858/" ]
``` B = filter(lambda x: x <= 1, A) ``` Then `B` is all elements that less than or equal 1 of `A`.
In your Code when you are trying to delete the value ``` del a ``` You actually were trying to delete a temporary variable **a** whose value is same as the value of A[X] . So the value in A still remains unaffected. If you want to delete the value from A, you can make use of ``` del A[X] a.remove(value) ``` the...
36,761,621
Here is what I exactly want: ``` A = [1,2,3] for a in A: if a > 1: del a print(A) ``` I want list a to be [1], however it will still be [1,2,3]. So my real goal is to delete current element I get now. I know there is one usage of 'del' liking this: ``` A = [1,2,3] for i, a in enumerate(A): if a...
2016/04/21
[ "https://Stackoverflow.com/questions/36761621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5927858/" ]
``` B = filter(lambda x: x <= 1, A) ``` Then `B` is all elements that less than or equal 1 of `A`.
In general, you must be very careful while modifying the data structure if you are currently iterating over its elements. Python will give you an error if you try to delete elements from a list while iterating over the elements of the list. If you really want to modify the list, then use a different iteration strategy,...
36,761,621
Here is what I exactly want: ``` A = [1,2,3] for a in A: if a > 1: del a print(A) ``` I want list a to be [1], however it will still be [1,2,3]. So my real goal is to delete current element I get now. I know there is one usage of 'del' liking this: ``` A = [1,2,3] for i, a in enumerate(A): if a...
2016/04/21
[ "https://Stackoverflow.com/questions/36761621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5927858/" ]
It is almost never a good idea to change a collection you are iterative over. In many cases, a better way would be to select only these elements that you want in your new list. A pythonesque way to do this is using list comprehension: ``` a = [1,2,3] b = [x for x in a if x <= 1] print (b) ``` the `'[ .. for...
``` >>> [i for i in [1,2,3] if i<=1] [1] >>> list(filter(lambda x:x<=1, [1,2,3])) [1] >>> ``` all list elements that are `>1` are filtered out
36,761,621
Here is what I exactly want: ``` A = [1,2,3] for a in A: if a > 1: del a print(A) ``` I want list a to be [1], however it will still be [1,2,3]. So my real goal is to delete current element I get now. I know there is one usage of 'del' liking this: ``` A = [1,2,3] for i, a in enumerate(A): if a...
2016/04/21
[ "https://Stackoverflow.com/questions/36761621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5927858/" ]
In general, you must be very careful while modifying the data structure if you are currently iterating over its elements. Python will give you an error if you try to delete elements from a list while iterating over the elements of the list. If you really want to modify the list, then use a different iteration strategy,...
``` >>> [i for i in [1,2,3] if i<=1] [1] >>> list(filter(lambda x:x<=1, [1,2,3])) [1] >>> ``` all list elements that are `>1` are filtered out
36,761,621
Here is what I exactly want: ``` A = [1,2,3] for a in A: if a > 1: del a print(A) ``` I want list a to be [1], however it will still be [1,2,3]. So my real goal is to delete current element I get now. I know there is one usage of 'del' liking this: ``` A = [1,2,3] for i, a in enumerate(A): if a...
2016/04/21
[ "https://Stackoverflow.com/questions/36761621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5927858/" ]
It is almost never a good idea to change a collection you are iterative over. In many cases, a better way would be to select only these elements that you want in your new list. A pythonesque way to do this is using list comprehension: ``` a = [1,2,3] b = [x for x in a if x <= 1] print (b) ``` the `'[ .. for...
In your Code when you are trying to delete the value ``` del a ``` You actually were trying to delete a temporary variable **a** whose value is same as the value of A[X] . So the value in A still remains unaffected. If you want to delete the value from A, you can make use of ``` del A[X] a.remove(value) ``` the...
36,761,621
Here is what I exactly want: ``` A = [1,2,3] for a in A: if a > 1: del a print(A) ``` I want list a to be [1], however it will still be [1,2,3]. So my real goal is to delete current element I get now. I know there is one usage of 'del' liking this: ``` A = [1,2,3] for i, a in enumerate(A): if a...
2016/04/21
[ "https://Stackoverflow.com/questions/36761621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5927858/" ]
It is almost never a good idea to change a collection you are iterative over. In many cases, a better way would be to select only these elements that you want in your new list. A pythonesque way to do this is using list comprehension: ``` a = [1,2,3] b = [x for x in a if x <= 1] print (b) ``` the `'[ .. for...
In general, you must be very careful while modifying the data structure if you are currently iterating over its elements. Python will give you an error if you try to delete elements from a list while iterating over the elements of the list. If you really want to modify the list, then use a different iteration strategy,...
36,761,621
Here is what I exactly want: ``` A = [1,2,3] for a in A: if a > 1: del a print(A) ``` I want list a to be [1], however it will still be [1,2,3]. So my real goal is to delete current element I get now. I know there is one usage of 'del' liking this: ``` A = [1,2,3] for i, a in enumerate(A): if a...
2016/04/21
[ "https://Stackoverflow.com/questions/36761621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5927858/" ]
In general, you must be very careful while modifying the data structure if you are currently iterating over its elements. Python will give you an error if you try to delete elements from a list while iterating over the elements of the list. If you really want to modify the list, then use a different iteration strategy,...
In your Code when you are trying to delete the value ``` del a ``` You actually were trying to delete a temporary variable **a** whose value is same as the value of A[X] . So the value in A still remains unaffected. If you want to delete the value from A, you can make use of ``` del A[X] a.remove(value) ``` the...
42,121,242
I have the following pipeline script in Jenkins: ``` node { withMaven(globalMavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml', jdk: 'JDK 1.8.0u92', maven: 'apache-maven-3.2.2', mavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml') { sh '/my/path/apache-maven-3.2.2/bin/mvn...
2017/02/08
[ "https://Stackoverflow.com/questions/42121242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3122885/" ]
In the end, I used `shell` instead of `sh` and it worked. No idea why, they don't have a proper API.
I would suggest to use it like this: ``` withMaven( maven: 'M3', mavenSettingsConfig: 'maven-settings-for-the-task', mavenLocalRepo: '.repository') { // Run the maven build sh "mvn clean install" } ``` Apart from that I would not use absolute paths to global...
42,121,242
I have the following pipeline script in Jenkins: ``` node { withMaven(globalMavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml', jdk: 'JDK 1.8.0u92', maven: 'apache-maven-3.2.2', mavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml') { sh '/my/path/apache-maven-3.2.2/bin/mvn...
2017/02/08
[ "https://Stackoverflow.com/questions/42121242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3122885/" ]
This might be the result of modifying `PATH`. Check your script and Global Properties and remove modifications to `PATH`. It is now recommended to use `PATH+extra` instead. It would still be picked up, but without breaking actual `PATH`. Related issue on Jenkins: <https://issues.jenkins-ci.org/browse/JENKINS-41339>
I would suggest to use it like this: ``` withMaven( maven: 'M3', mavenSettingsConfig: 'maven-settings-for-the-task', mavenLocalRepo: '.repository') { // Run the maven build sh "mvn clean install" } ``` Apart from that I would not use absolute paths to global...
42,121,242
I have the following pipeline script in Jenkins: ``` node { withMaven(globalMavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml', jdk: 'JDK 1.8.0u92', maven: 'apache-maven-3.2.2', mavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml') { sh '/my/path/apache-maven-3.2.2/bin/mvn...
2017/02/08
[ "https://Stackoverflow.com/questions/42121242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3122885/" ]
This might be the result of modifying `PATH`. Check your script and Global Properties and remove modifications to `PATH`. It is now recommended to use `PATH+extra` instead. It would still be picked up, but without breaking actual `PATH`. Related issue on Jenkins: <https://issues.jenkins-ci.org/browse/JENKINS-41339>
In the end, I used `shell` instead of `sh` and it worked. No idea why, they don't have a proper API.
42,121,242
I have the following pipeline script in Jenkins: ``` node { withMaven(globalMavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml', jdk: 'JDK 1.8.0u92', maven: 'apache-maven-3.2.2', mavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml') { sh '/my/path/apache-maven-3.2.2/bin/mvn...
2017/02/08
[ "https://Stackoverflow.com/questions/42121242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3122885/" ]
In the end, I used `shell` instead of `sh` and it worked. No idea why, they don't have a proper API.
This error comes when you are trying to run script copied from windows machine to unix machine. YOU need to change the format to unix using : **dos2unix <scriptname.sh>** and the run your script in unix **./<scriptname.sh>**
42,121,242
I have the following pipeline script in Jenkins: ``` node { withMaven(globalMavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml', jdk: 'JDK 1.8.0u92', maven: 'apache-maven-3.2.2', mavenSettingsFilePath: '/my/path/apache-maven-3.2.2/conf/settings.xml') { sh '/my/path/apache-maven-3.2.2/bin/mvn...
2017/02/08
[ "https://Stackoverflow.com/questions/42121242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3122885/" ]
This might be the result of modifying `PATH`. Check your script and Global Properties and remove modifications to `PATH`. It is now recommended to use `PATH+extra` instead. It would still be picked up, but without breaking actual `PATH`. Related issue on Jenkins: <https://issues.jenkins-ci.org/browse/JENKINS-41339>
This error comes when you are trying to run script copied from windows machine to unix machine. YOU need to change the format to unix using : **dos2unix <scriptname.sh>** and the run your script in unix **./<scriptname.sh>**
177,696
Please give me the link to download the gnome-shell integration plugin which will allow me to subsequently install gnome-shell extensions via the web browser. I just want the link to the plugin, I do not want to do `apt-get dist-upgrade` or reinstall gnome. The link to the plugin itself, should be available for all...
2012/08/19
[ "https://askubuntu.com/questions/177696", "https://askubuntu.com", "https://askubuntu.com/users/13177/" ]
I believe the confusion is that the plugin does not seem to be shipped as a plugin on ff addons. Instead, you find it in the repo for your distro. See the file lists below. Unfortunately, it also appears that not all the distros put it in the same "kind" of place. Ubuntu: <http://packages.ubuntu.com/saucy/amd64/gnome-...
[Here you go!](https://addons.mozilla.org/en-US/thunderbird/addon/gnome-integration/) It is on Firefox's add-on page but is hard to find with the browser's local search machine.
177,696
Please give me the link to download the gnome-shell integration plugin which will allow me to subsequently install gnome-shell extensions via the web browser. I just want the link to the plugin, I do not want to do `apt-get dist-upgrade` or reinstall gnome. The link to the plugin itself, should be available for all...
2012/08/19
[ "https://askubuntu.com/questions/177696", "https://askubuntu.com", "https://askubuntu.com/users/13177/" ]
This file is a PLUGIN of firefox (NOT an extension) and therefore it's stored under ``` /usr/lib/mozilla/plugins/libgnome-shell-browser-plugin.so ``` you may check that in a fully functional (gnome!) firefox by entering this in the adressbar of firefox: ``` about:plugins ``` then scroll down to "Gnome Shell Inte...
[Here you go!](https://addons.mozilla.org/en-US/thunderbird/addon/gnome-integration/) It is on Firefox's add-on page but is hard to find with the browser's local search machine.
251,688
How much should an average mathematician not working in an area like logic, set theory, or foundations know about the foundations of mathematics? The thread [Why should we believe in the axiom of regularity?](https://mathoverflow.net/questions/219590/why-should-we-believe-in-the-axiom-of-regularity) suggests that many...
2016/10/08
[ "https://mathoverflow.net/questions/251688", "https://mathoverflow.net", "https://mathoverflow.net/users/99445/" ]
The answer is essentially the same as *how much should the average mathematician know about combinatorics*? Or *group theory*? Or *algebraic topology*? Or any broad area of mathematics... It's good to know some, it's always helpful to know more, but only really need the amount that is relevant to your work. Perhaps a s...
I agree with the previous answer: it is difficult to state what an average mathematician "should" know. (I dare to conjecture that there is no such thing!) Each university has its own opinion on this: look at the graduate programs, and notice which courses are mandatory. In some countries this is decided by the state....
59,459
I am trying to implement account lockout in ubuntu using pam\_tally. I have tried adding the follwing lines in **/etc/pam.d/common-auth** ``` auth required pam_tally.so deny=3 account required pam_tally.so ``` The failures are getting logged but account is not getting locked even on reaching max failures. I am...
2011/08/31
[ "https://askubuntu.com/questions/59459", "https://askubuntu.com", "https://askubuntu.com/users/24163/" ]
Explanation Behind common-auth ------------------------------ If you're just looking for a quick fix, go below to **How to Configure common-auth to Lock Out**. --- Hopefully this will help bring some sense into how `/etc/pam.d/common-auth` configures lockout. If you take out all the comments in `/etc/pam.d/common-a...
It has been a while since I looked at this, but I think you need to edit `/etc/pam.d/common-auth` Add this at the **top** of the file (order of rules matters). ``` auth required pam_tally.so per_user magic_root onerr=fail ``` You then set the number of allowed attempts ``` sudo faillog -m 3 ``` To unlock an acc...
59,459
I am trying to implement account lockout in ubuntu using pam\_tally. I have tried adding the follwing lines in **/etc/pam.d/common-auth** ``` auth required pam_tally.so deny=3 account required pam_tally.so ``` The failures are getting logged but account is not getting locked even on reaching max failures. I am...
2011/08/31
[ "https://askubuntu.com/questions/59459", "https://askubuntu.com", "https://askubuntu.com/users/24163/" ]
It has been a while since I looked at this, but I think you need to edit `/etc/pam.d/common-auth` Add this at the **top** of the file (order of rules matters). ``` auth required pam_tally.so per_user magic_root onerr=fail ``` You then set the number of allowed attempts ``` sudo faillog -m 3 ``` To unlock an acc...
You could also try faillock to lock the user accounts after n failed login attempts. I was able to get it working by following the instructinos in the link below which uses pam\_faillock.so which I guess works both on Ubuntu and CentOS. On CentOS and Similar Derivatives: ``` /etc/pam.d/system-auth /etc/pam.d/passwo...
59,459
I am trying to implement account lockout in ubuntu using pam\_tally. I have tried adding the follwing lines in **/etc/pam.d/common-auth** ``` auth required pam_tally.so deny=3 account required pam_tally.so ``` The failures are getting logged but account is not getting locked even on reaching max failures. I am...
2011/08/31
[ "https://askubuntu.com/questions/59459", "https://askubuntu.com", "https://askubuntu.com/users/24163/" ]
Explanation Behind common-auth ------------------------------ If you're just looking for a quick fix, go below to **How to Configure common-auth to Lock Out**. --- Hopefully this will help bring some sense into how `/etc/pam.d/common-auth` configures lockout. If you take out all the comments in `/etc/pam.d/common-a...
You could also try faillock to lock the user accounts after n failed login attempts. I was able to get it working by following the instructinos in the link below which uses pam\_faillock.so which I guess works both on Ubuntu and CentOS. On CentOS and Similar Derivatives: ``` /etc/pam.d/system-auth /etc/pam.d/passwo...
5,772,136
I want to simplify things, by not creating a list of enum separately, but create the enums along the function call which creates the data where i point with those enums. I tried to make #define which would create another #define, but it didnt work: ``` int defcounter = 0; #define make_def(enumname, somedata) \ #...
2011/04/24
[ "https://Stackoverflow.com/questions/5772136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/593704/" ]
It is impossible to create new types (classes, enums, unions, whatever) at runtime in C++. One of the major features of C++ is that it is statically typed - all types must be known at compile time.
Your macro is incorrect, since you cannot use a macro to create another macro, unfortunately, as the toke # has special meaning in the expansion-list: it can either quote a macro argument, or expand another macro. One easy (albeit poorly designed) way you could do this is just to use old c-style `#define MY_ENUM_NAME v...
5,772,136
I want to simplify things, by not creating a list of enum separately, but create the enums along the function call which creates the data where i point with those enums. I tried to make #define which would create another #define, but it didnt work: ``` int defcounter = 0; #define make_def(enumname, somedata) \ #...
2011/04/24
[ "https://Stackoverflow.com/questions/5772136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/593704/" ]
It is impossible to create new types (classes, enums, unions, whatever) at runtime in C++. One of the major features of C++ is that it is statically typed - all types must be known at compile time.
Preprocessor commands (`#define`, `#if`, `#pragma`, `#include`, ...) cannot appear in macros / defines. The problem is, that the CPP (C-Preprocessor) seperates commands by newlines, while C and C++ are unaware of newlines. In C/C++ you can write everything on one line, for preprocessor commands, you can't. ``` #define...
5,772,136
I want to simplify things, by not creating a list of enum separately, but create the enums along the function call which creates the data where i point with those enums. I tried to make #define which would create another #define, but it didnt work: ``` int defcounter = 0; #define make_def(enumname, somedata) \ #...
2011/04/24
[ "https://Stackoverflow.com/questions/5772136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/593704/" ]
It is impossible to create new types (classes, enums, unions, whatever) at runtime in C++. One of the major features of C++ is that it is statically typed - all types must be known at compile time.
What exactly is your desired output? You need to explain what you think you might get as output from the C preprocessor. You have scope problems and an attempt to define a macro inside the replacement text of another macro. ### Scope The macro `make_def()` invokes an undefined function 'func\_call'. The `createstuff...
5,772,136
I want to simplify things, by not creating a list of enum separately, but create the enums along the function call which creates the data where i point with those enums. I tried to make #define which would create another #define, but it didnt work: ``` int defcounter = 0; #define make_def(enumname, somedata) \ #...
2011/04/24
[ "https://Stackoverflow.com/questions/5772136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/593704/" ]
Preprocessor commands (`#define`, `#if`, `#pragma`, `#include`, ...) cannot appear in macros / defines. The problem is, that the CPP (C-Preprocessor) seperates commands by newlines, while C and C++ are unaware of newlines. In C/C++ you can write everything on one line, for preprocessor commands, you can't. ``` #define...
Your macro is incorrect, since you cannot use a macro to create another macro, unfortunately, as the toke # has special meaning in the expansion-list: it can either quote a macro argument, or expand another macro. One easy (albeit poorly designed) way you could do this is just to use old c-style `#define MY_ENUM_NAME v...
5,772,136
I want to simplify things, by not creating a list of enum separately, but create the enums along the function call which creates the data where i point with those enums. I tried to make #define which would create another #define, but it didnt work: ``` int defcounter = 0; #define make_def(enumname, somedata) \ #...
2011/04/24
[ "https://Stackoverflow.com/questions/5772136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/593704/" ]
What exactly is your desired output? You need to explain what you think you might get as output from the C preprocessor. You have scope problems and an attempt to define a macro inside the replacement text of another macro. ### Scope The macro `make_def()` invokes an undefined function 'func\_call'. The `createstuff...
Your macro is incorrect, since you cannot use a macro to create another macro, unfortunately, as the toke # has special meaning in the expansion-list: it can either quote a macro argument, or expand another macro. One easy (albeit poorly designed) way you could do this is just to use old c-style `#define MY_ENUM_NAME v...
5,804,517
I wish to find out how to switch between tabs using intents. In my case I'm using the both tabs: ``` Resources res = getResources(); TabHost tabHost = getTabHost(); TabHost.TabSpec spec; // Capture tab spec = tabHost.newTabSpec("capture").setIndicator(null, res.getDrawable(R.drawable.ic_tab_capture)) .setConten...
2011/04/27
[ "https://Stackoverflow.com/questions/5804517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/482693/" ]
First calling firing ImageUpload.java only fires ImageUpload.class but surely tabhost will disappear. You need to fire your MainActivity-TabActivity where you added your two tabHost **1.ImageUpload** **2.CaptureActivity** which will maintain your TabLayout call intent like these --- ``` Intent i=new Intent(getAp...
In the parent activity class where the tabhost is created I implemented a method like the one below: ``` public void switchTab(int tab){ tabHost.setCurrentTab(tab); } ``` Inside of the tab that I would like to be able to switch internally to another tab I created the method below: ``` public void switchTabI...
6,030,671
I'm having a problem reconciling building a project for use within an application server and for use as a stand-alone application. To give an overall simplified context, say I have three Projects A, B, C. Project A depends on Project B which depends on Project C. Project C has a dependency X which is marked as provi...
2011/05/17
[ "https://Stackoverflow.com/questions/6030671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755678/" ]
This is an example of a loop with [loop-carried dependencies](http://cnx.org/content/m32782/latest/), and so can't be easily parallelized as written because the tasks (each iteration of the loop) aren't independent. Breaking the dependency can vary from a trivial modification to the completely impossible (eg, an itera...
Though your sample doesn't show any explicit openmp pragma's, I don't think it could work easily: you are doing an in-place operation with overlapping regions. If you split the loop in chunks, you'll have race conditions at the boundaries (because el[n] gets copied from el[n+1], which might already have been updated ...
7,952,644
I have this jquery button click function: ``` $("#NextButton_ButtonCtrl").live("click", function (event) { var i = 0; var success = 1; var n = $("input[type=File]").length; alert('number of files:' + n); $("input[type=File]").each(function () { success = 0; alert('for is here'...
2011/10/31
[ "https://Stackoverflow.com/questions/7952644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
try a lowercase file `$("input[type=file]").length` as oppose to File **Reference from sitepoint.com** <http://reference.sitepoint.com/css/attributeselector> > > Case Sensitivity The value specified in an attribute selector is case > sensitive if the attribute value in the markup language is case > sensitive. Th...
you cannot style certain attributes of a file input. It's a security risk the real experts tell me. If you really need to change the look and feel, turn the opacity down to 0 on your file input and and style a text input and button to sit behind
10,327,351
I need to extract the value from "condition" but the one that's under "current\_conditions". Here is the code I have right now. It extracts value from condition but from "forecast\_conditions". By the way i'm using SAXParser. ``` if (localName.equals("condition")) { String con = attributes.getValue("data"); in...
2012/04/26
[ "https://Stackoverflow.com/questions/10327351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1196129/" ]
Which parser do you use? If you use XmlPullParser (or any SAX style parser), you can set a flag when you encounter `current_conditions` START\_TAG and check whether this flag is set when you check for `condition`. Don't forget to reset the flag when you encounter `current_conditions` END\_TAG.
I'll second XmlPullParser - it's very easy to understand. Here is some code for you case (not tested) ``` public void parser(InputStream is) { XmlPullParserFactory factory; try { factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser xpp = factory....
3,576,988
I have a simple user control with the following content: ``` <Grid x:Name="LayoutRoot"> <Button x:Name="btnOpenGenericPage" Click="btnOpenGenericPage_Click" Content="Open"/> </Grid> ``` I understand how the click event handler is created and wired up -> on the InitializeComponent method of the .g.cs class the Sy...
2010/08/26
[ "https://Stackoverflow.com/questions/3576988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274770/" ]
There is no built-in support in Visual Studio for this type of operation (at least for managed languages). The .PDB and .EXE files are created at the same time and have no option for embedding. I'm not even sure the .EXE format supports embedding PDB symbols although I could be wrong on this point. The only course I ...
I'm pretty sure PDBs were always stand-alone files. VC++ used to have a switch that would cause it to emit (limited compared to PDB) symbol information to a "CodeView" .DBG file that by default was embedded in the EXE. However, that switch appears to no longer be supported in the newer (post 6.x ?) versions of the comp...
3,576,988
I have a simple user control with the following content: ``` <Grid x:Name="LayoutRoot"> <Button x:Name="btnOpenGenericPage" Click="btnOpenGenericPage_Click" Content="Open"/> </Grid> ``` I understand how the click event handler is created and wired up -> on the InitializeComponent method of the .g.cs class the Sy...
2010/08/26
[ "https://Stackoverflow.com/questions/3576988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274770/" ]
i don't know, yet, how to do it - but there's article on MSDN that talks about it. A portable executable (i.e `.exe` or `.dll`) can have a [flag present in the header](http://msdn.microsoft.com/en-us/library/windows/desktop/ms680313.aspx): *([archive](https://archive.li/73vkx))* > > > ``` > IMAGE_FILE_DEBUG_STRIPPE...
There is no built-in support in Visual Studio for this type of operation (at least for managed languages). The .PDB and .EXE files are created at the same time and have no option for embedding. I'm not even sure the .EXE format supports embedding PDB symbols although I could be wrong on this point. The only course I ...
3,576,988
I have a simple user control with the following content: ``` <Grid x:Name="LayoutRoot"> <Button x:Name="btnOpenGenericPage" Click="btnOpenGenericPage_Click" Content="Open"/> </Grid> ``` I understand how the click event handler is created and wired up -> on the InitializeComponent method of the .g.cs class the Sy...
2010/08/26
[ "https://Stackoverflow.com/questions/3576988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274770/" ]
The [MSDN](http://msdn.microsoft.com/en-us/library/xe4t6fc1.aspx) says that it isn't possible. > > It is not possible to create an .exe or .dll that contains debug information. Debug information is always placed in a .pdb file. > > >
There is no built-in support in Visual Studio for this type of operation (at least for managed languages). The .PDB and .EXE files are created at the same time and have no option for embedding. I'm not even sure the .EXE format supports embedding PDB symbols although I could be wrong on this point. The only course I ...
3,576,988
I have a simple user control with the following content: ``` <Grid x:Name="LayoutRoot"> <Button x:Name="btnOpenGenericPage" Click="btnOpenGenericPage_Click" Content="Open"/> </Grid> ``` I understand how the click event handler is created and wired up -> on the InitializeComponent method of the .g.cs class the Sy...
2010/08/26
[ "https://Stackoverflow.com/questions/3576988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274770/" ]
I know this is a pretty old issue but this feature has recently been merged into Roslyn: <https://github.com/dotnet/roslyn/issues/12390>
There is no built-in support in Visual Studio for this type of operation (at least for managed languages). The .PDB and .EXE files are created at the same time and have no option for embedding. I'm not even sure the .EXE format supports embedding PDB symbols although I could be wrong on this point. The only course I ...
3,576,988
I have a simple user control with the following content: ``` <Grid x:Name="LayoutRoot"> <Button x:Name="btnOpenGenericPage" Click="btnOpenGenericPage_Click" Content="Open"/> </Grid> ``` I understand how the click event handler is created and wired up -> on the InitializeComponent method of the .g.cs class the Sy...
2010/08/26
[ "https://Stackoverflow.com/questions/3576988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274770/" ]
i don't know, yet, how to do it - but there's article on MSDN that talks about it. A portable executable (i.e `.exe` or `.dll`) can have a [flag present in the header](http://msdn.microsoft.com/en-us/library/windows/desktop/ms680313.aspx): *([archive](https://archive.li/73vkx))* > > > ``` > IMAGE_FILE_DEBUG_STRIPPE...
I'm pretty sure PDBs were always stand-alone files. VC++ used to have a switch that would cause it to emit (limited compared to PDB) symbol information to a "CodeView" .DBG file that by default was embedded in the EXE. However, that switch appears to no longer be supported in the newer (post 6.x ?) versions of the comp...
3,576,988
I have a simple user control with the following content: ``` <Grid x:Name="LayoutRoot"> <Button x:Name="btnOpenGenericPage" Click="btnOpenGenericPage_Click" Content="Open"/> </Grid> ``` I understand how the click event handler is created and wired up -> on the InitializeComponent method of the .g.cs class the Sy...
2010/08/26
[ "https://Stackoverflow.com/questions/3576988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274770/" ]
The [MSDN](http://msdn.microsoft.com/en-us/library/xe4t6fc1.aspx) says that it isn't possible. > > It is not possible to create an .exe or .dll that contains debug information. Debug information is always placed in a .pdb file. > > >
I'm pretty sure PDBs were always stand-alone files. VC++ used to have a switch that would cause it to emit (limited compared to PDB) symbol information to a "CodeView" .DBG file that by default was embedded in the EXE. However, that switch appears to no longer be supported in the newer (post 6.x ?) versions of the comp...
3,576,988
I have a simple user control with the following content: ``` <Grid x:Name="LayoutRoot"> <Button x:Name="btnOpenGenericPage" Click="btnOpenGenericPage_Click" Content="Open"/> </Grid> ``` I understand how the click event handler is created and wired up -> on the InitializeComponent method of the .g.cs class the Sy...
2010/08/26
[ "https://Stackoverflow.com/questions/3576988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274770/" ]
I know this is a pretty old issue but this feature has recently been merged into Roslyn: <https://github.com/dotnet/roslyn/issues/12390>
I'm pretty sure PDBs were always stand-alone files. VC++ used to have a switch that would cause it to emit (limited compared to PDB) symbol information to a "CodeView" .DBG file that by default was embedded in the EXE. However, that switch appears to no longer be supported in the newer (post 6.x ?) versions of the comp...
50,651,526
I am using new way of seeding data in Entity Framework 2.1: ``` modelBuilder.Entity<Blog>().HasData(new Blog {BlogId = 1, CreateDate = DateTime.Now}); ``` However, applying this to the database throws an exception `Conversion failed when converting date and/or time from character string`. I can see that in the gener...
2018/06/01
[ "https://Stackoverflow.com/questions/50651526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184509/" ]
I believe you might be looking for "PathPrefix" ``` func routes() { // init router r := mux.NewRouter() r.PathPrefix("/").Handler(http.FileServer(http.Dir("./public/views/"))) } ```
Remove all calls to path.Dir(). This call returns the directory part of the path. The code serves index.html because ServeFile looks for index.html when given a directory.
10,181,176
I've encountered a strange permission denial in my Android app, here is my manifest file: ``` <?xml version="1.0" encoding="utf-8"?> <manifest package="test.mymax" android:versionCode="1" android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-sdk android:minSdkVersion=...
2012/04/16
[ "https://Stackoverflow.com/questions/10181176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1337210/" ]
You declared your Test\_mymaxActivity twice. Once here ``` <activity android:name=".Test_mymaxActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> ...
Can you post the Intent/Code you are using that is requesting the permission? Or is this immediately on launching your activity?
10,181,176
I've encountered a strange permission denial in my Android app, here is my manifest file: ``` <?xml version="1.0" encoding="utf-8"?> <manifest package="test.mymax" android:versionCode="1" android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-sdk android:minSdkVersion=...
2012/04/16
[ "https://Stackoverflow.com/questions/10181176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1337210/" ]
You declared your Test\_mymaxActivity twice. Once here ``` <activity android:name=".Test_mymaxActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> ...
Are you sure you declared all the permission needed for your code (**using internet, detect phone state, etc**) Here's the documentation : [Manifest permission - Android dev](http://developer.android.com/guide/topics/security/security.html)
1,550,835
Let $X\_1,\ldots,X\_{20}$ be independent Poisson random variables with mean 1. Use central limit theorem to approximate the following equation. Use Markov's Inequality to obtain a bound: $$\Pr\left[\sum\_1^{20}X\_i>15\right]$$ Since the mean is $1$, the distribution would be $\dfrac{1}{k!e}$. Markov's Inequality stat...
2015/11/29
[ "https://math.stackexchange.com/questions/1550835", "https://math.stackexchange.com", "https://math.stackexchange.com/users/218786/" ]
The sum of the $20$ random variables has expected value $20$ since the expected value of each is $1$. Have you heard that the sum of independent Poisson-distributed random variables also has a Poisson distribution? Or that for the Poisson distribution, the expected value is the same as the variance? So $$ Z = \frac{\t...
The "central limit theorem approximation" would replace a sum of $20$ iid Poisson variables with mean $1$ with a normal variable which have the appropriate mean and variance. Since the variance of a Poisson variable with mean $\lambda$ is also $\lambda$ and variances add for independent variables, the mean should be $2...
46,374,923
I was trying to print all paths(root-to-leaf paths) of binary tree but of no avail. My strategy is to use the recursion, having the base case as `either tree is None or tree node is leaf return` Otherwise, traverse through left and right of the tree. But I can't find a way to retain both of left and right tree. `...
2017/09/23
[ "https://Stackoverflow.com/questions/46374923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7687062/" ]
The idea is building the path (list) at each node visit, if current node is a leaf, add current to path and print it, if no, just add current to extend the path: ``` def pathSum(self, path): if not self.left and not self.right: print(path + [self.val]) return self.left.pathSum(path + [self.va...
Through some iterations, I found the following solution works. But I'm not sure if there's a more efficient way of finding all leaf-root paths. The idea behind this solution is pre-order traversal ``` def allPaths(self, root, path, all_path): if not root.left and not root.right: path.append(root.val) ...
4,090
Say, I have two crystal structures of a particular organic molecule, the crystal structures are basically identical, apart from a rotation and redefinition of the lattice vectors/angles, a simple result of different choices during the structure refinement process after the xray or neutron experiment for structure deter...
2021/01/08
[ "https://materials.stackexchange.com/questions/4090", "https://materials.stackexchange.com", "https://materials.stackexchange.com/users/1878/" ]
If you know which atoms correspond to each other in the two structures, you can use a *structural superposition* method. Least-squares superposition methods find the rotation matrix and translation that minimizes the RMSD between given points. There are a few well-established methods. Recently, I had to use one and I ...
It seems to me that there is a discrepancy about the c-axis in the 2 unit cells, producing a significant difference in the unit cell volume (213.1 and 210.8, respectively). If you apply the transformation matrix [-b,-a,c] to the first unit cell 5.156 5.341 8.407 71.48 76.12 85.09 and compare with the second one you ob...
4,090
Say, I have two crystal structures of a particular organic molecule, the crystal structures are basically identical, apart from a rotation and redefinition of the lattice vectors/angles, a simple result of different choices during the structure refinement process after the xray or neutron experiment for structure deter...
2021/01/08
[ "https://materials.stackexchange.com/questions/4090", "https://materials.stackexchange.com", "https://materials.stackexchange.com/users/1878/" ]
If you're familiar with Python, this can be done using [pymatgen](https://pymatgen.org) fairly easily. To illustrate, let's first define our problem: ```py from pymatgen.core.lattice import Lattice from pymatgen.core.structure import Structure malnac_lattice = Lattice.from_parameters(5.33, 5.14, 11.25, 102.7, 135.17...
It seems to me that there is a discrepancy about the c-axis in the 2 unit cells, producing a significant difference in the unit cell volume (213.1 and 210.8, respectively). If you apply the transformation matrix [-b,-a,c] to the first unit cell 5.156 5.341 8.407 71.48 76.12 85.09 and compare with the second one you ob...
28,305,666
I have a Meteor template with multiple conditions, and I get a flicker of some of the conditional views when it loads initially. I'm using iron router and I'm aware of the subscriptions, wait() and ready() options, however one of the problems is that the main conditional `isInstalled` depends on a meteor.call callback...
2015/02/03
[ "https://Stackoverflow.com/questions/28305666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2694165/" ]
The WaveShaper node does not enable generic transfer functions, per se - but you can use it to do that. To answer your question - x is the offset into the array, with a little preprocessing. The curve you give to the waveshaper is like a lookup table for x - spread across the range [-1,1]. Y does not need to be in [-1...
The WaveShaperNode is described as applying a non-linear distortion. As such it would not have a classical linear time-invariant transfer function (which strictly only applies to linear distortions).
53,670,831
I have a listbox called lstTickets and a combobox called cboFilter. I am trying to filter the items in my listbox based on the ticket.District that is in the combobox. So for example if I select from the combox, is the only team in the listbox. Any help is appreciated. ``` List<Ticket> = new List<Ticket>() { ...
2018/12/07
[ "https://Stackoverflow.com/questions/53670831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try now: You need to use this keyword with setState() ``` import React, { Component } from 'react'; class App extends Component { constructor() { super(); this.state = { resData: [], } } componentDidMount() { fetch(`http://someurl.com/something`) .then(function (response) { return response.json() })...
The alert is running before the setState is finishing, try running the alert as a callback to setState: ``` componentDidMount() { fetch(`http://someurl.com/something`) .then(response => response.json()) .then(result => this.setState({ resData: result.data }), () => { alert(this.state...
53,670,831
I have a listbox called lstTickets and a combobox called cboFilter. I am trying to filter the items in my listbox based on the ticket.District that is in the combobox. So for example if I select from the combox, is the only team in the listbox. Any help is appreciated. ``` List<Ticket> = new List<Ticket>() { ...
2018/12/07
[ "https://Stackoverflow.com/questions/53670831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try now: You need to use this keyword with setState() ``` import React, { Component } from 'react'; class App extends Component { constructor() { super(); this.state = { resData: [], } } componentDidMount() { fetch(`http://someurl.com/something`) .then(function (response) { return response.json() })...
try this it might help ``` import React, { Component } from 'react'; class App extends Component { constructor() { super(); this.state = { resData: [], } } componentDidMount() { var that = thi...
35,612,062
Every other article I see has something to with JOINS... I'm not even trying to do a join! I'm just trying to run a simple UPDATE based off information in a temporary table. Here's the code... ``` BEGIN TRAN ArchiveMigration -- insert into temporary table CREATE TABLE #tblTemp( [theID] [int] NOT NULL, [Schedu...
2016/02/24
[ "https://Stackoverflow.com/questions/35612062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4929529/" ]
Your current `UPDATE` syntax is incorrect, you will need to use a `JOIN` on your temporary table. This [article](http://blog.sqlauthority.com/2013/04/30/sql-server-update-from-select-statement-using-join-in-update-statement-multiple-tables-in-update-statement/) from Pinal Dave provides a more detailed explanation. ```...
You update statment is totally wrong,the where clause is not correct,you have multiple choices here to resolve your problem: 1. make join with tmptable 2. use Exists key in your where clause 3. Or simply,if your purpose of creating tmptable is just to nullify,why not using cursor?or change your where statment to searc...
3,737,709
Let $\mathcal{E}\subset \Omega$ and let $\rho(\mathcal{E})$ and $\sigma(\mathcal{E})$ be respectively the ring and $\sigma$-algebra on $\Omega$ generated by $\mathcal{E}$. The book am reading asks under what conditions on $\mathcal{E}$ do we have $\rho(\mathcal{E})=\sigma(\mathcal{E})$. If $\mathcal{E}$ is finite and ...
2020/06/28
[ "https://math.stackexchange.com/questions/3737709", "https://math.stackexchange.com", "https://math.stackexchange.com/users/522332/" ]
**Proposition.** In general, $\rho(\varepsilon)=\sigma(\varepsilon)$ if and only if $ \Omega$ is a finite union of elements from $\varepsilon$ and $\rho(\varepsilon)$ is closed under countable unions. **Proof.** Suppose $\rho(\varepsilon)=\sigma(\varepsilon)$. Then $\Omega \in \rho(\varepsilon)$. I will use a more exp...
The $ring$ generated by **$\varepsilon$**, along with all the compliments of the sets belonging to it (w.r.t to the underlying set) will be equal to the $algebra$ generated by **$\varepsilon$**. The algebra along with all the countable unions of the sets belonging to it will be the $\sigma-algebra$ generated by **$\var...
108,408
I have the following code: ``` s[x_Real, y_Real, z_Real, w_Real] = {{x + I y, - z + I w}, { z + I w, x - I y}}; ssamp = Compile[{{n, _Integer}, {nd, _Integer}}, MapThread[s, Transpose[Map[ Normalize, RandomVariate[NormalDistribution[0, 1], {n, nd, 4}],{2}], {3, 2, 1}] , 2]] ``` The `compile` fails with error messa...
2016/02/26
[ "https://mathematica.stackexchange.com/questions/108408", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/24959/" ]
You can replace `MapThread[func,list,2]` with `func/@Transpose[Flatten/@list]`. ``` s[{x_Real,y_Real,z_Real,w_Real}]:={{x+I y,-z+I w},{z+I w,x-I y}}; ssamp = Compile[{{n, _Integer}, {nd, _Integer}}, s /@ Transpose[ Flatten /@ Transpose[ Map[Normalize, RandomVariate[NormalDistribution[0, 1...
The following seems to work (at least on v9): ``` s[{x_Real, y_Real, z_Real, w_Real}] := {{x + I y, -z + I w}, {z + I w, x - I y}} ssamp = Compile[{{n, _Integer}, {nd, _Integer}}, Module[{u1}, u1 = Transpose[ Map[Normalize, RandomVariate[NormalDistribution[0, 1], {n, nd, 4}], {2}], {3, 2, 1}];...
108,408
I have the following code: ``` s[x_Real, y_Real, z_Real, w_Real] = {{x + I y, - z + I w}, { z + I w, x - I y}}; ssamp = Compile[{{n, _Integer}, {nd, _Integer}}, MapThread[s, Transpose[Map[ Normalize, RandomVariate[NormalDistribution[0, 1], {n, nd, 4}],{2}], {3, 2, 1}] , 2]] ``` The `compile` fails with error messa...
2016/02/26
[ "https://mathematica.stackexchange.com/questions/108408", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/24959/" ]
Here's a fully compiled version, principles applied in modifying the code has been mentioned in the links above: ``` ssamp2 = Compile[{{n, _Integer}, {nd, _Integer}}, Partition[Function[xyzw, {{xyzw[[1]] + I xyzw[[2]], -xyzw[[3]] + I xyzw[[4]]}, {xyzw[[3]] ...
You can replace `MapThread[func,list,2]` with `func/@Transpose[Flatten/@list]`. ``` s[{x_Real,y_Real,z_Real,w_Real}]:={{x+I y,-z+I w},{z+I w,x-I y}}; ssamp = Compile[{{n, _Integer}, {nd, _Integer}}, s /@ Transpose[ Flatten /@ Transpose[ Map[Normalize, RandomVariate[NormalDistribution[0, 1...
108,408
I have the following code: ``` s[x_Real, y_Real, z_Real, w_Real] = {{x + I y, - z + I w}, { z + I w, x - I y}}; ssamp = Compile[{{n, _Integer}, {nd, _Integer}}, MapThread[s, Transpose[Map[ Normalize, RandomVariate[NormalDistribution[0, 1], {n, nd, 4}],{2}], {3, 2, 1}] , 2]] ``` The `compile` fails with error messa...
2016/02/26
[ "https://mathematica.stackexchange.com/questions/108408", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/24959/" ]
Here's a fully compiled version, principles applied in modifying the code has been mentioned in the links above: ``` ssamp2 = Compile[{{n, _Integer}, {nd, _Integer}}, Partition[Function[xyzw, {{xyzw[[1]] + I xyzw[[2]], -xyzw[[3]] + I xyzw[[4]]}, {xyzw[[3]] ...
The following seems to work (at least on v9): ``` s[{x_Real, y_Real, z_Real, w_Real}] := {{x + I y, -z + I w}, {z + I w, x - I y}} ssamp = Compile[{{n, _Integer}, {nd, _Integer}}, Module[{u1}, u1 = Transpose[ Map[Normalize, RandomVariate[NormalDistribution[0, 1], {n, nd, 4}], {2}], {3, 2, 1}];...
13,127,663
I understand that next query throws an exception since `IQueryable<>` provider doesn't support `Enumerable.TakeWhile` extension method. ``` IQueryable<Contact> search = context.Contacts.TakeWhile(q => q.ContactID > 10); foreach(var q in search); // exception ``` But it gets confusing if I try to und...
2012/10/29
[ "https://Stackoverflow.com/questions/13127663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/204018/" ]
If it your desire to have both usernames hyperlinked to your GitHub account, then you should know that GitHub disambiguates users on the user.email configuration setting. So update in both repositories accordingly, and they will be subsequently hyperlinked. Source: <https://help.github.com/articles/setting-your-email-i...
Try `git config --global user.name "ladariha"`
1,890,695
I have a VB6 application that still references some old VB5 libraries (dll, vbr, tlb, and ocx). We're having some strange issues like it can't read the registry using advapi32.dll. I've tried running the application with UAC permissions, but still no go. We can't recompile the app because it has several controls and co...
2009/12/11
[ "https://Stackoverflow.com/questions/1890695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21318/" ]
VB 5.0 is not supported on Windows 7, although VB 6.0 is, so I'm guessing that's your problem. The solution to this is to run a windows xp virtual machine, and windows 7 has a pretty painless process for doing this using xp mode. Check out, <http://www.microsoft.com/windows/virtual-pc/download.aspx>
This may be a silly question, but have you tried running it in compatibility mode?
1,890,695
I have a VB6 application that still references some old VB5 libraries (dll, vbr, tlb, and ocx). We're having some strange issues like it can't read the registry using advapi32.dll. I've tried running the application with UAC permissions, but still no go. We can't recompile the app because it has several controls and co...
2009/12/11
[ "https://Stackoverflow.com/questions/1890695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21318/" ]
VB 5.0 is not supported on Windows 7, although VB 6.0 is, so I'm guessing that's your problem. The solution to this is to run a windows xp virtual machine, and windows 7 has a pretty painless process for doing this using xp mode. Check out, <http://www.microsoft.com/windows/virtual-pc/download.aspx>
You could try using a windows XP virtual machine...assuming it doesn't need to run directly on the host.
1,890,695
I have a VB6 application that still references some old VB5 libraries (dll, vbr, tlb, and ocx). We're having some strange issues like it can't read the registry using advapi32.dll. I've tried running the application with UAC permissions, but still no go. We can't recompile the app because it has several controls and co...
2009/12/11
[ "https://Stackoverflow.com/questions/1890695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21318/" ]
VB 5.0 is not supported on Windows 7, although VB 6.0 is, so I'm guessing that's your problem. The solution to this is to run a windows xp virtual machine, and windows 7 has a pretty painless process for doing this using xp mode. Check out, <http://www.microsoft.com/windows/virtual-pc/download.aspx>
An alternative to the XP Virtual Machine which has some advantages is [Parallels](http://www.parallels.com/uk/products/desktop/pd4wl/). It's cheap, robust and offers a neat transparency mode such that the program running in the VM appears to be running as native on the desktop. I've been using Parallels on my Windows 7...
215,869
It is clear to me that the intersection of a finite collection of open sets is open, also that a countable intersection of a collection of open sets is not always open. But What can be said of a countable intersection of semi-closed intervals, e.g. $ \bigcap\_{n=1}^{\infty}(-1/n, 1]$ Thanks in advance.
2012/10/17
[ "https://math.stackexchange.com/questions/215869", "https://math.stackexchange.com", "https://math.stackexchange.com/users/45038/" ]
The intersection of a countably infinite collection of half-open intervals of the same type may be empty, a half-open interval of that type, or a closed interval, which may be degenerate (a singleton) or not. Examples: $$\begin{align\*} &\bigcap\_{n\in\Bbb Z^+}\left(0,\frac1n\right]=\varnothing\\ &\bigcap\_{n\in\Bbb Z...
It must be an interval, because any intersection of convex sets is convex. By taking finite intersections we can assume without loss of generality that the intersection is decreasing, that is, $I\_{n+1} \subset I\_n$ for each $n$. The intersection $I$ can be a closed interval as in your example, where $I = [0,1]$, or i...
215,869
It is clear to me that the intersection of a finite collection of open sets is open, also that a countable intersection of a collection of open sets is not always open. But What can be said of a countable intersection of semi-closed intervals, e.g. $ \bigcap\_{n=1}^{\infty}(-1/n, 1]$ Thanks in advance.
2012/10/17
[ "https://math.stackexchange.com/questions/215869", "https://math.stackexchange.com", "https://math.stackexchange.com/users/45038/" ]
The intersection of a countably infinite collection of half-open intervals of the same type may be empty, a half-open interval of that type, or a closed interval, which may be degenerate (a singleton) or not. Examples: $$\begin{align\*} &\bigcap\_{n\in\Bbb Z^+}\left(0,\frac1n\right]=\varnothing\\ &\bigcap\_{n\in\Bbb Z...
In a general topological space, the notion of a *semi-closed* set is normally not defined and if it were, it probably wouldn't be very useful. The reason we have this notion for $\mathbb{R}$ is just the coincidental fact that the boundary of a connected set of $\mathbb{R}$ consists of at most 2 points. Regarding your ...
10,022,195
The SO community was right, profiling your code before you ask performance questions seems to make more sense then my approach of randomly guessing :-) I profiled my code(very intensive math) and didn't realize over 70% of my code is apparently in a part I didn't think was a source of slowdown, rounding of decimals. `...
2012/04/05
[ "https://Stackoverflow.com/questions/10022195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/640558/" ]
The standard way to round (positive) numbers would be something like this: ``` double rounded = floor(1000 * doubleVal + 0.5) / 1000; ``` Example 1: `floor(1000 * .1234 + 0.5) / 1000` = `floor(123.9)/1000` = `0.123` Example 2: `floor(1000 * .5678 + 0.5) / 1000` = `floor(568.3)/1000` = `0.568` But as @nuakh comme...
Using a cast is faster than using floor or round. I suspect a cast is more heavily optimised by the HotSpot compiler. ``` public class Main { public static final int ITERS = 1000 * 1000; public static void main(String... args) { for (int i = 0; i < 3; i++) { perfRoundTo3(); per...