qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
Can use [Char.IsDigit](http://msdn.microsoft.com/en-us/library/0t641e58.aspx) ``` Char.IsDigit(str[0]) ```
``` string str = "2001"; if (char.IsDigit(str.First()) { if(Convert.toInt32(str.First().ToString()) >= 0) { // positive integer } } ```
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
You can try with this: ``` string s = "1sdfa"; bool isDigit = char.IsDigit(s[0]); ``` Also, if you wanted additional checks on string, you could do them like this: ``` bool isDigit = !string.IsNullOrEmpty(s) && char.IsDigit(s[0]); ```
``` string str = "2001"; if (char.IsDigit(str.First()) { if(Convert.toInt32(str.First().ToString()) >= 0) { // positive integer } } ```
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
You can try with this: ``` string s = "1sdfa"; bool isDigit = char.IsDigit(s[0]); ``` Also, if you wanted additional checks on string, you could do them like this: ``` bool isDigit = !string.IsNullOrEmpty(s) && char.IsDigit(s[0]); ```
hello u can use this... ``` string something = "some string"; bool isDigit = char.IsDigit(something[0]); ```
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
You can try with this: ``` string s = "1sdfa"; bool isDigit = char.IsDigit(s[0]); ``` Also, if you wanted additional checks on string, you could do them like this: ``` bool isDigit = !string.IsNullOrEmpty(s) && char.IsDigit(s[0]); ```
Can use [Char.IsDigit](http://msdn.microsoft.com/en-us/library/0t641e58.aspx) ``` Char.IsDigit(str[0]) ```
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
You can use [char.IsDigit](http://msdn.microsoft.com/en-us/library/7y5kahff.aspx) method to check if the first character is a digit or not. ``` if(char.IsDigit(str[0])) Console.WriteLine("Starting character is positive digit"); else Console.WriteLine("Starting character is not a digit"); ``` Its better if y...
hello u can use this... ``` string something = "some string"; bool isDigit = char.IsDigit(something[0]); ```
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
You can try with this: ``` string s = "1sdfa"; bool isDigit = char.IsDigit(s[0]); ``` Also, if you wanted additional checks on string, you could do them like this: ``` bool isDigit = !string.IsNullOrEmpty(s) && char.IsDigit(s[0]); ```
I believe if no sign then it is positive? So just check whether the first sybmol is not `"-"`. EDIT: As Mark noted in a comment below - it may depend on a culture which is used.
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
I believe if no sign then it is positive? So just check whether the first sybmol is not `"-"`. EDIT: As Mark noted in a comment below - it may depend on a culture which is used.
``` string str = "2001"; if (char.IsDigit(str.First()) { if(Convert.toInt32(str.First().ToString()) >= 0) { // positive integer } } ```
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
Can use [Char.IsDigit](http://msdn.microsoft.com/en-us/library/0t641e58.aspx) ``` Char.IsDigit(str[0]) ```
hello u can use this... ``` string something = "some string"; bool isDigit = char.IsDigit(something[0]); ```
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
You can use [char.IsDigit](http://msdn.microsoft.com/en-us/library/7y5kahff.aspx) method to check if the first character is a digit or not. ``` if(char.IsDigit(str[0])) Console.WriteLine("Starting character is positive digit"); else Console.WriteLine("Starting character is not a digit"); ``` Its better if y...
``` string str = "2001"; if (char.IsDigit(str.First()) { if(Convert.toInt32(str.First().ToString()) >= 0) { // positive integer } } ```
14,769,973
I need to check if the first element of a string is positive integer in C#. is there a smart Way to do this? Fx ``` string str = "2001"; if (str.First() == isANumber) { ... } ```
2013/02/08
[ "https://Stackoverflow.com/questions/14769973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1424585/" ]
I believe if no sign then it is positive? So just check whether the first sybmol is not `"-"`. EDIT: As Mark noted in a comment below - it may depend on a culture which is used.
``` if(Char.IsDigit(str.First())) { } ```
15,684,343
We have an asp.net application that logs errors and warnings to xml files using log4net. We have tried quite a few log4net viewers but didn't find any decent ones. The latest one we have tried is log4net dashboard which is pretty good but doesn't do exactly what we need. Our logs are saved in C:\MyApp\Logs[year][mon...
2013/03/28
[ "https://Stackoverflow.com/questions/15684343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1576573/" ]
I see a post on their blog for this issue and how to work around it while a new build is dropped. <http://blog.reflectsoftware.com/2013/04/17/directorynotfoundexception/> I can confirm that creating this directory manually resolves the exception that is thrown.
I've used l4ndash in the past and it is a good tool. Have you tried changing this in the web.config? This should load all files in that folder. ``` <datasource name="XML Text file" Description="XML Text file (output from FilAppender or RollingFileAppender)"> <provider type="L4NDashXmlTextFileProvider.XmlT...
604,281
What is the best plain javascript way of inserting X rows into a table in IE. The table html looks like this: ``` <table><tbody id='tb'><tr><td>1</td><td>2</td></tr></tbody></table> ``` What I need to do, is drop the old body, and insert a new one with 1000 rows. I have my 1000 rows as a javascript string variable....
2009/03/02
[ "https://Stackoverflow.com/questions/604281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26188/" ]
Here's a great article by the guy who implemented IE's `innerHTML=` on [how he got IE to do `tbody.innerHTML="<tr>..."`](http://www.ericvasilik.com/2006/07/code-karma.html): > > At first, I thought that IE was not > capable of performing the redraw for > modified tables with innerHTML, but > then I remembered that...
Do as jQuery does it, eg. add `<table>` and `</table>` around it, insert into document and move the nodes you want to where you want them and ditch the temp-element.
604,281
What is the best plain javascript way of inserting X rows into a table in IE. The table html looks like this: ``` <table><tbody id='tb'><tr><td>1</td><td>2</td></tr></tbody></table> ``` What I need to do, is drop the old body, and insert a new one with 1000 rows. I have my 1000 rows as a javascript string variable....
2009/03/02
[ "https://Stackoverflow.com/questions/604281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26188/" ]
Here's a great article by the guy who implemented IE's `innerHTML=` on [how he got IE to do `tbody.innerHTML="<tr>..."`](http://www.ericvasilik.com/2006/07/code-karma.html): > > At first, I thought that IE was not > capable of performing the redraw for > modified tables with innerHTML, but > then I remembered that...
the code ended up being this: ``` if($.support.scriptEval){ //browser needs to support evaluating scripts as they are inserted into document var temp = document.createElement('div'); temp.innerHTML = "<table><tbody id='"+bodyId +"'>"+html; var tb = $body[0]; tb.parentNode.replaceChild(temp...
604,281
What is the best plain javascript way of inserting X rows into a table in IE. The table html looks like this: ``` <table><tbody id='tb'><tr><td>1</td><td>2</td></tr></tbody></table> ``` What I need to do, is drop the old body, and insert a new one with 1000 rows. I have my 1000 rows as a javascript string variable....
2009/03/02
[ "https://Stackoverflow.com/questions/604281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26188/" ]
Here's a great article by the guy who implemented IE's `innerHTML=` on [how he got IE to do `tbody.innerHTML="<tr>..."`](http://www.ericvasilik.com/2006/07/code-karma.html): > > At first, I thought that IE was not > capable of performing the redraw for > modified tables with innerHTML, but > then I remembered that...
I had the same problem (as do lots of other people) and after a lot of playing around here's what I got to work. You have to make a tr via document.createelement ('tr') then make a td, the same way. appendchild the td to the tr, appendchild the tr to tbody (not table) THEN you can innerhtml the td you created and it w...
47,216,177
Each row of a data frame column is a list of dictionaries. I want to convert the list of dictionaries to a new data frame with each dictionary as a new cell in my data frame. The keys of the dictionaries as the columns. Each dictionary has 44 keys, so I have 44 columns. I need to do this for all the rows (lists) of th...
2017/11/10
[ "https://Stackoverflow.com/questions/47216177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3101706/" ]
change these lines ``` src: url(##websitename##.com/wp-content/themes/twentyseventeen-child/fonts/TrashHand.ttf); } ``` to ``` src: url(/wp-content/themes/twentyseventeen-child/fonts/TrashHand.ttf); } ``` No websitename is needed as the **src** is looking for an **absolute URL**
you should use .woff and .woff2 font format with .ttf ``` @font-face { font-family: 'TrashHand'; url('##websitename##.com/wp-content/themes/twentyseventeen-child/fonts/TrashHand.woff2') format('woff2'), url('##websitename##.com/wp-content/themes/twentyseventeen-child/fonts/TrashHand.woff') format...
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
The error in your `pom.xml` because you mess up different versions of Struts core and plugins. Change ``` <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.3.15.2</version> </dependency> ``` I don't know why do you need JTA 1.0.1B but you could change hi...
This repo worked for me: ``` <repository> <id>webpublico-repository</id> <name>Webpublico Nexus Repository</name> <url>http://repository.webpublico.com.br/repository/maven-public/</url> </repository> ```
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
In my case i tried example from mkyong [jsf-2.0 spring hibernate integration example](http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/) When i got the exception i searched alot i was using spring sts suit tool , and eclipse MARS with JDK 8 the **solution was** I changed pom to **1.1** instead...
some approach from [Unable to resolve javax.transaction dependency](https://groups.google.com/forum/#!topic/play-framework/QtEcVoMb0Po) clear the .ivy/cache folder. it works, **but takes very long time**.
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
In my case i tried example from mkyong [jsf-2.0 spring hibernate integration example](http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/) When i got the exception i searched alot i was using spring sts suit tool , and eclipse MARS with JDK 8 the **solution was** I changed pom to **1.1** instead...
This repo worked for me: ``` <repository> <id>webpublico-repository</id> <name>Webpublico Nexus Repository</name> <url>http://repository.webpublico.com.br/repository/maven-public/</url> </repository> ```
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
In my case i tried example from mkyong [jsf-2.0 spring hibernate integration example](http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/) When i got the exception i searched alot i was using spring sts suit tool , and eclipse MARS with JDK 8 the **solution was** I changed pom to **1.1** instead...
The error in your `pom.xml` because you mess up different versions of Struts core and plugins. Change ``` <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.3.15.2</version> </dependency> ``` I don't know why do you need JTA 1.0.1B but you could change hi...
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
This repo worked for me: ``` <repository> <id>webpublico-repository</id> <name>Webpublico Nexus Repository</name> <url>http://repository.webpublico.com.br/repository/maven-public/</url> </repository> ```
some approach from [Unable to resolve javax.transaction dependency](https://groups.google.com/forum/#!topic/play-framework/QtEcVoMb0Po) clear the .ivy/cache folder. it works, **but takes very long time**.
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
The error in your `pom.xml` because you mess up different versions of Struts core and plugins. Change ``` <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.3.15.2</version> </dependency> ``` I don't know why do you need JTA 1.0.1B but you could change hi...
At the moment, it may be unnecessary. But I think we should update this ticket for someone. It works for me. Change porm.xml ``` <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.5.16</version> </dependency> <dependency> <groupId>org.hibernate</groupId...
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
In my case i tried example from mkyong [jsf-2.0 spring hibernate integration example](http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/) When i got the exception i searched alot i was using spring sts suit tool , and eclipse MARS with JDK 8 the **solution was** I changed pom to **1.1** instead...
Which repository are you using? Add the [java.net](http://download.java.net/maven/2/) Maven repository as below. ``` <repository> <id>java.net</id> <url>http://download.java.net/maven/2/</url> </repository> ```
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
In my case i tried example from mkyong [jsf-2.0 spring hibernate integration example](http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/) When i got the exception i searched alot i was using spring sts suit tool , and eclipse MARS with JDK 8 the **solution was** I changed pom to **1.1** instead...
At the moment, it may be unnecessary. But I think we should update this ticket for someone. It works for me. Change porm.xml ``` <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.5.16</version> </dependency> <dependency> <groupId>org.hibernate</groupId...
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
The error in your `pom.xml` because you mess up different versions of Struts core and plugins. Change ``` <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.3.15.2</version> </dependency> ``` I don't know why do you need JTA 1.0.1B but you could change hi...
Which repository are you using? Add the [java.net](http://download.java.net/maven/2/) Maven repository as below. ``` <repository> <id>java.net</id> <url>http://download.java.net/maven/2/</url> </repository> ```
19,086,540
i want to increase my integer. but i don't know to fix it Even i am using this code, my picture more brightness with int +10 from before. ``` try { ImageView image = (ImageView) findViewById(R.id.imgView); Bitmap bMap = mPhoto; int a=0; image.setImageBitmap(SetBrightness...
2013/09/30
[ "https://Stackoverflow.com/questions/19086540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2625325/" ]
Which repository are you using? Add the [java.net](http://download.java.net/maven/2/) Maven repository as below. ``` <repository> <id>java.net</id> <url>http://download.java.net/maven/2/</url> </repository> ```
At the moment, it may be unnecessary. But I think we should update this ticket for someone. It works for me. Change porm.xml ``` <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.5.16</version> </dependency> <dependency> <groupId>org.hibernate</groupId...
24,891
I use this code to Load and Insert data to a table using a `DataGridView` in a C# windows application. ``` SqlCommand sCommand; SqlDataAdapter sAdapter; SqlCommandBuilder sBuilder; DataSet sDs; DataTable sTable; private void form1_Load(object sender, EventArgs e) ...
2013/04/09
[ "https://codereview.stackexchange.com/questions/24891", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/23944/" ]
It looks like your code should work and output rows if your database contains records corresponding to your condition. Since we are on a code review site I would like to highlight several code issues not related to your question: * You should dispose all objects implementing `IDisposable` interface. In your code thes...
You have multiple problems in your code, to name a few: * you don't close the connection nor dispose any of the `problematic` objects (SqlConnection, SqlCommand and SqlDataAdapter). Yes, I see you're using them later in the code, but trust me, it's a BAD idea * as almaz already pointed out, you don't need `DataSet` in...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
### Approach and complexity It is a pleasure to tell you this: Excellent! Your approach is precisely what I had in mind when I read the challenge description (before looking at your code). ### Unit tests Excellent that you have unit tests! Definitely helps in checking if it's possible to clean up your method. My on...
I had a bit of a longer answer in the works, but Simon's answer covers almost every point I intended to cover. The one thing I can add is this: ### Variable's scope should be as limited as possible. ### Variable's scope should be no wider than necessary. We don't use `start` or `sum` outside of the `for` loop, so l...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
### Approach and complexity It is a pleasure to tell you this: Excellent! Your approach is precisely what I had in mind when I read the challenge description (before looking at your code). ### Unit tests Excellent that you have unit tests! Definitely helps in checking if it's possible to clean up your method. My on...
One suggestion for your method signature, you can consider using varargs on the integer sequence, so that you leave the implicit `int[]` declaration to the compiler/JVM: ``` public static boolean findSum(int targetSum, int... array) { ... } ``` To add on to [Simon's point of parameterized testing](https://codere...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
### Approach and complexity It is a pleasure to tell you this: Excellent! Your approach is precisely what I had in mind when I read the challenge description (before looking at your code). ### Unit tests Excellent that you have unit tests! Definitely helps in checking if it's possible to clean up your method. My on...
The unnecessary part (as explained in [Simon's answer](https://codereview.stackexchange.com/a/86340/70002)) also has a flaw: ``` if (array[i] > k) { i += 2; start = i; sum = 0; continue; } ``` Here, `i += 2;` not only ignores the current element as intended, but also skips the...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
### Approach and complexity It is a pleasure to tell you this: Excellent! Your approach is precisely what I had in mind when I read the challenge description (before looking at your code). ### Unit tests Excellent that you have unit tests! Definitely helps in checking if it's possible to clean up your method. My on...
Here is another possible solution, however it seems logically equivalent to Simon's answer. ``` public static boolean findSum(int[] array, int k) { int a = 0, b = 0, sum = 0; while(b < array.length) { if(sum < k) sum += array[b++]; else if(sum > k) sum -= array[a++]; else return true; } return sum...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
I had a bit of a longer answer in the works, but Simon's answer covers almost every point I intended to cover. The one thing I can add is this: ### Variable's scope should be as limited as possible. ### Variable's scope should be no wider than necessary. We don't use `start` or `sum` outside of the `for` loop, so l...
One suggestion for your method signature, you can consider using varargs on the integer sequence, so that you leave the implicit `int[]` declaration to the compiler/JVM: ``` public static boolean findSum(int targetSum, int... array) { ... } ``` To add on to [Simon's point of parameterized testing](https://codere...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
I had a bit of a longer answer in the works, but Simon's answer covers almost every point I intended to cover. The one thing I can add is this: ### Variable's scope should be as limited as possible. ### Variable's scope should be no wider than necessary. We don't use `start` or `sum` outside of the `for` loop, so l...
The unnecessary part (as explained in [Simon's answer](https://codereview.stackexchange.com/a/86340/70002)) also has a flaw: ``` if (array[i] > k) { i += 2; start = i; sum = 0; continue; } ``` Here, `i += 2;` not only ignores the current element as intended, but also skips the...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
I had a bit of a longer answer in the works, but Simon's answer covers almost every point I intended to cover. The one thing I can add is this: ### Variable's scope should be as limited as possible. ### Variable's scope should be no wider than necessary. We don't use `start` or `sum` outside of the `for` loop, so l...
Here is another possible solution, however it seems logically equivalent to Simon's answer. ``` public static boolean findSum(int[] array, int k) { int a = 0, b = 0, sum = 0; while(b < array.length) { if(sum < k) sum += array[b++]; else if(sum > k) sum -= array[a++]; else return true; } return sum...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
One suggestion for your method signature, you can consider using varargs on the integer sequence, so that you leave the implicit `int[]` declaration to the compiler/JVM: ``` public static boolean findSum(int targetSum, int... array) { ... } ``` To add on to [Simon's point of parameterized testing](https://codere...
Here is another possible solution, however it seems logically equivalent to Simon's answer. ``` public static boolean findSum(int[] array, int k) { int a = 0, b = 0, sum = 0; while(b < array.length) { if(sum < k) sum += array[b++]; else if(sum > k) sum -= array[a++]; else return true; } return sum...
86,335
I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler. ``` <!-- *********************************************** --> <div class="widget search-w"> <div class="wrapper"> <div class="big-icon search icontap"><a class=...
2015/04/08
[ "https://codereview.stackexchange.com/questions/86335", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/69929/" ]
The unnecessary part (as explained in [Simon's answer](https://codereview.stackexchange.com/a/86340/70002)) also has a flaw: ``` if (array[i] > k) { i += 2; start = i; sum = 0; continue; } ``` Here, `i += 2;` not only ignores the current element as intended, but also skips the...
Here is another possible solution, however it seems logically equivalent to Simon's answer. ``` public static boolean findSum(int[] array, int k) { int a = 0, b = 0, sum = 0; while(b < array.length) { if(sum < k) sum += array[b++]; else if(sum > k) sum -= array[a++]; else return true; } return sum...
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
To allow access to the Sites directory, you have to add the following to `/etc/apache2/httpd.conf`: ``` <DirectoryMatch "/Users/.*/Sites"> Require all granted </DirectoryMatch> ``` The default Apache configuration is set to *denied* on /, so you have to explicitly allow access to everything.
It happens that the update moved all your previous configuration to the files .conf~previous. If you move /etc/apache2/extra/httpd-userdir.conf~previous to /etc/apache2/extra/httpd-userdir.conf, and /etc/apache2/extra/httpd.conf~previous to /etc/apache2/extra/httpd.conf, it should work like before. ``` mv /etc/apache2...
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
After trying all the above methods, if you still get "forbidden" when accessing localhost, try adding virtualhost in your /etc/apache2/extra/httpd-vhosts.conf Add: ``` <VirtualHost *:80> ServerName localhost DocumentRoot /Library/WebServer/Documents/ </VirtualHost> ``` then restart apache. <https://coolestguideson...
Possible solution (after failing with all the above suggestions). The issue is with the permission of the home directory. It should be executable for group/others: sudo chmod go+x /Users/username where "username" is to be replaced with the actual username. After this, it works!
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
I was on the same situation, apparently there are a few more lines to uncomment in httpd.conf, vhosts are not activated on High Sierra. - <https://apple.stackexchange.com/a/299929/259065>
Spent the whole morning to figure it out, but finally it worked. Hope this can be useful for somebody. I followed a guide, but with a slight change. * This is the guide: <https://websitebeaver.com/set-up-localhost-on-macos-high-sierra-apache-mysql-and-php-7-with-sslhttps> (thank you David Marcus!) * This is my tweak ...
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
This worked for me when I ran into the same problem. Please check "/private/etc/apache2/extra/httpd-userdir.conf" file. change ``` #Include /private/etc/apache2/users/*.conf ``` to ``` Include /private/etc/apache2/users/*.conf ``` and restart apache. From: <https://stackoverflow.com/questions/39631351/apache-l...
I just had this same issue, and wanted to do exactly what you wanted (keep the root at /Library/WebServer/Documents, but also allow user Sites folders). I'm not sure if this will be helpful, but after banging at this for hours tonight, looking line by line thru all of the .conf files, and wondering what was wrong, I re...
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
Just to expand on to Diogo Lima's answer. With the upgrade to High Sierra, Apple made copies of your previous apache settings and appended a ~previous to the \*.conf files both in the /etc/apache2 and the /etc/apache2/extra folders. If you are using virtual hosts or ssl-virtual hosts then you will need to also move yo...
I just had this same issue, and wanted to do exactly what you wanted (keep the root at /Library/WebServer/Documents, but also allow user Sites folders). I'm not sure if this will be helpful, but after banging at this for hours tonight, looking line by line thru all of the .conf files, and wondering what was wrong, I re...
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
Possible solution (after failing with all the above suggestions). The issue is with the permission of the home directory. It should be executable for group/others: sudo chmod go+x /Users/username where "username" is to be replaced with the actual username. After this, it works!
I just upgraded and had exactly the same issues. I don't use vhosts. Solution for me was ensuring: In `https.conf` uncomment ``` LoadModule userdir_module libexec/apache2/mod_userdir.so LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule authz_user_module libexec/apache2/mod_authz_user.so Loa...
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
Just updated this morning. Using Sites folder in /Users/username. Backed up and replaced httpd.conf,httpd-userdir.conf and https-vhosts.conf w/ the ~previous variants. Ran `sudo apachectl configtest` and got the PHP error (PHP updated to 7 in High Sierra). Edited http.conf to start PHP7 and now everything is workin...
Spent the whole morning to figure it out, but finally it worked. Hope this can be useful for somebody. I followed a guide, but with a slight change. * This is the guide: <https://websitebeaver.com/set-up-localhost-on-macos-high-sierra-apache-mysql-and-php-7-with-sslhttps> (thank you David Marcus!) * This is my tweak ...
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
Just to expand on to Diogo Lima's answer. With the upgrade to High Sierra, Apple made copies of your previous apache settings and appended a ~previous to the \*.conf files both in the /etc/apache2 and the /etc/apache2/extra folders. If you are using virtual hosts or ssl-virtual hosts then you will need to also move yo...
Possible solution (after failing with all the above suggestions). The issue is with the permission of the home directory. It should be executable for group/others: sudo chmod go+x /Users/username where "username" is to be replaced with the actual username. After this, it works!
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
Just to expand on to Diogo Lima's answer. With the upgrade to High Sierra, Apple made copies of your previous apache settings and appended a ~previous to the \*.conf files both in the /etc/apache2 and the /etc/apache2/extra folders. If you are using virtual hosts or ssl-virtual hosts then you will need to also move yo...
I just upgraded and had exactly the same issues. I don't use vhosts. Solution for me was ensuring: In `https.conf` uncomment ``` LoadModule userdir_module libexec/apache2/mod_userdir.so LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule authz_user_module libexec/apache2/mod_authz_user.so Loa...
300,081
I have followed this guide to set-up Apache on High Sierra: <https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/> I used it to set it up on Sierra. But when I go to `http://localhost/~scott/` I get "Forbidden. You don't have permission to access /~scott/ on this server." ...
2017/09/27
[ "https://apple.stackexchange.com/questions/300081", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/257380/" ]
Possible solution (after failing with all the above suggestions). The issue is with the permission of the home directory. It should be executable for group/others: sudo chmod go+x /Users/username where "username" is to be replaced with the actual username. After this, it works!
I have had the same issue. The resolution was easy. See answer posted here: <https://apple.stackexchange.com/a/306390/129503> > > I faced the same after I upgraded to High Sierra earlier today. I > found that the following apache files were replaced with brand new > versions. Fortunately for all of these files ther...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
You should implement `INotifyPropertyChanged` in your "MainWindow" so your "myTextBlock" can automatically pick up changes from your data and update. So your "MainWindow" should look like: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(...
You need to make the property tell the binding that it has updated. The standard way to do this is via: 1. Implementing [`INotifyPropertyChanged`](http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx) 2. Making the myText property a [`DependencyProperty`](http://msdn.microsoft.com/...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
Your current `myText` property has no way of notifying the WPF binding system when its value has changed, so the `TextBlock` wont be updated. If you make it a dependency property instead it automatically implements change notification, and the changes to the property will be reflected in the `TextBlock`. So if you re...
You should implement `INotifyPropertyChanged` in your "MainWindow" so your "myTextBlock" can automatically pick up changes from your data and update. So your "MainWindow" should look like: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
Try this: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(); this.DataContext = this; } public string myText { get; set; } public void Button_Click_1(object sender, RoutedEventArgs e)...
You should implement `INotifyPropertyChanged` in your "MainWindow" so your "myTextBlock" can automatically pick up changes from your data and update. So your "MainWindow" should look like: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
implement `INotifyPropertyChanged`: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { this.InitializeComponent(); } private string _txt; public string txt { get { return _...
You should implement `INotifyPropertyChanged` in your "MainWindow" so your "myTextBlock" can automatically pick up changes from your data and update. So your "MainWindow" should look like: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
Your current `myText` property has no way of notifying the WPF binding system when its value has changed, so the `TextBlock` wont be updated. If you make it a dependency property instead it automatically implements change notification, and the changes to the property will be reflected in the `TextBlock`. So if you re...
You need to make the property tell the binding that it has updated. The standard way to do this is via: 1. Implementing [`INotifyPropertyChanged`](http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx) 2. Making the myText property a [`DependencyProperty`](http://msdn.microsoft.com/...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
Try this: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(); this.DataContext = this; } public string myText { get; set; } public void Button_Click_1(object sender, RoutedEventArgs e)...
You need to make the property tell the binding that it has updated. The standard way to do this is via: 1. Implementing [`INotifyPropertyChanged`](http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx) 2. Making the myText property a [`DependencyProperty`](http://msdn.microsoft.com/...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
implement `INotifyPropertyChanged`: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { this.InitializeComponent(); } private string _txt; public string txt { get { return _...
You need to make the property tell the binding that it has updated. The standard way to do this is via: 1. Implementing [`INotifyPropertyChanged`](http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx) 2. Making the myText property a [`DependencyProperty`](http://msdn.microsoft.com/...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
Your current `myText` property has no way of notifying the WPF binding system when its value has changed, so the `TextBlock` wont be updated. If you make it a dependency property instead it automatically implements change notification, and the changes to the property will be reflected in the `TextBlock`. So if you re...
Try this: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(); this.DataContext = this; } public string myText { get; set; } public void Button_Click_1(object sender, RoutedEventArgs e)...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
Your current `myText` property has no way of notifying the WPF binding system when its value has changed, so the `TextBlock` wont be updated. If you make it a dependency property instead it automatically implements change notification, and the changes to the property will be reflected in the `TextBlock`. So if you re...
implement `INotifyPropertyChanged`: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { this.InitializeComponent(); } private string _txt; public string txt { get { return _...
13,325,617
I want a textbox to display the value of a variable when I click it (an iteration of 1 to 100), I do not know what I am doing Wrong: When I run the project nothing is displayed in the text box. What is the best way to display variables in a text box? ``` using System; using System.Collections.Generic; using System....
2012/11/10
[ "https://Stackoverflow.com/questions/13325617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387856/" ]
implement `INotifyPropertyChanged`: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { this.InitializeComponent(); } private string _txt; public string txt { get { return _...
Try this: ``` public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(); this.DataContext = this; } public string myText { get; set; } public void Button_Click_1(object sender, RoutedEventArgs e)...
45,063,396
I'm trying to update tensorflow. ``` pip install --upgrade tensorflow-gpu ``` It first checks for the packages and creates the following error ``` Installing collected packages: markdown, werkzeug, numpy, tensorflow-gpu, setuptools Found existing installation: Markdown 2.2.0 Uninstalling Markdown-2.2.0: Permiss...
2017/07/12
[ "https://Stackoverflow.com/questions/45063396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4870005/" ]
If you choose to install Anaconda for All Users you will need to escalate privileges on the Command Prompt. Right click CMD and choose "Run As Admin". If you do not want to do this every time you will need to set the permissions on the entire Anaconda directory for you user to Full Access.
Run the cmd in administrative mode and type pip install --upgrade tensorflow-gpu --user This worked for me
1,425,209
I have used mathematical induction in a lot of excercices but I still feel like I am missing something important and that I am only manipulating formulas. Maybe there's also a language issue because English isn't my first language. If I read[1] "if the statement holds for some $n \in \mathbb{N}$" does this mean that I...
2015/09/07
[ "https://math.stackexchange.com/questions/1425209", "https://math.stackexchange.com", "https://math.stackexchange.com/users/190908/" ]
Perhaps it is enlightening to consider induction as a two step proof, consisting of two proofs. Reversing the usual order, we prove 1) the so called "inductive hypothesis"; 2) the base case. 1) is just the proof of "For all $n$, if $p(n)$ is true, then $p(n+1)$ is true." 2) is the proof of "$p(m)$ is true" for some ...
The induction hypothesis DOES suppose the statement is true for some $n \in \mathbb{N}$. However this does not assume what you are trying to prove because you will prove that the statement $P$ is true for some "base case". The proof method is: 1) Base case: Prove P(0) (say) holds. That is $P$ holds for $n=0$ 2) In...
16,427,300
I having the following error message: > > Cannot open database "SmallBakery" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\MyAppPool' > > > How can correct this? I am using windows 7 Enterprise Edition and Sql server 2012.
2013/05/07
[ "https://Stackoverflow.com/questions/16427300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2359764/" ]
It depends on how you want to authenticate in your app. Are you trying to use impersonation in your app? What's happening right now is the identity of your app pool in IIS is getting passed when trying to access the database. You can change the identity of your app pool to be something that has access to the database ...
Check this post out. Your problem sounds similar to one I was running into, with the same exact error message. <http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-2-instance-ownership.aspx>
16,427,300
I having the following error message: > > Cannot open database "SmallBakery" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\MyAppPool' > > > How can correct this? I am using windows 7 Enterprise Edition and Sql server 2012.
2013/05/07
[ "https://Stackoverflow.com/questions/16427300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2359764/" ]
If you don't change, each app pool has it's own identity. In your case, just add a new user to your database `SmallBakery` with the name `IIS APPPOOL\MyAppPool` using SQL Management Studio. You find the users list in the "Security/Users" subnode of your database. This should look something like that: ![enter image des...
It depends on how you want to authenticate in your app. Are you trying to use impersonation in your app? What's happening right now is the identity of your app pool in IIS is getting passed when trying to access the database. You can change the identity of your app pool to be something that has access to the database ...
16,427,300
I having the following error message: > > Cannot open database "SmallBakery" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\MyAppPool' > > > How can correct this? I am using windows 7 Enterprise Edition and Sql server 2012.
2013/05/07
[ "https://Stackoverflow.com/questions/16427300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2359764/" ]
It depends on how you want to authenticate in your app. Are you trying to use impersonation in your app? What's happening right now is the identity of your app pool in IIS is getting passed when trying to access the database. You can change the identity of your app pool to be something that has access to the database ...
Like others said so far you need to take your app pool system user (IIS AppPool\myapppool) and add it as database user for that database with appropriate permissions. Note that this will work just find on your IIS/Server but if you plan on migrating application to a different IIS/Sql server it will require changes in...
16,427,300
I having the following error message: > > Cannot open database "SmallBakery" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\MyAppPool' > > > How can correct this? I am using windows 7 Enterprise Edition and Sql server 2012.
2013/05/07
[ "https://Stackoverflow.com/questions/16427300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2359764/" ]
It depends on how you want to authenticate in your app. Are you trying to use impersonation in your app? What's happening right now is the identity of your app pool in IIS is getting passed when trying to access the database. You can change the identity of your app pool to be something that has access to the database ...
In my case these steps lead me to successfully handle this error.Hope it will help you also [![enter image description here](https://i.stack.imgur.com/ccdKx.png)](https://i.stack.imgur.com/ccdKx.png)
16,427,300
I having the following error message: > > Cannot open database "SmallBakery" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\MyAppPool' > > > How can correct this? I am using windows 7 Enterprise Edition and Sql server 2012.
2013/05/07
[ "https://Stackoverflow.com/questions/16427300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2359764/" ]
If you don't change, each app pool has it's own identity. In your case, just add a new user to your database `SmallBakery` with the name `IIS APPPOOL\MyAppPool` using SQL Management Studio. You find the users list in the "Security/Users" subnode of your database. This should look something like that: ![enter image des...
Check this post out. Your problem sounds similar to one I was running into, with the same exact error message. <http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-2-instance-ownership.aspx>
16,427,300
I having the following error message: > > Cannot open database "SmallBakery" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\MyAppPool' > > > How can correct this? I am using windows 7 Enterprise Edition and Sql server 2012.
2013/05/07
[ "https://Stackoverflow.com/questions/16427300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2359764/" ]
If you don't change, each app pool has it's own identity. In your case, just add a new user to your database `SmallBakery` with the name `IIS APPPOOL\MyAppPool` using SQL Management Studio. You find the users list in the "Security/Users" subnode of your database. This should look something like that: ![enter image des...
Like others said so far you need to take your app pool system user (IIS AppPool\myapppool) and add it as database user for that database with appropriate permissions. Note that this will work just find on your IIS/Server but if you plan on migrating application to a different IIS/Sql server it will require changes in...
16,427,300
I having the following error message: > > Cannot open database "SmallBakery" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\MyAppPool' > > > How can correct this? I am using windows 7 Enterprise Edition and Sql server 2012.
2013/05/07
[ "https://Stackoverflow.com/questions/16427300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2359764/" ]
If you don't change, each app pool has it's own identity. In your case, just add a new user to your database `SmallBakery` with the name `IIS APPPOOL\MyAppPool` using SQL Management Studio. You find the users list in the "Security/Users" subnode of your database. This should look something like that: ![enter image des...
In my case these steps lead me to successfully handle this error.Hope it will help you also [![enter image description here](https://i.stack.imgur.com/ccdKx.png)](https://i.stack.imgur.com/ccdKx.png)
560,946
What does it mean when we say that the monochromatic wave is un-polarized? Is this kind of wave actually possible? What would the equation of such a wave look like? Since we can consider also that there are no ideal monochromatic waves. How are these un-polarized waves generated? > > Ex=│()│cos(− + (t)) > > > Ey= │...
2020/06/22
[ "https://physics.stackexchange.com/questions/560946", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/260600/" ]
* Monochromatic means that the light possesses a single wavenumber $k = 2\pi/\lambda$. * The polarisation vector $\vec \epsilon$ describes in which direction the electric field $\vec E(z,t)$ oscillates. Unpolarised means that the polarisation changes **randomly**. Hence, an unpolarised, monochromatic wave propagating ...
Light from a single atom is polarized. The electric field for unpolarized light is given by a sum of the radiation from many uncorrelated individual atoms, so no particular polarization direction can be defined.
560,946
What does it mean when we say that the monochromatic wave is un-polarized? Is this kind of wave actually possible? What would the equation of such a wave look like? Since we can consider also that there are no ideal monochromatic waves. How are these un-polarized waves generated? > > Ex=│()│cos(− + (t)) > > > Ey= │...
2020/06/22
[ "https://physics.stackexchange.com/questions/560946", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/260600/" ]
* Monochromatic means that the light possesses a single wavenumber $k = 2\pi/\lambda$. * The polarisation vector $\vec \epsilon$ describes in which direction the electric field $\vec E(z,t)$ oscillates. Unpolarised means that the polarisation changes **randomly**. Hence, an unpolarised, monochromatic wave propagating ...
A sodium lamp is an example of a (very nearly) monochromatic unpolarized light source. Such light, and incoherent waves in general, must be described with a density matrix.
7,757,658
I suppose this is a more specific version of my recent question [Browser-sniffing alternative for bugs/misbehaviors (NOT lack of features)](https://stackoverflow.com/questions/7718673/browser-sniffing-alternative-for-bugs-misbehaviors-not-lack-of-features). CKEditor is known not to work on certain clients like iOS Sa...
2011/10/13
[ "https://Stackoverflow.com/questions/7757658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/207364/" ]
Use [CKEditor.env.isCompatible](http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.env.html#.isCompatible) and that way you can know exactly if a browser version is supported or not (for example iOS 5 is supported in 3.6.2 as Clive has mentioned)
CKEditor has the [`instanceReady()`](http://cksource.com/forums/viewtopic.php?f=11&t=16787&start=0) event. That might help - if you can afford to wait for that to fire, and have a timeout of sorts in case it doesn't. There doesn't seem to be a `onerror` event in CKEditor. The list of main events is [here](http://cked...
30,987,697
I have a number of items that get their data from a Json object and populate it using angular. ``` <select ng-model="MyCtrl.cargoList"> <option ng-repeat="cargo in MyCtrl.cargoList">{{ cargo.name }}</option> </select> ``` And whenever I load the form, I get something like this in my console: ``` <select ng-mode...
2015/06/22
[ "https://Stackoverflow.com/questions/30987697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4941769/" ]
You need to select 1st option by default on `ng-init="MyCtrl.selectedCargo=MyCtrl.cargoList[0].name"` & `ng-model` name should not be same as that of your `cargoList`. **Markup** ``` <select ng-model="MyCtrl.selectedCargo" ng-init="MyCtrl.selectedCargo=MyCtrl.cargoList[0].name"> <option ng-repeat="cargo in MyCtrl...
Use ng-options instead of ng-repeat ``` <select ng-model="MyCtrl.selectedListItem" ng-options="cargo for cargo in MyCtrl.cargoList"></select> ``` You can fine tune the labels/values further if you like, check the documentation here - <https://docs.angularjs.org/api/ng/directive/ngOptions> You can ng-init, or set t...
30,987,697
I have a number of items that get their data from a Json object and populate it using angular. ``` <select ng-model="MyCtrl.cargoList"> <option ng-repeat="cargo in MyCtrl.cargoList">{{ cargo.name }}</option> </select> ``` And whenever I load the form, I get something like this in my console: ``` <select ng-mode...
2015/06/22
[ "https://Stackoverflow.com/questions/30987697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4941769/" ]
You need to select 1st option by default on `ng-init="MyCtrl.selectedCargo=MyCtrl.cargoList[0].name"` & `ng-model` name should not be same as that of your `cargoList`. **Markup** ``` <select ng-model="MyCtrl.selectedCargo" ng-init="MyCtrl.selectedCargo=MyCtrl.cargoList[0].name"> <option ng-repeat="cargo in MyCtrl...
Use [ngOption](https://docs.angularjs.org/api/ng/directive/ngOptions) `<option>` > > The `ngOptions` attribute can be used to dynamically generate a list of `<option>` elements for the `<select>` element using the array or object obtained by evaluating the `ngOptions` comprehension expression. > > > I have used f...
29,824,017
I have a script (that simulates a neuronal network in PyNEST) and I want to run several instances of it, changing only a few parameters each time. The simulation time is not a problem (about 5 secs length), but I want to run quite a few simulations. What I do now, is use 'sys' and 'sys.argv[:]' to pass my parameters a...
2015/04/23
[ "https://Stackoverflow.com/questions/29824017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3410400/" ]
Convert your script into a module with a main function, so that running ``` python myScript.py arg1 arg2 arg3 ``` from the command line is equivalent to running ``` import myScript myScript.main(arg1, arg2, arg3) ``` Once you've made `myScript` an importable module, then you can write another script to call `mySc...
If the work performed is significant enough to justify the overhead necessary for setting up several processes, you can create a pool of worker processes with the [multiprocessing module](https://docs.python.org/2/library/multiprocessing.html).
74,040
Is the following a correct past perfect sentence? > > I would have killed the snake if I had hit him hard with a stick. > > >
2012/07/10
[ "https://english.stackexchange.com/questions/74040", "https://english.stackexchange.com", "https://english.stackexchange.com/users/23330/" ]
It is a perfectly normal English construction and is an example of what foreign learners are sometimes taught as the Third Conditional. The speaker imagines something that didn't actually happen (in this case, he didn't hit the snake) and speculates what the consequence would have been if it had happened (he would have...
Yes, it is. It's the third conditional, where you talk about an action in the past that didn't take place. Aside from that, you are missing *the* or *a* in your sentence. > > I would have killed the snake if I had hit him hard with **the or a** stick. > > >
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
Here is a fairly simple method: ``` # replicate your data, shifting the days ahead by your required window, # and rbind into a single data frame d <- do.call(rbind,lapply(0:2, function(x) transform(data,date=date+x))) # use aggregate to add it together, subsetting out "future" days aggregate(items_bought~date+user,su...
The following looks valid: ``` unlist(lapply(split(data, data$user), function(x) { ave(x$items_bought, cumsum(c(0, diff(x$date)) >= 3), FUN = cumsum) })) #x1 x2 x3 x4 y1 y2 y3 y4 # 2 3 3 4 1 6 6 7 ``` Where `data`: ``` data = ...
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
Here's a `dplyr` solution which will produce the desired result (14 rows) as specified in the question. Note that it takes care of duplicate date entries, for example, 2013-01-04 for user x. ``` # define a custom function to be used in the dplyr chain myfunc <- function(x){ with(x, sapply(event_number, function(y) ...
I'd like to propose an additional `data.table` approach combined with `zoo` package `rollapplyr` function First, we will aggregate `items_bought` column per `user` per unique `date` (as you pointed out that there could be more than one unique date per user) ``` library(data.table) data <- setDT(data)[, lapply(.SD, su...
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
Here's a `dplyr` solution which will produce the desired result (14 rows) as specified in the question. Note that it takes care of duplicate date entries, for example, 2013-01-04 for user x. ``` # define a custom function to be used in the dplyr chain myfunc <- function(x){ with(x, sapply(event_number, function(y) ...
It seems like packages `xts` and `zoo` contain functions that do what you want, although you may have the same problems with the size of your actual dataset as with @alexis\_laz answer. Using the functions from the `xts` answer to [this question](https://stackoverflow.com/questions/10556450/rolling-window-over-irregula...
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
I'd like to propose an additional `data.table` approach combined with `zoo` package `rollapplyr` function First, we will aggregate `items_bought` column per `user` per unique `date` (as you pointed out that there could be more than one unique date per user) ``` library(data.table) data <- setDT(data)[, lapply(.SD, su...
The following looks valid: ``` unlist(lapply(split(data, data$user), function(x) { ave(x$items_bought, cumsum(c(0, diff(x$date)) >= 3), FUN = cumsum) })) #x1 x2 x3 x4 y1 y2 y3 y4 # 2 3 3 4 1 6 6 7 ``` Where `data`: ``` data = ...
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
Here's a `dplyr` solution which will produce the desired result (14 rows) as specified in the question. Note that it takes care of duplicate date entries, for example, 2013-01-04 for user x. ``` # define a custom function to be used in the dplyr chain myfunc <- function(x){ with(x, sapply(event_number, function(y) ...
Here is a fairly simple method: ``` # replicate your data, shifting the days ahead by your required window, # and rbind into a single data frame d <- do.call(rbind,lapply(0:2, function(x) transform(data,date=date+x))) # use aggregate to add it together, subsetting out "future" days aggregate(items_bought~date+user,su...
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
I'd like to propose an additional `data.table` approach combined with `zoo` package `rollapplyr` function First, we will aggregate `items_bought` column per `user` per unique `date` (as you pointed out that there could be more than one unique date per user) ``` library(data.table) data <- setDT(data)[, lapply(.SD, su...
It seems like packages `xts` and `zoo` contain functions that do what you want, although you may have the same problems with the size of your actual dataset as with @alexis\_laz answer. Using the functions from the `xts` answer to [this question](https://stackoverflow.com/questions/10556450/rolling-window-over-irregula...
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
Here is a fairly simple method: ``` # replicate your data, shifting the days ahead by your required window, # and rbind into a single data frame d <- do.call(rbind,lapply(0:2, function(x) transform(data,date=date+x))) # use aggregate to add it together, subsetting out "future" days aggregate(items_bought~date+user,su...
It seems like packages `xts` and `zoo` contain functions that do what you want, although you may have the same problems with the size of your actual dataset as with @alexis\_laz answer. Using the functions from the `xts` answer to [this question](https://stackoverflow.com/questions/10556450/rolling-window-over-irregula...
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
I'd like to propose an additional `data.table` approach combined with `zoo` package `rollapplyr` function First, we will aggregate `items_bought` column per `user` per unique `date` (as you pointed out that there could be more than one unique date per user) ``` library(data.table) data <- setDT(data)[, lapply(.SD, su...
Here is an approach that doesn't use cumsum but a nested `lapply` instead. The first one goes over the users and then for each user the second `lapply` constructs the desired data frame by summing all items bought from within the last 2 days of each date. Note that if `data$date` were not sorted, it would have to be so...
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
I'd like to propose an additional `data.table` approach combined with `zoo` package `rollapplyr` function First, we will aggregate `items_bought` column per `user` per unique `date` (as you pointed out that there could be more than one unique date per user) ``` library(data.table) data <- setDT(data)[, lapply(.SD, su...
I like James' answer better, but here's an alternative: ``` with(data,{ sapply(split(data,user),function(x){ sapply(x$date,function(y) sum(x$items_bought[x$date %in% c(y,y-1,y-2)])) }) }) ```
24,020,216
Using YUI and Pure-CSS, I've created a horizontal nav menu. One link ("Messenger") has to open a new window or tab (target = "\_blank") but the Javascript is ignoring that and opening the link in the current window. The HTML/CSS is: ``` <div id="demo-horizontal-menu"> <ul id="std-menu-items"> <li class="pure-menu...
2014/06/03
[ "https://Stackoverflow.com/questions/24020216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3703665/" ]
Here is a fairly simple method: ``` # replicate your data, shifting the days ahead by your required window, # and rbind into a single data frame d <- do.call(rbind,lapply(0:2, function(x) transform(data,date=date+x))) # use aggregate to add it together, subsetting out "future" days aggregate(items_bought~date+user,su...
I like James' answer better, but here's an alternative: ``` with(data,{ sapply(split(data,user),function(x){ sapply(x$date,function(y) sum(x$items_bought[x$date %in% c(y,y-1,y-2)])) }) }) ```
46,161,884
I want to stop my program when the user presses ctrl-C. The following answer suggests catching the `KeyboardInterrupt` exception. [python: how to terminate a thread when main program ends](https://stackoverflow.com/questions/2564137/python-how-to-terminate-a-thread-when-main-program-ends) Sometimes it works. But in t...
2017/09/11
[ "https://Stackoverflow.com/questions/46161884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5896591/" ]
There are actually two different issues with your code that gives this behavior. The first is that your threads should be made into `daemon` threads, so that they automatically stops when the main thread exits, the second is that your `try` block does not encapsulate the thread creation and start-up. When you create a...
You may want to read <https://stackoverflow.com/a/35430500/1656850>, namely: > > There are 3 exit functions, in addition to raising SystemExit. > > > The underlying one is os.\_exit, which requires 1 int argument, and > exits immediately with no cleanup. It's unlikely you'll ever want to > touch this one, but it ...
257,159
How to configure on Windows 2003 server such that:- 1. when I access my website on the server, it uses IP address A.A.A.A 2. when my program runs it uses IP address B.B.B.B Both A.A.A.A, B.B.B.B is configured on 2 different physical network interface on the server. The reason for this is, my program is physically co...
2011/04/08
[ "https://serverfault.com/questions/257159", "https://serverfault.com", "https://serverfault.com/users/77624/" ]
Bind the web site to the IP address of the appropriate NIC in the properties of the web site.
The easiest way is to simply have 2 URLs for the site in DNS, one that points to A.A.A.A and another that points to B.B.B.B and then bind them appropriately in IIS. Alternatively, you could also simply use <http://localhost> when accessing the site from the server itself and bind that to the proper IP.
3,709,321
I have a library project that contains some samples in a subfolder. The library itself has a `SConstruct` file and each sample has its own folder and its own `SConstruct` file. I'd like to add a target to the main (root) `SConstruct` file which would allow me to compile the library as usual, and all the samples, at o...
2010/09/14
[ "https://Stackoverflow.com/questions/3709321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
<http://www.scons.org/doc/production/HTML/scons-man.html> > > Creating a Hierarchical Build > > > Notice that the file names specified > in a subdirectory's SConscript file > are relative to that subdirectory. > > > SConstruct: > > > > ``` > env = Environment() > env.Program(target = 'foo', source = 'foo.c')...
For those like me coming to this question from Google, I found a more complete example of building a library and code that called it [here](https://github.com/dblalock/scons-example). (Apologies if this answering of an old question is frowned upon--a large number of searches for various combinations of "scons" "subdir...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
Remember that a differential is not the same as an incremental. For example, if you have a 100MB database, and make 5MB of changes, each differential backup will be at least 5MB. With Incremental, if you have a 100MB database and make 5MB of changes on Monday, and no changes on Tuesday, you'll have a 100MB full backup,...
Are you *entirely certain* that there is no activity on that database at all? Perhaps you could run profiler to see if there's anything happening that you aren't expecting, and also check maintenance plans or scheduled tasks for anything there that might be modifying data. That said... I realize I don't have a true an...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
**Something is changing your database!** Things like index rebuilds or defrags will cause page changes. Changes that are rolled back may have changed pages, so they count as well. In addition differential backups are considered 'fuzzy' and so will have transaction log data in the backup, which it needs for consist...
Remember that a differential is not the same as an incremental. For example, if you have a 100MB database, and make 5MB of changes, each differential backup will be at least 5MB. With Incremental, if you have a 100MB database and make 5MB of changes on Monday, and no changes on Tuesday, you'll have a 100MB full backup,...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
Remember that a differential is not the same as an incremental. For example, if you have a 100MB database, and make 5MB of changes, each differential backup will be at least 5MB. With Incremental, if you have a 100MB database and make 5MB of changes on Monday, and no changes on Tuesday, you'll have a 100MB full backup,...
A differential backup backs up 8K pages that have been "touched". If all your changes are small and in the same area, you'll have a small backup. Which is unlikely. A differential backup may not grow if you keep dirtying the same pages (also unlikely) Some things that will dirty a page: * Statistics are updated (st...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
Remember that a differential is not the same as an incremental. For example, if you have a 100MB database, and make 5MB of changes, each differential backup will be at least 5MB. With Incremental, if you have a 100MB database and make 5MB of changes on Monday, and no changes on Tuesday, you'll have a 100MB full backup,...
I am (basically a java developer) facing the same prob that my live db is 7.5 GB and its diff backups per day are 1.5 GB. (in fact we take diff backups for 1 hr) When i ran randy's script for the half day (i.e at lunch time which is half of a complete business day) I got following output: total change percentage 12565...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
**Something is changing your database!** Things like index rebuilds or defrags will cause page changes. Changes that are rolled back may have changed pages, so they count as well. In addition differential backups are considered 'fuzzy' and so will have transaction log data in the backup, which it needs for consist...
Are you *entirely certain* that there is no activity on that database at all? Perhaps you could run profiler to see if there's anything happening that you aren't expecting, and also check maintenance plans or scheduled tasks for anything there that might be modifying data. That said... I realize I don't have a true an...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
Are you *entirely certain* that there is no activity on that database at all? Perhaps you could run profiler to see if there's anything happening that you aren't expecting, and also check maintenance plans or scheduled tasks for anything there that might be modifying data. That said... I realize I don't have a true an...
I am (basically a java developer) facing the same prob that my live db is 7.5 GB and its diff backups per day are 1.5 GB. (in fact we take diff backups for 1 hr) When i ran randy's script for the half day (i.e at lunch time which is half of a complete business day) I got following output: total change percentage 12565...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
**Something is changing your database!** Things like index rebuilds or defrags will cause page changes. Changes that are rolled back may have changed pages, so they count as well. In addition differential backups are considered 'fuzzy' and so will have transaction log data in the backup, which it needs for consist...
A differential backup backs up 8K pages that have been "touched". If all your changes are small and in the same area, you'll have a small backup. Which is unlikely. A differential backup may not grow if you keep dirtying the same pages (also unlikely) Some things that will dirty a page: * Statistics are updated (st...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
**Something is changing your database!** Things like index rebuilds or defrags will cause page changes. Changes that are rolled back may have changed pages, so they count as well. In addition differential backups are considered 'fuzzy' and so will have transaction log data in the backup, which it needs for consist...
I am (basically a java developer) facing the same prob that my live db is 7.5 GB and its diff backups per day are 1.5 GB. (in fact we take diff backups for 1 hr) When i ran randy's script for the half day (i.e at lunch time which is half of a complete business day) I got following output: total change percentage 12565...
56,619
I am working on a Final Cut Server setup with an associate and one of the things we need to do is setup XSan2 with two Apple XServe RAID units. I am able to get into the RAID Administrator and configure arrays etc, however regardless of the configuration I set I am unable to have the LUNs presented to XSan in order to...
2009/08/20
[ "https://serverfault.com/questions/56619", "https://serverfault.com", "https://serverfault.com/users/1263/" ]
A differential backup backs up 8K pages that have been "touched". If all your changes are small and in the same area, you'll have a small backup. Which is unlikely. A differential backup may not grow if you keep dirtying the same pages (also unlikely) Some things that will dirty a page: * Statistics are updated (st...
I am (basically a java developer) facing the same prob that my live db is 7.5 GB and its diff backups per day are 1.5 GB. (in fact we take diff backups for 1 hr) When i ran randy's script for the half day (i.e at lunch time which is half of a complete business day) I got following output: total change percentage 12565...
71,268,932
I am trying to build out a custom scroll view that can take in different cells I have created and present those in the scroll view. I cannot figure out how to pass a generic SwiftUI view into the constructor of my custom scroll view struct, is it possible to do this? some like this: ``` struct CustomScroll<Content: Vi...
2022/02/25
[ "https://Stackoverflow.com/questions/71268932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10803309/" ]
I suppose you're looking for something like this: ``` struct CustomScroll<Content: View>: View { @ViewBuilder let content: () -> Content var body: some View { ScrollView { VStack(spacing: 10) { content() } } } } ``` and use it e.g. like this: ```...
You can créate a custom Cell for that! ``` struct CustomCellView: View { var object: Object = Object(nombre: "") init(m: Object) { object = m } var body: some View { VStack { HStack { Text(object.descripcion).font(.system(size: 11)).frame(width: 105, alignment: .trailing) } ...
3,012,538
My function is $z^{2} \hat z^{3}$ I don't know if this can be: Taking the radio circle 2 \begin{equation} \int z^{2} \hat z^{3} dx = \int \frac{64}{z} dx \end{equation} This because $z \hat z= |z|^2 = 4$ but this happens twice, so $z \hat z z \hat z= |z|^2 = 16$ y then there is a $\hat z$ without $z$ so $z \hat z = 4 ...
2018/11/25
[ "https://math.stackexchange.com/questions/3012538", "https://math.stackexchange.com", "https://math.stackexchange.com/users/478551/" ]
First, $z^2\bar z^3=(z\bar z)^2\bar z=|z|^4\bar z$ so using the unit circle $\gamma=e^{it}$ gives $$ \int\_{\gamma}|z|^4\bar z dz=\int\_0^{2\pi} e^{-it}ie^{it}dt=2\pi i$$
In your case the integrand is $$(\rho e^{i\theta})^2(\rho e^{-i\theta})^3de^{i\theta}=2^5e^{-i\theta}de^{i\theta}$$ giving the integral $$\left.32i\right|\_0^{2\pi}.$$
9,197,084
in C# I need to keep data in a dictionary object, looks like: ``` Dictionary<string, Dictionary<string, string>> MyDict = new Dictionary<string, Dictionary<string, string>>(); ``` Now I realised, that I would need in some cases some other (not dictionary-like) data as value of the main dict. Is there any kind ...
2012/02/08
[ "https://Stackoverflow.com/questions/9197084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/659017/" ]
By using object as the value in your dictionary you will incur some risk and complications: * Lack of type safety (anything can be set to the value) * You would have to cast to a particular type, probably based on the value You should probably rethink your design. But if you really want a the flexibility you could cr...
You can do that. After retrieving data from the main dictionary, you will have to cast the result to an appropriate type: ``` object obj; If(mainDict.TryGetValue("key", out obj)) { var dict = obj as Dictionary<string, string>>; if (dict != null) { // work with dict } else { var value = obj ...
9,197,084
in C# I need to keep data in a dictionary object, looks like: ``` Dictionary<string, Dictionary<string, string>> MyDict = new Dictionary<string, Dictionary<string, string>>(); ``` Now I realised, that I would need in some cases some other (not dictionary-like) data as value of the main dict. Is there any kind ...
2012/02/08
[ "https://Stackoverflow.com/questions/9197084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/659017/" ]
You'll loose strong types and all their benefits. Can you not create a new class that has a Dictionary property and add your other data to it: ``` public class CallItWhatYouLike { public Dictionary<string, string> Dictionary {get; set;} public int AnotherProperty {get; set;} ... } var MyDict = new Dictionary<s...
Well, your code will be less typesafe and you will need runtime type checks and type casts, but otherwise you can use `object` as a dictionary value type and store any types there.
9,197,084
in C# I need to keep data in a dictionary object, looks like: ``` Dictionary<string, Dictionary<string, string>> MyDict = new Dictionary<string, Dictionary<string, string>>(); ``` Now I realised, that I would need in some cases some other (not dictionary-like) data as value of the main dict. Is there any kind ...
2012/02/08
[ "https://Stackoverflow.com/questions/9197084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/659017/" ]
You can do that. After retrieving data from the main dictionary, you will have to cast the result to an appropriate type: ``` object obj; If(mainDict.TryGetValue("key", out obj)) { var dict = obj as Dictionary<string, string>>; if (dict != null) { // work with dict } else { var value = obj ...
No, there's no problem. If you need to type the value as `Dictionary<string, string>` just cast it and you'll have this solved.
9,197,084
in C# I need to keep data in a dictionary object, looks like: ``` Dictionary<string, Dictionary<string, string>> MyDict = new Dictionary<string, Dictionary<string, string>>(); ``` Now I realised, that I would need in some cases some other (not dictionary-like) data as value of the main dict. Is there any kind ...
2012/02/08
[ "https://Stackoverflow.com/questions/9197084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/659017/" ]
You can do that. After retrieving data from the main dictionary, you will have to cast the result to an appropriate type: ``` object obj; If(mainDict.TryGetValue("key", out obj)) { var dict = obj as Dictionary<string, string>>; if (dict != null) { // work with dict } else { var value = obj ...
Well, your code will be less typesafe and you will need runtime type checks and type casts, but otherwise you can use `object` as a dictionary value type and store any types there.
9,197,084
in C# I need to keep data in a dictionary object, looks like: ``` Dictionary<string, Dictionary<string, string>> MyDict = new Dictionary<string, Dictionary<string, string>>(); ``` Now I realised, that I would need in some cases some other (not dictionary-like) data as value of the main dict. Is there any kind ...
2012/02/08
[ "https://Stackoverflow.com/questions/9197084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/659017/" ]
By using object as the value in your dictionary you will incur some risk and complications: * Lack of type safety (anything can be set to the value) * You would have to cast to a particular type, probably based on the value You should probably rethink your design. But if you really want a the flexibility you could cr...
No, there's no problem. If you need to type the value as `Dictionary<string, string>` just cast it and you'll have this solved.