qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
Apple today released an Algorithms package available at: <https://github.com/apple/swift-algorithms> This package includes a `permutations` function that works like so: ```swift let string = "abc" string.permutations() /* ["a", "b", "c"] ["a", "c", "b"] ["b", "a", "c"] ["b", "c", "a"] ["c", "a", "b"] ["c", "b", "a"]...
You can use the functions of this framework to calculate permutations and combinations both with repetition and without repetition. You can investigate the source code and compare with your own. <https://github.com/amirrezaeghtedari/AECounting> This library calculates the results based on lexicographic order. For exa...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
Here is my solution. ``` import Foundation class Permutator { class func permutation(_ str: String) -> Set<String> { var set = Set<String>() permutation(str, prefix: "", set: &set) return set } private class func permutation(_ str: String, prefix: String, set: inout Set<Strin...
You can use the functions of this framework to calculate permutations and combinations both with repetition and without repetition. You can investigate the source code and compare with your own. <https://github.com/amirrezaeghtedari/AECounting> This library calculates the results based on lexicographic order. For exa...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
A very straightforward approach as also suggested in Swift coding challenges. ``` func permutation(string: String, current: String = "") { let length = string.characters.count let strArray = Array(string.characters) if (length == 0) { // there's nothing left to re-arrange; print t...
I was searching to solve the same problem, but I wanted a solution that worked with Generic data type, so I wrote one by looking at a scala code (<http://vkostyukov.ru/posts/combinatorial-algorithms-in-scala/>) <https://gist.github.com/psksvp/8fb5c6fbfd6a2207e95638db95f55ae1> ``` /** translate from Scala by psksvp...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
Here's an expression of Heap's (Sedgewick's?) algorithm in Swift. It is efficient because the array is passed by reference instead of being passed by value (though of course this means you must be prepared to have the array tampered with). Swapping is efficiently expressed through the use of the built-in `swapAt(_:_:)`...
Here is my solution. ``` import Foundation class Permutator { class func permutation(_ str: String) -> Set<String> { var set = Set<String>() permutation(str, prefix: "", set: &set) return set } private class func permutation(_ str: String, prefix: String, set: inout Set<Strin...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
A very straightforward approach as also suggested in Swift coding challenges. ``` func permutation(string: String, current: String = "") { let length = string.characters.count let strArray = Array(string.characters) if (length == 0) { // there's nothing left to re-arrange; print t...
For those looking to calculate all permutations of an array: ``` func permutations<T>(_ arr: [T]) -> [[T]] { if arr.count < 2 { return [arr] } var ret: [[T]] = [] let rest = Array(arr[1...]) for p in permutations(rest) { for i in 0...p.count { ret.append(Array(p[0..<i]) ...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
While Stefan and Matt make a good point about using Heap's algorithm, I think you have an important question about why *your* code doesn't work and how you would debug that. In this case, the algorithm is simply incorrect, and the best way to discover that is with pencil and paper IMO. What you are doing is picking ea...
**100% working tested** ``` func permute(strInput:String,l:Int,r:Int){ var inputCharacter = Array(strInput) if ( l==r){ print(strInput) }else{ for var i in l..<r{ // Swapping done inputCharacter.swapAt(l, i); // Recursion called ...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
Here is my solution. ``` import Foundation class Permutator { class func permutation(_ str: String) -> Set<String> { var set = Set<String>() permutation(str, prefix: "", set: &set) return set } private class func permutation(_ str: String, prefix: String, set: inout Set<Strin...
For those looking to calculate all permutations of an array: ``` func permutations<T>(_ arr: [T]) -> [[T]] { if arr.count < 2 { return [arr] } var ret: [[T]] = [] let rest = Array(arr[1...]) for p in permutations(rest) { for i in 0...p.count { ret.append(Array(p[0..<i]) ...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
**100% working tested** ``` func permute(strInput:String,l:Int,r:Int){ var inputCharacter = Array(strInput) if ( l==r){ print(strInput) }else{ for var i in l..<r{ // Swapping done inputCharacter.swapAt(l, i); // Recursion called ...
You can use the functions of this framework to calculate permutations and combinations both with repetition and without repetition. You can investigate the source code and compare with your own. <https://github.com/amirrezaeghtedari/AECounting> This library calculates the results based on lexicographic order. For exa...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
While Stefan and Matt make a good point about using Heap's algorithm, I think you have an important question about why *your* code doesn't work and how you would debug that. In this case, the algorithm is simply incorrect, and the best way to discover that is with pencil and paper IMO. What you are doing is picking ea...
``` func generate(n: Int, var a: [String]){ if n == 1 { print(a.joinWithSeparator("")) } else { for var i = 0; i < n - 1; i++ { generate(n - 1, a: a) if n % 2 == 0 { let temp = a[i] a[i] = a[n-1] a[n-1] = temp } ...
34,968,472
I am running the following tutorial: crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ I am getting the following error: [404 error](http://i.stack.imgur.com/RZXH9.png) I have confirmed my index.jsp is not in the WEB-INF folder: [project files](http://i.stack.imgur.com/vaxAJ.png) JSP is locate...
2016/01/23
[ "https://Stackoverflow.com/questions/34968472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403658/" ]
``` func generate(n: Int, var a: [String]){ if n == 1 { print(a.joinWithSeparator("")) } else { for var i = 0; i < n - 1; i++ { generate(n - 1, a: a) if n % 2 == 0 { let temp = a[i] a[i] = a[n-1] a[n-1] = temp } ...
I was searching to solve the same problem, but I wanted a solution that worked with Generic data type, so I wrote one by looking at a scala code (<http://vkostyukov.ru/posts/combinatorial-algorithms-in-scala/>) <https://gist.github.com/psksvp/8fb5c6fbfd6a2207e95638db95f55ae1> ``` /** translate from Scala by psksvp...
60,130,669
I spent many hours trying to find some way to create a new .NET Core 3.1 web app under Windows subscription. I found that if you pick up the Runtime stack as .Net Core 3.1 (LTS) the only option is to create an app under the Linux. I tried to play with different regions and Sku and sizes as well but for all cases, it's ...
2020/02/08
[ "https://Stackoverflow.com/questions/60130669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9918730/" ]
This option is going to be available once the deployment of .NET Core 3.1 has been rolled out to all AppServices worldwide. So far, this is only been completed for Linux. <https://github.com/Azure/app-service-announcements/issues/217> <https://github.com/Azure/app-service-announcements-discussions/issues/129#issuecom...
I had the same problem. I could not get windows selected in Azure. What I did was let Visual Studio create the App in my App Services. (Note the app insights!) [![enter image description here](https://i.stack.imgur.com/CI57h.png)](https://i.stack.imgur.com/CI57h.png) [![enter image description here](https://i.stack.im...
72,049,340
I want to add text above the dialog box as shown in the image below (on barrier) [![How can I overwrite the dialog like this?](https://i.stack.imgur.com/CYQvt.jpg)](https://i.stack.imgur.com/CYQvt.jpg) This is the code for the dialog box that I want to modify to be as in the picture Please help me to solve my problem...
2022/04/28
[ "https://Stackoverflow.com/questions/72049340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15297263/" ]
It's not clear what your Insert logic is and what exactly you want to insert but let me give you how I would structure such a query (including some safeguards such as prepared statements) and hopefully you can just change the SQL statements based on what you need. I have left comments on most rows to explain ``` <?php...
This is an ideal situation for a stored procedure. I assume you try to Your logic seems to be: 1. find a barcode (by id and sca?) 2. if a barcode is found insert into voters table 3. delete barcode from the barcode table So something like ``` create procedure `check_barcode` (sca int) begin select * into result ...
72,049,340
I want to add text above the dialog box as shown in the image below (on barrier) [![How can I overwrite the dialog like this?](https://i.stack.imgur.com/CYQvt.jpg)](https://i.stack.imgur.com/CYQvt.jpg) This is the code for the dialog box that I want to modify to be as in the picture Please help me to solve my problem...
2022/04/28
[ "https://Stackoverflow.com/questions/72049340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15297263/" ]
It's not clear what your Insert logic is and what exactly you want to insert but let me give you how I would structure such a query (including some safeguards such as prepared statements) and hopefully you can just change the SQL statements based on what you need. I have left comments on most rows to explain ``` <?php...
I get what I was looking for! ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <?php include "includes/scripts.php"; ?> ...
72,049,340
I want to add text above the dialog box as shown in the image below (on barrier) [![How can I overwrite the dialog like this?](https://i.stack.imgur.com/CYQvt.jpg)](https://i.stack.imgur.com/CYQvt.jpg) This is the code for the dialog box that I want to modify to be as in the picture Please help me to solve my problem...
2022/04/28
[ "https://Stackoverflow.com/questions/72049340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15297263/" ]
This is an ideal situation for a stored procedure. I assume you try to Your logic seems to be: 1. find a barcode (by id and sca?) 2. if a barcode is found insert into voters table 3. delete barcode from the barcode table So something like ``` create procedure `check_barcode` (sca int) begin select * into result ...
I get what I was looking for! ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <?php include "includes/scripts.php"; ?> ...
2,627,768
I am new to web design using tableless and I'm having problem positioning some elements on my page.. Here's the sample html: <http://christianruado.comuf.com/sample.html> [alt text http://christianruado.comuf.com/images/screen.jpg](http://christianruado.comuf.com/images/screen.jpg) As you can see from the screen sho...
2010/04/13
[ "https://Stackoverflow.com/questions/2627768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/114206/" ]
This is not exactly the answer to your problem, but it should get you on the right track. Behold! [The Holy Grail](http://www.alistapart.com/articles/holygrail)! If that doesn't work, another technique you can use is to fake the column. This is done by vertically tiling a background image the width of your column beh...
css : ``` #header,#content,#main,#right, #right .top,#right .bottom,#center,#footer {float:left;} ``` html : ``` div.header <br> div.center + div.left <br> div.footer + div.right ``` should be like this/
901,962
What is the correct MIME type for a tar.gz file? I've searched around and found several values being used, including: ``` application/x-gzip application/x-gtar application/x-tgz ``` But I could find no indication as to which of these (if any) was the correct or canonical value.
2015/04/15
[ "https://superuser.com/questions/901962", "https://superuser.com", "https://superuser.com/users/229054/" ]
As of August 2012, the MIME type recommended in [RFC 6713](https://www.rfc-editor.org/rfc/rfc6713) is `application/gzip`. According to the [IANA registry](http://www.iana.org/assignments/media-types/media-types.xhtml), tar is not an official media type, so a GZipped tar file is officially only a compressed file. Hypo...
Although most are deprecated, they are all technically correct, just different MIME types. The correct MIME type is `application/x-gzip` according to cPanel standards.
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Most likely, you have simply forgotten to override `equals()` and `hashCode()` in your type. `equals()` is what `contains()` checks for. From the [Javadoc](http://java.sun.com/javase/6/docs/api/java/util/ArrayList.html#contains(java.lang.Object)): > > Returns `true` if this list contains the specified element. More ...
Did you override the equals method? This is required to make contains work correctly.
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Most likely, you have simply forgotten to override `equals()` and `hashCode()` in your type. `equals()` is what `contains()` checks for. From the [Javadoc](http://java.sun.com/javase/6/docs/api/java/util/ArrayList.html#contains(java.lang.Object)): > > Returns `true` if this list contains the specified element. More ...
maybe use the Integer class instead? then you can do object comparison
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Most likely, you have simply forgotten to override `equals()` and `hashCode()` in your type. `equals()` is what `contains()` checks for. From the [Javadoc](http://java.sun.com/javase/6/docs/api/java/util/ArrayList.html#contains(java.lang.Object)): > > Returns `true` if this list contains the specified element. More ...
My guess is that you've only written a "strongly typed" equals method instead of overriding equals(Object). In other words, if you've got: ``` public boolean equals(Foo f) ``` you need ``` public boolean equals(Object o) ``` as well to override Object.equals. That would fit with "equals works but contains doesn'...
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Most likely, you have simply forgotten to override `equals()` and `hashCode()` in your type. `equals()` is what `contains()` checks for. From the [Javadoc](http://java.sun.com/javase/6/docs/api/java/util/ArrayList.html#contains(java.lang.Object)): > > Returns `true` if this list contains the specified element. More ...
Remember that if you don't override the equals() method, then two objects of your type are only equal if they are the *same instance* of that object. The ArrayList class uses this method to check that it contains the given object. Also, you need to match the signature exactly, which means that it must take an Object as...
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Did you override the equals method? This is required to make contains work correctly.
maybe use the Integer class instead? then you can do object comparison
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My guess is that you've only written a "strongly typed" equals method instead of overriding equals(Object). In other words, if you've got: ``` public boolean equals(Foo f) ``` you need ``` public boolean equals(Object o) ``` as well to override Object.equals. That would fit with "equals works but contains doesn'...
Did you override the equals method? This is required to make contains work correctly.
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My guess is that you've only written a "strongly typed" equals method instead of overriding equals(Object). In other words, if you've got: ``` public boolean equals(Foo f) ``` you need ``` public boolean equals(Object o) ``` as well to override Object.equals. That would fit with "equals works but contains doesn'...
maybe use the Integer class instead? then you can do object comparison
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Remember that if you don't override the equals() method, then two objects of your type are only equal if they are the *same instance* of that object. The ArrayList class uses this method to check that it contains the given object. Also, you need to match the signature exactly, which means that it must take an Object as...
maybe use the Integer class instead? then you can do object comparison
986,924
I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wond...
2009/06/12
[ "https://Stackoverflow.com/questions/986924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My guess is that you've only written a "strongly typed" equals method instead of overriding equals(Object). In other words, if you've got: ``` public boolean equals(Foo f) ``` you need ``` public boolean equals(Object o) ``` as well to override Object.equals. That would fit with "equals works but contains doesn'...
Remember that if you don't override the equals() method, then two objects of your type are only equal if they are the *same instance* of that object. The ArrayList class uses this method to check that it contains the given object. Also, you need to match the signature exactly, which means that it must take an Object as...
35,315,624
In Oracle the space allocated for data after `INSERT INTO` operation is not cleaned up when deleting rows from the table. Instead, after `DELETE FROM` operation some "waste space" is left. So what happens when I do `INSERT INTO` after `DELETE FROM` - does it span this "waste space" or allocates new space again?
2016/02/10
[ "https://Stackoverflow.com/questions/35315624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3787877/" ]
You could use [`Node.lookup()`](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#lookup-java.lang.String-) to get the `Circle`s using a css selector (or [`Node.lookupAll`](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#lookupAll-java.lang.String-) for multiple nodes): ``` void cha...
Its simple: Just add All Circles in a List -> ``` List<Circle> circles = new ArrayList<>(); public void creat(String s) { newNode = new ButtonBar(); Circle c = new Circle(); c.setRadius(11); c.setStrokeWidth(1); c.setStroke(Paint.valueOf("#ffffff")); c.setFill(Paint.valueOf("#15ff00")); ...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
**In-place solution:** In order to shift all zeros rightwards, we iterate through the array keeping track of the last non-zero element's index `i` and shifting all non-zero elements to the left: ```js // Moves zeroes to the right: function moveZeroes(array) { let i = 0; for (let j = 0; j < array.length; ++j) { ...
index is not updated when you delete an item in an array.use for loop instead. ```js var moveZeroes = function(nums) { var count=0; //Remove anything that's not Zero. for(var index=0;index<nums.length;index++){ if(nums[index]==0){ //when remove item from the array,the rest items index after ...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
index is not updated when you delete an item in an array.use for loop instead. ```js var moveZeroes = function(nums) { var count=0; //Remove anything that's not Zero. for(var index=0;index<nums.length;index++){ if(nums[index]==0){ //when remove item from the array,the rest items index after ...
I think i got it. Whenever we do "Splice" we are changing the array size, hence in the second example, we need to also check the previous element. The completed code is/as follows: ``` var moveZeroes = function(nums) { var count=0; nums.forEach(function(val, index){ if(val==0){ nums.splice(index, 1); ...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
**In-place solution:** In order to shift all zeros rightwards, we iterate through the array keeping track of the last non-zero element's index `i` and shifting all non-zero elements to the left: ```js // Moves zeroes to the right: function moveZeroes(array) { let i = 0; for (let j = 0; j < array.length; ++j) { ...
The problem is that you're modifying the array while you're looping over it. Every time you splice out an element, all the elements after it get shifted down. But the next iteration goes to the next element, so it skips the element that was moved into the place of the element that was removed. The first example seems t...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
You ar cutting out (`splicing`) from an array that you are currently looping through (in the `forEach`), so it there is more successive `0` some of them will be skipped. So if the array is `[0, 0, 1]` here is what happens: ``` forEach: (case of two or more successive 0s) [0, 0, 1] // ^ cursor is here (0 === 0 ...
here is an other implementation for it if you are interested . with a simple for loop ``` var moveZeroes = function(nums) { var res = [] var count=0 for(var i = 0 ; i < nums.length ; i++){ nums[i] == 0 ? count += 1 : res.push(nums[i]) } for(var j = 0 ; j < count ; j++){ res.push...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
here is an other implementation for it if you are interested . with a simple for loop ``` var moveZeroes = function(nums) { var res = [] var count=0 for(var i = 0 ; i < nums.length ; i++){ nums[i] == 0 ? count += 1 : res.push(nums[i]) } for(var j = 0 ; j < count ; j++){ res.push...
I think i got it. Whenever we do "Splice" we are changing the array size, hence in the second example, we need to also check the previous element. The completed code is/as follows: ``` var moveZeroes = function(nums) { var count=0; nums.forEach(function(val, index){ if(val==0){ nums.splice(index, 1); ...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
**In-place solution:** In order to shift all zeros rightwards, we iterate through the array keeping track of the last non-zero element's index `i` and shifting all non-zero elements to the left: ```js // Moves zeroes to the right: function moveZeroes(array) { let i = 0; for (let j = 0; j < array.length; ++j) { ...
As others have already mentioned, you are removing elements from an array you are iterating over. This causes the index provided in the `forEach` function (that is iterating over the original version of the array) to be out of the date with the current updated array. Here is one approach using the `filter` function: ...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
index is not updated when you delete an item in an array.use for loop instead. ```js var moveZeroes = function(nums) { var count=0; //Remove anything that's not Zero. for(var index=0;index<nums.length;index++){ if(nums[index]==0){ //when remove item from the array,the rest items index after ...
The problem is that you're modifying the array while you're looping over it. Every time you splice out an element, all the elements after it get shifted down. But the next iteration goes to the next element, so it skips the element that was moved into the place of the element that was removed. The first example seems t...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
You ar cutting out (`splicing`) from an array that you are currently looping through (in the `forEach`), so it there is more successive `0` some of them will be skipped. So if the array is `[0, 0, 1]` here is what happens: ``` forEach: (case of two or more successive 0s) [0, 0, 1] // ^ cursor is here (0 === 0 ...
index is not updated when you delete an item in an array.use for loop instead. ```js var moveZeroes = function(nums) { var count=0; //Remove anything that's not Zero. for(var index=0;index<nums.length;index++){ if(nums[index]==0){ //when remove item from the array,the rest items index after ...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
You ar cutting out (`splicing`) from an array that you are currently looping through (in the `forEach`), so it there is more successive `0` some of them will be skipped. So if the array is `[0, 0, 1]` here is what happens: ``` forEach: (case of two or more successive 0s) [0, 0, 1] // ^ cursor is here (0 === 0 ...
I think i got it. Whenever we do "Splice" we are changing the array size, hence in the second example, we need to also check the previous element. The completed code is/as follows: ``` var moveZeroes = function(nums) { var count=0; nums.forEach(function(val, index){ if(val==0){ nums.splice(index, 1); ...
42,869,156
I have several .csv files in a folder. I want to read them all once by using the command ``` library(data.table) path <-path list <- list.files(path,pattern="*.csv") files <- paste(path,list,sep='/') DT <- do.call(rbind, lapply(files, fread)) ``` However, since the first column is a 12 digits number, data.table sho...
2017/03/18
[ "https://Stackoverflow.com/questions/42869156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7392051/" ]
index is not updated when you delete an item in an array.use for loop instead. ```js var moveZeroes = function(nums) { var count=0; //Remove anything that's not Zero. for(var index=0;index<nums.length;index++){ if(nums[index]==0){ //when remove item from the array,the rest items index after ...
As others have already mentioned, you are removing elements from an array you are iterating over. This causes the index provided in the `forEach` function (that is iterating over the original version of the array) to be out of the date with the current updated array. Here is one approach using the `filter` function: ...
12,282,450
I am completely new to moving codeigniter to my web-server and im having trouble with the configuration. Where do I place my codeigniter project folder in www under myurl.com in in the very root directory? Am i supposed to move out the application and system folders? I am trying to remove index.php? from my URL name w...
2012/09/05
[ "https://Stackoverflow.com/questions/12282450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1546955/" ]
**Directory structure** If at all possible, it's advised that you keep your `system` and `application` folders above the web root. Your `index.php` file needs to be accessible from a browser, so that should go in your `public_html` folder. Here's a possible directory structure that you could use: ``` -/home/edd -...
Move all the files that reside inside your CI-folder into `public_html`. The `.htaccess` file should be located in the root of `public_html`(where application, system, index.php etc also reside). Side note: don't put `$config` values in `/config/routes.php` - those need to be in `/config/config.php`
24,287
I planted some beetroot from store bought seedlings in November, and they're fine. But this chap grew up with them, and I don't remember if it came with the others, or just grew from where ever. I just don't know what it is. Doesn't look like a turnip to me. And the leaves looked like a kind of spinach which is why I ...
2016/04/25
[ "https://gardening.stackexchange.com/questions/24287", "https://gardening.stackexchange.com", "https://gardening.stackexchange.com/users/1894/" ]
I think what you have here is a slightly misshapen Sugar Beet. Both Beetroot and Sugar Beets are *Beta vulgaris*, they're just different cultivars. The seeds are identical so telling them apart at planting would be impossible, and they cross-pollinate freely so it's no big surprise a sugar beet seed could have slipped ...
I think it is really a beetroot (*Beta vugaris*). Just there are many different sorts. This seems something in direction of Swiss chard. Probably the seeds got mixed.
16,695,691
I know this is simple and the answer has got to be out there somewhere but I can't find it. How do I select all the values of a series of dropdown menus with a specific class inside a specific form? The specific form is important because I have dropdown menus with the same class outside the form that I do not wish to ...
2013/05/22
[ "https://Stackoverflow.com/questions/16695691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1132729/" ]
Try something like `$('#addInfoForm select.addItems option[selected="selected"]').each(function() { alert($(this).val()); });`
``` $("#addInfoForm select.addItems") ```
27,674
How can I modify (or replace) `elpy-shell-send-region-or-buffer` (bound to `C-c C-c`) to behave like `ess-eval-region-or-function-or-paragraph-and-step`, i.e. 1. if region is active, evaluate it (this currently works), goto 4. 2. if inside a function, evaluate it, goto 4. 3. evaluate current paragraph 4. Jump to the b...
2016/10/09
[ "https://emacs.stackexchange.com/questions/27674", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/5237/" ]
I haven't tried this thoroughly, but should work: 1. if region is active, evaluate it (this currently works), goto 3. 2. if region not active, evaluate current statement, goto 3. 3. Jump to the beginning of next paragraph ``` (defun python-shell-send-region-or-line nil "Sends from python-mode buffer to a python shel...
`elpy-shell-send-region-or-buffer` is meant only to send entire buffer or a region. If you want to step through code, you should use `elpy-shell-send-current-statement`, which is bound to `C-ENTER`. This function sends current statement to Python shell and advances to next. If you want to send entire function, you h...
12,495,049
What is the use of .rc files in Android framework. I see a lot of files what is there purpose. Also I have a little knowledge about linux but I see commands like ``` mkdir /dirName 0777 abc def ``` what does that mean. If I run this command on GNU-Linux it creates folder named dirName, 0777, abc and def. I know its ...
2012/09/19
[ "https://Stackoverflow.com/questions/12495049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1367661/" ]
Thanks for the reply. I already knew .rc files contains instructions for the compiler and what is the purpose of .rc files. ([Definition of .rc file](http://linux.about.com/cs/linux101/g/rcfile.htm)). I was more concerned about its usage with context of Android and how commands are used. After searching a lot I finall...
.rc files contain instructions for the compiler. This [source](http://www.ehow.com/facts_5697167_file-extension-rc_.html) explains it so much better. [Marakana](http://marakana.com/static/courseware/android/internals/index.html) deals a little bit with GNU command line and things of that nature. I am not sure if I ans...
8,826,390
I'm trying to use some mysql data in creating part of a variable name to refer to another variable already declared elsewhere. Basically how can I get the $damage\_name be part of the if statement boolean check? ``` $conditions = array( 'bent_num' => 0, 'spine_torn' => 0, 'pages_torn' => 0, ...
2012/01/11
[ "https://Stackoverflow.com/questions/8826390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/969621/" ]
Broken syntax and concatenation. Try: ``` $_SESSION['SELL_is_' . $damage_name]; ``` * SELL\_is\_ needs to be quoted. * You had an extra concatenation operator after `$damage_name` * An extra semicolon after the closing square bracket.
I think you mean: ``` $_SESSION[constant("SELL_is_" . $damage_name)] ``` I'm assuming SELL\_is\_ is a `define`d constant (because of the capitalization). To get the value of a define, either use the full name, or use `constant`.
8,826,390
I'm trying to use some mysql data in creating part of a variable name to refer to another variable already declared elsewhere. Basically how can I get the $damage\_name be part of the if statement boolean check? ``` $conditions = array( 'bent_num' => 0, 'spine_torn' => 0, 'pages_torn' => 0, ...
2012/01/11
[ "https://Stackoverflow.com/questions/8826390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/969621/" ]
Broken syntax and concatenation. Try: ``` $_SESSION['SELL_is_' . $damage_name]; ``` * SELL\_is\_ needs to be quoted. * You had an extra concatenation operator after `$damage_name` * An extra semicolon after the closing square bracket.
try: ``` if (isset($conditions[$row['type']]) && $_SESSION["SELL_is_$damage_name"] == 'y') ```
8,826,390
I'm trying to use some mysql data in creating part of a variable name to refer to another variable already declared elsewhere. Basically how can I get the $damage\_name be part of the if statement boolean check? ``` $conditions = array( 'bent_num' => 0, 'spine_torn' => 0, 'pages_torn' => 0, ...
2012/01/11
[ "https://Stackoverflow.com/questions/8826390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/969621/" ]
Broken syntax and concatenation. Try: ``` $_SESSION['SELL_is_' . $damage_name]; ``` * SELL\_is\_ needs to be quoted. * You had an extra concatenation operator after `$damage_name` * An extra semicolon after the closing square bracket.
``` $_SESSION[SELL_is_ . $damage_name . ]; ``` should be ``` $_SESSION["SELL_is_" . $damage_name]; ```
8,826,390
I'm trying to use some mysql data in creating part of a variable name to refer to another variable already declared elsewhere. Basically how can I get the $damage\_name be part of the if statement boolean check? ``` $conditions = array( 'bent_num' => 0, 'spine_torn' => 0, 'pages_torn' => 0, ...
2012/01/11
[ "https://Stackoverflow.com/questions/8826390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/969621/" ]
I think you mean: ``` $_SESSION[constant("SELL_is_" . $damage_name)] ``` I'm assuming SELL\_is\_ is a `define`d constant (because of the capitalization). To get the value of a define, either use the full name, or use `constant`.
try: ``` if (isset($conditions[$row['type']]) && $_SESSION["SELL_is_$damage_name"] == 'y') ```
8,826,390
I'm trying to use some mysql data in creating part of a variable name to refer to another variable already declared elsewhere. Basically how can I get the $damage\_name be part of the if statement boolean check? ``` $conditions = array( 'bent_num' => 0, 'spine_torn' => 0, 'pages_torn' => 0, ...
2012/01/11
[ "https://Stackoverflow.com/questions/8826390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/969621/" ]
``` $_SESSION[SELL_is_ . $damage_name . ]; ``` should be ``` $_SESSION["SELL_is_" . $damage_name]; ```
try: ``` if (isset($conditions[$row['type']]) && $_SESSION["SELL_is_$damage_name"] == 'y') ```
61,877,351
I want to display a maintenance page on an application running under Kubernetes whilst a deployment is in progress, in this “maintenance” window, I backup the database and then apply schema changes and then deploy the new version. I thought maybe what I could do is change the service selector so that it would point t...
2020/05/18
[ "https://Stackoverflow.com/questions/61877351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1634174/" ]
This happens due to a combination of how browsers and k8s services work. Browsers cache TCP connections to servers: when requesting a page they will leave the TCP connection open, and if the user later requests more pages from the same domain, the browser will reuse the already-open TCP connection to save time. The k...
First of all make sure the content you are serving is not cached. Second, make sure to close all open TCP connections when you shut down your pods. The steps should be as follows: 1. Change service selector to route traffic to maintenance pods 2. Gracefully shutdown running pods (this includes closing all open TCP co...
61,877,351
I want to display a maintenance page on an application running under Kubernetes whilst a deployment is in progress, in this “maintenance” window, I backup the database and then apply schema changes and then deploy the new version. I thought maybe what I could do is change the service selector so that it would point t...
2020/05/18
[ "https://Stackoverflow.com/questions/61877351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1634174/" ]
This happens due to a combination of how browsers and k8s services work. Browsers cache TCP connections to servers: when requesting a page they will leave the TCP connection open, and if the user later requests more pages from the same domain, the browser will reuse the already-open TCP connection to save time. The k...
Here is how services in Kubernetes work, they are basically a dummy loadbalancers forwarding requests to pods in a round robin fashion, and they select which pods to forward the requests to based on the labels as you have already figured out. Now here is how http/tcp work, I open the browser to visit your website www....
11,047,640
I have a normale jpg-photo and 2 textlink. When the user mouseover textlink 1 I would like to show a transparent png-photo on top of the jpg-photo, and when the user mouseover textlink 2, I would like to show another png-photo on top of the jpg. On mouseout the png should disappear again. Possible? And can it be done ...
2012/06/15
[ "https://Stackoverflow.com/questions/11047640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1458216/" ]
Yes it is possible with JQuery, JS or CSS, depending on your requirements. Good script to use is here: <http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery>
Your request can be done easily using the power of jQuery :) I made something using jQuery and you can find it here <http://jsfiddle.net/xrmqq/> It is close to what you want to do.
11,047,640
I have a normale jpg-photo and 2 textlink. When the user mouseover textlink 1 I would like to show a transparent png-photo on top of the jpg-photo, and when the user mouseover textlink 2, I would like to show another png-photo on top of the jpg. On mouseout the png should disappear again. Possible? And can it be done ...
2012/06/15
[ "https://Stackoverflow.com/questions/11047640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1458216/" ]
You can use hover CSS selector to solve such kind of problems depending upon html layout of your page ``` #11:hover img { display:inline: Add other blocks } ```
Your request can be done easily using the power of jQuery :) I made something using jQuery and you can find it here <http://jsfiddle.net/xrmqq/> It is close to what you want to do.
11,318,922
I've managed to successfully build my maven project which uses the [jasmine-maven-plugin](https://github.com/searls/jasmine-maven-plugin) to put the source and test javascript files in the right places. When I have a simple test such as: ``` describe('true', function() { it('should be true', function() { ...
2012/07/03
[ "https://Stackoverflow.com/questions/11318922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1429419/" ]
Did you set up in the correct way jasmine? It seems that jasmine can't find your js files, here you have an example of the maven configuration: ``` <plugin> <groupId>com.github.searls</groupId> <artifactId>jasmine-maven-plugin</artifactId> <version>1.1.0</version> <executions> ...
After much mental strain and not much luck, I just modified the plugin to ignore perceived javascript errors so that everything would compile. Lo and behold, it all worked! Scripts were just being added out of order. For those interested, I added "client.setThrowExceptionOnScriptError(false)" at line #90 in TestMojo.ja...
27,776,500
At the moment I have a bunch of functions that check if strings meet certain circumstances eg isValidAlphaNumericString or isValidUserName. Which uses my own implicit stringOps class. It is quite useful especially when dealing with complex requirements such as author names etc. Requiring string to have only no consecut...
2015/01/05
[ "https://Stackoverflow.com/questions/27776500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2541783/" ]
It seems like a good fit for Scala Macros. See [this post](https://blog.safaribooksonline.com/2013/12/20/scala-macros-that-wont-kill-you/) for details. You can have your own string types and perform compile time validation on them.
Imagine that you are a scala compiler :) How would *you* approach the task of failing an assignment like `val foo: AlphaNumericString = someString()` without actually evaluation the right hand side and the conversion function? This was just my long way to say, that what you are asking for is obviously impossible.
59,210,253
I am create custom search page. When this page is opened, hamburger menu is hide and search text field change size instantly. how to make it happen smoothly? [![enter image description here](https://i.stack.imgur.com/yTbpl.gif)](https://i.stack.imgur.com/yTbpl.gif) Now i make this code ``` class DefaultAppBar extend...
2019/12/06
[ "https://Stackoverflow.com/questions/59210253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6919358/" ]
You can't return an array by value. However, you can do that with an `std::array`, which is a wrapper around an array: ``` #include <array> std::array<float, 5> FunctionName() { std::array<float, 5> data; //process data return data; } ```
> > You can return the pointer to array in C style doing: > > > ``` float* FunctionName(){ float myVar[5]; float* p = (float*) malloc(sizeof(float) * 5); //process data return p; } ```
5,987,935
I have an array of unknown (to the current method) class objects. I do know that each class has a property called "Number". I am trying to write a LINQ query where I am looking for the object with the next Number in sequence. AKA, I'm at Number 8, use a LINQ query to find the object where Number=9. Anyone got a sugges...
2011/05/13
[ "https://Stackoverflow.com/questions/5987935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681686/" ]
If as you indicated elsewhere that you designed all the classes then you could put that number property in an in interface and have all the classes implement that interface. Then, in the linq query, use the interface.
If you truly do not have a common type that you can reduce to and for some reason cannot introduce such a type, then you may be able to use the dynamic keyword. I don't have access to a compiler at the moment, but can your method accept a collection of dynamic objects and query them? For example: ``` IEnumerable<dyna...
5,987,935
I have an array of unknown (to the current method) class objects. I do know that each class has a property called "Number". I am trying to write a LINQ query where I am looking for the object with the next Number in sequence. AKA, I'm at Number 8, use a LINQ query to find the object where Number=9. Anyone got a sugges...
2011/05/13
[ "https://Stackoverflow.com/questions/5987935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681686/" ]
You can create an interface - INumber with a property Number. Each of the objects that you are having in the array can implemen this interface. That way, you will have an array of known type INumber. This way your query will be easy to debug and maintain.
If you truly do not have a common type that you can reduce to and for some reason cannot introduce such a type, then you may be able to use the dynamic keyword. I don't have access to a compiler at the moment, but can your method accept a collection of dynamic objects and query them? For example: ``` IEnumerable<dyna...
5,987,935
I have an array of unknown (to the current method) class objects. I do know that each class has a property called "Number". I am trying to write a LINQ query where I am looking for the object with the next Number in sequence. AKA, I'm at Number 8, use a LINQ query to find the object where Number=9. Anyone got a sugges...
2011/05/13
[ "https://Stackoverflow.com/questions/5987935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681686/" ]
If the objects all inherit from a known interface then you can cast them, e.g. ``` var next = items.Cast<IHasNumber>.FirstOrDefault(x => x.Number == index + 1); ``` If they don't, then you can use `dynamic`, e.g. ``` var next = items.Cast<dynamic>.FirstOrDefault(x => x.Number == index + 1); ``` If you have contro...
If you truly do not have a common type that you can reduce to and for some reason cannot introduce such a type, then you may be able to use the dynamic keyword. I don't have access to a compiler at the moment, but can your method accept a collection of dynamic objects and query them? For example: ``` IEnumerable<dyna...
5,987,935
I have an array of unknown (to the current method) class objects. I do know that each class has a property called "Number". I am trying to write a LINQ query where I am looking for the object with the next Number in sequence. AKA, I'm at Number 8, use a LINQ query to find the object where Number=9. Anyone got a sugges...
2011/05/13
[ "https://Stackoverflow.com/questions/5987935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681686/" ]
If as you indicated elsewhere that you designed all the classes then you could put that number property in an in interface and have all the classes implement that interface. Then, in the linq query, use the interface.
To avoid performance issues you can use the following method: ``` static void Main(string[] args) { object[] objs = GetInitialData(); var accessor = GetGetterHelper<int>(objs[0].GetType(), "Number"); var res = from a in objs where accessor(a) == 7 select a; } static Func<object, T> GetGetterHelper<T>(T...
5,987,935
I have an array of unknown (to the current method) class objects. I do know that each class has a property called "Number". I am trying to write a LINQ query where I am looking for the object with the next Number in sequence. AKA, I'm at Number 8, use a LINQ query to find the object where Number=9. Anyone got a sugges...
2011/05/13
[ "https://Stackoverflow.com/questions/5987935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681686/" ]
You can create an interface - INumber with a property Number. Each of the objects that you are having in the array can implemen this interface. That way, you will have an array of known type INumber. This way your query will be easy to debug and maintain.
To avoid performance issues you can use the following method: ``` static void Main(string[] args) { object[] objs = GetInitialData(); var accessor = GetGetterHelper<int>(objs[0].GetType(), "Number"); var res = from a in objs where accessor(a) == 7 select a; } static Func<object, T> GetGetterHelper<T>(T...
5,987,935
I have an array of unknown (to the current method) class objects. I do know that each class has a property called "Number". I am trying to write a LINQ query where I am looking for the object with the next Number in sequence. AKA, I'm at Number 8, use a LINQ query to find the object where Number=9. Anyone got a sugges...
2011/05/13
[ "https://Stackoverflow.com/questions/5987935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681686/" ]
If the objects all inherit from a known interface then you can cast them, e.g. ``` var next = items.Cast<IHasNumber>.FirstOrDefault(x => x.Number == index + 1); ``` If they don't, then you can use `dynamic`, e.g. ``` var next = items.Cast<dynamic>.FirstOrDefault(x => x.Number == index + 1); ``` If you have contro...
To avoid performance issues you can use the following method: ``` static void Main(string[] args) { object[] objs = GetInitialData(); var accessor = GetGetterHelper<int>(objs[0].GetType(), "Number"); var res = from a in objs where accessor(a) == 7 select a; } static Func<object, T> GetGetterHelper<T>(T...
9,818,772
<http://ideone.com/u0bVy> the link above contain the code that i wrote for a class project.I have a question about the output file for this code.The output file was created but was empty why is this happen ? I don't see anything wrong with the output function.Could it be that I did something wrong in the other functi...
2012/03/22
[ "https://Stackoverflow.com/questions/9818772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1276591/" ]
In the absence of errors in the console and no visible activity on the page it usually means that the page is not set-up correctly so: * Make sure your host page is set up correctly as per the [documentation](http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideHostPage). * Make sure yo...
The strange part about this issue is that it does work, but with any other browser, including IE!? And not Chrome?! What I did was to follow step by step the GWT tutorial to create an app (StockWatcher) In development mode it worked flawlessly in Chrome, but after I compiled the project, the result was no longer worki...
56,168,993
I made a project where I write some stuff in a csv file, but special characters don't work correctly, for example characters such as : à, é, ï.. So I changed my code, so that the fileWriter would be encoded in ISO-8859-1. ``` OutputStreamWriter o = new OutputStreamWriter(new FileOutputStream(file), "ISO-8859-1"); ...
2019/05/16
[ "https://Stackoverflow.com/questions/56168993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8598112/" ]
You can capture the words in a capturing surrounded by an optional preceding comma or an optional trailing comma. You can test the [regex here](https://regex101.com/r/5OHAIc/1): `,?([A-Za-z]+),?` ```js const pattern = /,?([A-Za-z]+),?/gm; const str = `,IGORA,GIANC,LOLLI`; let matches = []; let match; // Iterate...
Is this what you're looking for? Explanation: > > `\b` word boundary (starting or ending a word) > > > `\w` a word ([A-z]) > > > `{5}` 5 characters of previous > > > So it matches all 5-character words but not NANANANA ```js var str = 'IGORA,CIAOA,POPOP,NANANANA'; var arr = str.match(/\b\w{5}\b/g); console....
56,168,993
I made a project where I write some stuff in a csv file, but special characters don't work correctly, for example characters such as : à, é, ï.. So I changed my code, so that the fileWriter would be encoded in ISO-8859-1. ``` OutputStreamWriter o = new OutputStreamWriter(new FileOutputStream(file), "ISO-8859-1"); ...
2019/05/16
[ "https://Stackoverflow.com/questions/56168993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8598112/" ]
You can capture the words in a capturing surrounded by an optional preceding comma or an optional trailing comma. You can test the [regex here](https://regex101.com/r/5OHAIc/1): `,?([A-Za-z]+),?` ```js const pattern = /,?([A-Za-z]+),?/gm; const str = `,IGORA,GIANC,LOLLI`; let matches = []; let match; // Iterate...
There are other ways to do this, but I found that one of the simple ways is by using the `replace` method, as it can replace all instances that match that regex. For example: ```js var regex = /^(?:(?:\,([A-Za-z]{5}))?)+$/g; var str = ',GIANC,IGORA'; var arr = []; str.replace(regex, function(match) { arr[arr....
50,279,501
Can't make friends out of my AJAX and MVC 6 controller. This is how I define AJAX call for *SetFormValues* POST-action: **Index.cshtml** ```js $.ajax({ type: "Post", url: "Home/SetFormValues", data: { Name: name, Phone: phone }, dataType: "json", success: function (result) { SuccessFuncti...
2018/05/10
[ "https://Stackoverflow.com/questions/50279501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3910087/" ]
In asp.net core, by default, the serializer uses **`camelCase`** property names for json serialization. So your result will be like this ``` {"nameError":"some message","phoneError":"some message here"} ``` **Javascript is case sensitive**. So use the correct case ``` $("#nameerror").append(result.nameError); $("#p...
its working perfectly when i have added this line in startup file ``` public void ConfigureServices(IServiceCollection services) { services.Configure<CookiePolicyOptions>(options => { options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode....
3,307,257
I Perfectly understand that this is not allowed by the App Store Policy but is programmatically possible to create ad hoc wireless network with the iphone SDK, with "is possible" I mean if the iPhone 3G and/or 3GS hardware support this "feauture" and if exists some kind of low-level api to do this. This question does N...
2010/07/22
[ "https://Stackoverflow.com/questions/3307257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/76593/" ]
Not with the SDK, no. Third-party apps don't get much access to the wireless hardware, and creating networks would definitely be a no-go.
I don't believe so; however, it's possible that there's something undocumented I'm not aware of.
60,128,156
I was working on a dropdown list and wanted the results shown in the second dropdown to be filtered according to the option selected in the first dropdown. My EJS file is as follows:- ``` <div class="form-group"> <label for="">Category</label> <select id="list" name="mainCategory" id="maincategory-dr...
2020/02/08
[ "https://Stackoverflow.com/questions/60128156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7558969/" ]
If its Ok to use a pure javascript (jQuery) solution the following might help, its just filter the dropdown options based on `data-dep` attribute and return filtered options, or if you are looking for advanced dropdown options dependency check this [jQuery plugin](https://github.com/kartik-v/dependent-dropdown). ```js...
```js const categories = ['a', 'b', 'c']; const subCategories = { a: ['a-1', 'a-2', 'a-3'], b: ['b-1', 'b-2', 'b-3'], c: ['c-1', 'c-2', 'c-3'], }; const catSelect = document.getElementById('cat'); const subCatSelect = document.getElementById('subcat'); catSelect.innerHTML = categories.map(cat => `<option...
29,066,399
How to implement func function: ``` func(); // console.log('state1'); func(); // console.log('state2'); func(); // console.log('state1'); func(); // console.log('state2'); //... ``` But without setting properties to func and variables in closures.
2015/03/15
[ "https://Stackoverflow.com/questions/29066399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626347/" ]
Well, using global variables hasn't been denied, so I don't see a reason for this not to be a valid answer: ``` var func = function() { if (typeof state == 'undefined') { state = false; } state = !state; console.log(state ? 'state1' : 'state2'); }; ``` JSFiddle: <http://jsfiddle.net/zo94u90f/...
This does not match the "no-closures" requirement. But I don't know of any way to do that except to use global variables. This seems quite clean though. What's the objection to closure variables? ``` var func = (function() { var calls = 0; var states = ["state1", "state2"]; return function() { var ...
29,066,399
How to implement func function: ``` func(); // console.log('state1'); func(); // console.log('state2'); func(); // console.log('state1'); func(); // console.log('state2'); //... ``` But without setting properties to func and variables in closures.
2015/03/15
[ "https://Stackoverflow.com/questions/29066399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626347/" ]
I find a trick: ``` func = (function* (){ while (true) { console.log('state1'); yield null; console.log('state2'); yield null; } })() func = func.next.bind(func); func(); func(); ```
This does not match the "no-closures" requirement. But I don't know of any way to do that except to use global variables. This seems quite clean though. What's the objection to closure variables? ``` var func = (function() { var calls = 0; var states = ["state1", "state2"]; return function() { var ...
29,066,399
How to implement func function: ``` func(); // console.log('state1'); func(); // console.log('state2'); func(); // console.log('state1'); func(); // console.log('state2'); //... ``` But without setting properties to func and variables in closures.
2015/03/15
[ "https://Stackoverflow.com/questions/29066399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/626347/" ]
Well, using global variables hasn't been denied, so I don't see a reason for this not to be a valid answer: ``` var func = function() { if (typeof state == 'undefined') { state = false; } state = !state; console.log(state ? 'state1' : 'state2'); }; ``` JSFiddle: <http://jsfiddle.net/zo94u90f/...
I find a trick: ``` func = (function* (){ while (true) { console.log('state1'); yield null; console.log('state2'); yield null; } })() func = func.next.bind(func); func(); func(); ```
464,331
I have very little knowledge about power draw / conversions etc. I would like to power a Kinect v2 Sensor from a USB Power bank. I saw the USB C and QC3.0 on this [powerbank](https://www.amazon.co.uk/gp/product/B073FJ6Z8D/ref=ppx_yo_dt_b_asin_title_o01_s01?ie=UTF8&psc=1) has between 9 and 12V output. I have read althou...
2019/10/24
[ "https://electronics.stackexchange.com/questions/464331", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/234767/" ]
> > has between 9 and 12V output > > > It's not that easy. To get power from that bank, you need to speak the USB-C PD protocol. Otherwise, you'd only be getting "normal" VUSB of 5V at low current capability. That's a pretty complicated protocol, and requires you to afterwards handle quite a bit of power, so that...
As my understanding power bank circuit uses a bi-directional buck-boost converter. When you connect for charging, it boosts the voltage to 12V and charge battery. When you connect mobile for charging, the circuit steps down the 12V into 5V. So you cannot draw 12V from power bank USB output. What you can do is, you ca...
464,331
I have very little knowledge about power draw / conversions etc. I would like to power a Kinect v2 Sensor from a USB Power bank. I saw the USB C and QC3.0 on this [powerbank](https://www.amazon.co.uk/gp/product/B073FJ6Z8D/ref=ppx_yo_dt_b_asin_title_o01_s01?ie=UTF8&psc=1) has between 9 and 12V output. I have read althou...
2019/10/24
[ "https://electronics.stackexchange.com/questions/464331", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/234767/" ]
> > has between 9 and 12V output > > > It's not that easy. To get power from that bank, you need to speak the USB-C PD protocol. Otherwise, you'd only be getting "normal" VUSB of 5V at low current capability. That's a pretty complicated protocol, and requires you to afterwards handle quite a bit of power, so that...
If the voltage needed is between 9V and 12V you could use an 11.1V RC car/plane battery, but the Kinect might need too much current and the battery would be low in a couple of hours.
464,331
I have very little knowledge about power draw / conversions etc. I would like to power a Kinect v2 Sensor from a USB Power bank. I saw the USB C and QC3.0 on this [powerbank](https://www.amazon.co.uk/gp/product/B073FJ6Z8D/ref=ppx_yo_dt_b_asin_title_o01_s01?ie=UTF8&psc=1) has between 9 and 12V output. I have read althou...
2019/10/24
[ "https://electronics.stackexchange.com/questions/464331", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/234767/" ]
If the voltage needed is between 9V and 12V you could use an 11.1V RC car/plane battery, but the Kinect might need too much current and the battery would be low in a couple of hours.
As my understanding power bank circuit uses a bi-directional buck-boost converter. When you connect for charging, it boosts the voltage to 12V and charge battery. When you connect mobile for charging, the circuit steps down the 12V into 5V. So you cannot draw 12V from power bank USB output. What you can do is, you ca...
28,530,209
How can I centrally align 2 columns taking up 1/3 of the width in bootstrap? I tried searching Google and have found solutions with 3 columns but I need 2. Thanks for your answers **HTML** ``` <div class="row circles"> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="img-circle"></div> ...
2015/02/15
[ "https://Stackoverflow.com/questions/28530209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You could offset your first column, using the `col-lg-offset-2` and `col-md-offset-2` classes: ``` <div class="row circles"> <div class="col-lg-4 col-md-4 col-lg-offset-2 col-md-offset-2 col-sm-6 col-xs-12"> <div class="img-circle"></div> <strong>Loren ipsum</strong> <div class="text">Og at profilen gir e...
I'm not sure what you want but in your CSS you could use the following: ``` .row.circles {margin: 0px auto;} ``` Would that work?
10,958,191
Im tring to send a simple email with this code using google app engine. But nothing happens, is there something i have to configure in order to use the mail api? This runs on localhost. I am using gmail as mail host. ``` String host = "smtp.google.com"; String to = "example@yahoo.fr"; String from = "example@gma...
2012/06/09
[ "https://Stackoverflow.com/questions/10958191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1401253/" ]
When running the AppEngine development server locally, anything sent via the Mail service will not actually be sent - it will just be logged to the console See [here](https://developers.google.com/appengine/docs/java/mail/overview#Development_Server) > > When an application running in the development server calls th...
The sender should be your own Gmail email address instead of `example@gmail.com` Reason is because the SMTP server needs to authenticate you.
10,958,191
Im tring to send a simple email with this code using google app engine. But nothing happens, is there something i have to configure in order to use the mail api? This runs on localhost. I am using gmail as mail host. ``` String host = "smtp.google.com"; String to = "example@yahoo.fr"; String from = "example@gma...
2012/06/09
[ "https://Stackoverflow.com/questions/10958191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1401253/" ]
The sender should be your own Gmail email address instead of `example@gmail.com` Reason is because the SMTP server needs to authenticate you.
Other than email not working on localhost or due to the sender email not being the authenticated one, I have experienced that email does not work even when the version is not the default one. I could not find this documented anywhere. For example: `nondefaultversion-dot-myapp.appspot.com` (email does not work, no erro...
10,958,191
Im tring to send a simple email with this code using google app engine. But nothing happens, is there something i have to configure in order to use the mail api? This runs on localhost. I am using gmail as mail host. ``` String host = "smtp.google.com"; String to = "example@yahoo.fr"; String from = "example@gma...
2012/06/09
[ "https://Stackoverflow.com/questions/10958191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1401253/" ]
When running the AppEngine development server locally, anything sent via the Mail service will not actually be sent - it will just be logged to the console See [here](https://developers.google.com/appengine/docs/java/mail/overview#Development_Server) > > When an application running in the development server calls th...
Other than email not working on localhost or due to the sender email not being the authenticated one, I have experienced that email does not work even when the version is not the default one. I could not find this documented anywhere. For example: `nondefaultversion-dot-myapp.appspot.com` (email does not work, no erro...
10,958,191
Im tring to send a simple email with this code using google app engine. But nothing happens, is there something i have to configure in order to use the mail api? This runs on localhost. I am using gmail as mail host. ``` String host = "smtp.google.com"; String to = "example@yahoo.fr"; String from = "example@gma...
2012/06/09
[ "https://Stackoverflow.com/questions/10958191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1401253/" ]
When running the AppEngine development server locally, anything sent via the Mail service will not actually be sent - it will just be logged to the console See [here](https://developers.google.com/appengine/docs/java/mail/overview#Development_Server) > > When an application running in the development server calls th...
Apparently, GAE doesn't allow the use of the admin accounts any more. you need to use the service account: `project-id@appspot.gserviceaccount.com` My previous projects still work with admin accounts, but the recently created projects just don't allow me to use any of the admin accounts.
10,958,191
Im tring to send a simple email with this code using google app engine. But nothing happens, is there something i have to configure in order to use the mail api? This runs on localhost. I am using gmail as mail host. ``` String host = "smtp.google.com"; String to = "example@yahoo.fr"; String from = "example@gma...
2012/06/09
[ "https://Stackoverflow.com/questions/10958191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1401253/" ]
Apparently, GAE doesn't allow the use of the admin accounts any more. you need to use the service account: `project-id@appspot.gserviceaccount.com` My previous projects still work with admin accounts, but the recently created projects just don't allow me to use any of the admin accounts.
Other than email not working on localhost or due to the sender email not being the authenticated one, I have experienced that email does not work even when the version is not the default one. I could not find this documented anywhere. For example: `nondefaultversion-dot-myapp.appspot.com` (email does not work, no erro...
19,790,642
Is it possible to pass an hidden field value from Razor View to Controller inside or tag? As the field is **hidden**, it is really a problem to pass its value to the Controller. On the other hand I think the only way to pass this hidden field is using input field inside hyperlink. How to create a code like below? ``` ...
2013/11/05
[ "https://Stackoverflow.com/questions/19790642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836018/" ]
`<input>`, `<textarea>`, `<button>` and `<select>` element values are only passed during a form submission. Moreover, they are only passed on when assigned a `name` attribute. Clicking an anchor will not pass these values (unless you interject with some JavaScript and append it to the URL). The easiest method is to tu...
Based on discussion below, try this. ``` @Ajax.ActionLink("Delete", "Delete", new { applicantid = item.applicantid }, new AjaxOptions { Confirm = "Delete?", HttpMethod = "POST", }, new { @cla...
54,796,664
Hi i have a requirement to check on passwords . the password should not contain no more than 2 repetitive character. my password must contain atleast upper case, lower case, number and special characters #?!@$%^&\*- so if i have a password like for example Password123$ it is valid Passsword123$ it is invalid Passssw...
2019/02/20
[ "https://Stackoverflow.com/questions/54796664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10985103/" ]
``` import { Button } from "@material-ui/core"; ``` Try this.
Install material ui with npm or yarn. This should be done from your project's main directory. ``` // with npm npm install @material-ui/core // with yarn yarn add @material-ui/core ``` Then, you can use `import Button from '@material-ui/core/Button';` at the top of your file.
54,796,664
Hi i have a requirement to check on passwords . the password should not contain no more than 2 repetitive character. my password must contain atleast upper case, lower case, number and special characters #?!@$%^&\*- so if i have a password like for example Password123$ it is valid Passsword123$ it is invalid Passssw...
2019/02/20
[ "https://Stackoverflow.com/questions/54796664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10985103/" ]
``` import { Button } from "@material-ui/core"; ``` Try this.
Since this post is quite recent, I am pretty sure you followed the steps in [material-ui getting started](https://material-ui.com/getting-started/installation/). What you should do is check the version of material-ui core installed in your project. Within your package.json file, check your material-ui core version, it...
12,047,961
Suppose there is an array of intergers: ``` A[]={2, 2, 9, 8, 5, 7, 0, 6} ``` and a stencil: ``` B[]={1, 0, 0, 1, 1, 1, 0, 1} ``` My question is how could we rearrange A[] according to B[] such that if B[i]==1, B[j]==0, then A[i] will be guaranteed to precede A[j] in the new array, which should look like: ``` C[]...
2012/08/21
[ "https://Stackoverflow.com/questions/12047961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1587802/" ]
How about using **value.Address.City** and **value.Address.Street**?? The most common way to access JSON data is through dot notation. This is simply the object name followed by a period and then followed by the name/property you would like to access. <http://www.hunlock.com/blogs/Mastering_JSON_%28_JavaScript_Object_N...
I don't know if this is the most efficient way of doing this but I think it does what you want. Assumptions: Data is an array, with each array element being an object (hash). Tested in Chrome on Windows only. ``` <html> <head> <script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script> ...
8,226
I need to completely remove the indicator, no flags, no abbr. nothing! I was able to do it in 10.04 using a gconf key that has no scheme and I heard that a proper scheme will be available in 10.10 but I can't find anything.
2010/10/19
[ "https://askubuntu.com/questions/8226", "https://askubuntu.com", "https://askubuntu.com/users/4384/" ]
Press Alt+F2 and enter [`gconf-editor`](https://askubuntu.com/questions/17249/how-do-i-use-the-gconf-editor) Now navigate to apps-->gnome\_settings\_daemon-->plugins-->keyboard and uncheck active Restart.
By the way, if you're removing it because of the big ugly (redundant) image in the 10.10 keyboard indicator, I've got a solution to that. I created a set of SVG flag images. If you install them and activate "show flags" in your g-conf editor then the text and ugly image both disappear. In their place you just have the ...
8,226
I need to completely remove the indicator, no flags, no abbr. nothing! I was able to do it in 10.04 using a gconf key that has no scheme and I heard that a proper scheme will be available in 10.10 but I can't find anything.
2010/10/19
[ "https://askubuntu.com/questions/8226", "https://askubuntu.com", "https://askubuntu.com/users/4384/" ]
Press Alt+F2 and enter [`gconf-editor`](https://askubuntu.com/questions/17249/how-do-i-use-the-gconf-editor) Now navigate to apps-->gnome\_settings\_daemon-->plugins-->keyboard and uncheck active Restart.
I have completely same task, and i have just solve it for myself by using icons with the sizes of 1px \* 1px, this is not completely removal, but it's best solution i could found. Steps: 1) download icons (for example from [here](http://gnome-look.org/content/show.php/Language+Flags+for+Faenza+and+Elementary?conten...
8,226
I need to completely remove the indicator, no flags, no abbr. nothing! I was able to do it in 10.04 using a gconf key that has no scheme and I heard that a proper scheme will be available in 10.10 but I can't find anything.
2010/10/19
[ "https://askubuntu.com/questions/8226", "https://askubuntu.com", "https://askubuntu.com/users/4384/" ]
This is a [known bug](https://bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/631989) the key I was talking about is: `gconftool-2 -s /desktop/gnome/peripherals/keyboard/general/disable_indicator -t bool true` For pre-maverick only. Thank you all for the input.
By the way, if you're removing it because of the big ugly (redundant) image in the 10.10 keyboard indicator, I've got a solution to that. I created a set of SVG flag images. If you install them and activate "show flags" in your g-conf editor then the text and ugly image both disappear. In their place you just have the ...
8,226
I need to completely remove the indicator, no flags, no abbr. nothing! I was able to do it in 10.04 using a gconf key that has no scheme and I heard that a proper scheme will be available in 10.10 but I can't find anything.
2010/10/19
[ "https://askubuntu.com/questions/8226", "https://askubuntu.com", "https://askubuntu.com/users/4384/" ]
By the way, if you're removing it because of the big ugly (redundant) image in the 10.10 keyboard indicator, I've got a solution to that. I created a set of SVG flag images. If you install them and activate "show flags" in your g-conf editor then the text and ugly image both disappear. In their place you just have the ...
I have completely same task, and i have just solve it for myself by using icons with the sizes of 1px \* 1px, this is not completely removal, but it's best solution i could found. Steps: 1) download icons (for example from [here](http://gnome-look.org/content/show.php/Language+Flags+for+Faenza+and+Elementary?conten...
8,226
I need to completely remove the indicator, no flags, no abbr. nothing! I was able to do it in 10.04 using a gconf key that has no scheme and I heard that a proper scheme will be available in 10.10 but I can't find anything.
2010/10/19
[ "https://askubuntu.com/questions/8226", "https://askubuntu.com", "https://askubuntu.com/users/4384/" ]
This is a [known bug](https://bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/631989) the key I was talking about is: `gconftool-2 -s /desktop/gnome/peripherals/keyboard/general/disable_indicator -t bool true` For pre-maverick only. Thank you all for the input.
I have completely same task, and i have just solve it for myself by using icons with the sizes of 1px \* 1px, this is not completely removal, but it's best solution i could found. Steps: 1) download icons (for example from [here](http://gnome-look.org/content/show.php/Language+Flags+for+Faenza+and+Elementary?conten...
38,917,231
For some time now I have been experiencing problems with the Excel files I work With. I am using MS Office 2016 version on Windows 10. Excel 2016 is fitted with a new functionality called usually Power Query. It's an interface for pulling the data directly from the database (SQL Server). The data from the DB are used t...
2016/08/12
[ "https://Stackoverflow.com/questions/38917231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6709212/" ]
I ended up unzipping the file and checking the contents manually for anything suspicious. I found two huge files in the `xl/drawings` directory (`vmlDrawing1.vml` and `vmlDrawing2.vml` - being the exact copy of `vmlDrawing1.vml`). The files contained an XML description of 65536 **identical** objects (IDs were different...
If you go to Data | New Query | Query Options, and then go to Current Workbook | Data Load, is there a section about Background Data? If so, uncheck the "Allow data preview to download in the background" checkbox, save the document, and see if Excel starts up more quickly.
1,137,074
Let's say I have a text file with the content: ``` foo bar whatever something I don't know bar2 whatever ``` And, as an output from doing `grep whatever myfile.txt` (and/or `sed` and/or `awk`), I would like to have: ``` foo something I don't know ``` I've tried using option `-B 2` but that outputs both `foo` and...
2016/10/20
[ "https://superuser.com/questions/1137074", "https://superuser.com", "https://superuser.com/users/582975/" ]
Not grep, but should work: > > awk '/grep\_string/ {print a} {a=b;b=$0}' file > > >
So here's my solution as I couldn't find any way of doing it: As I was being returned with blocks of content, say: ``` foo bar whatever -- foo2 bar2 whatever -- ``` and so on, I used grep's separator and got the very next line like so and then removed them: ``` grep -B2 whatever myfile.txt | grep -v whatever | gr...
275,444
Consider the following plot: ``` CDFforPoisson[u_] = x /. Solve[Exp[-x/0.01] == u, x][[1]]; DistrData = CDFforPoisson@RandomReal[{0, 1}, 10^6]; Histogram[{DistrData}, 100, "ProbabilityDensity", Frame -> True, ChartStyle -> {Opacity[.25, Red], Opacity[.25, Blue], Opacity[.25, Darker@Green]}, FrameStyle -> Directi...
2022/11/01
[ "https://mathematica.stackexchange.com/questions/275444", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/41058/" ]
1. Using `PlotRangePadding`, space can be created around the histogram. 2. Using `LegendMarkerSize` for a `SwatchLegend`, the size of the legend can be changed. You can also use `Style` as has been suggested without altering your code much. --- ``` Histogram[{DistrData}, 100, "ProbabilityDensity" , Frame -> True , ...
I'm not understanding the use of the term "CDF" in the function `CDFforPoisson` as the equation being `Solve`d is related to the probability of a zero for a Poisson distribution and it doesn't need `Solve` in that `CDFforPoisson` could be written as ``` CDFforPoisson[u_]:=-Log[u]/100 ``` If `u` has a uniform distrib...
38,105,507
I noticed that if I iterate over a file that I opened, it is much faster to iterate over it without "read"-ing it. i.e. ``` l = open('file','r') for line in l: pass (or code) ``` is much faster than ``` l = open('file','r') for line in l.read() / l.readlines(): pass (or code) ``` The 2nd loop will tak...
2016/06/29
[ "https://Stackoverflow.com/questions/38105507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6296435/" ]
The short answer to your question is that each of these three methods of reading bits of a file have different use cases. As noted above, `f.read()` reads the file as an individual string, and so allows relatively easy file-wide manipulations, such as a file-wide regex search or substitution. `f.readline()` reads a si...
Hope this helps! <https://docs.python.org/2/tutorial/inputoutput.html#methods-of-file-objects> > > When size is omitted or negative, the entire contents of the file will be read and returned; it’s your problem if the file is twice as large as your machine’s memory > > > Sorry for all the edits! > > For reading...
38,105,507
I noticed that if I iterate over a file that I opened, it is much faster to iterate over it without "read"-ing it. i.e. ``` l = open('file','r') for line in l: pass (or code) ``` is much faster than ``` l = open('file','r') for line in l.read() / l.readlines(): pass (or code) ``` The 2nd loop will tak...
2016/06/29
[ "https://Stackoverflow.com/questions/38105507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6296435/" ]
Hope this helps! <https://docs.python.org/2/tutorial/inputoutput.html#methods-of-file-objects> > > When size is omitted or negative, the entire contents of the file will be read and returned; it’s your problem if the file is twice as large as your machine’s memory > > > Sorry for all the edits! > > For reading...
Note that `readline()` is not comparable to the case of reading all lines in for-loop since it reads line by line and there is an overhead which is pointed out by others already. I ran `timeit` on two identical snippts but one with for-loop and the other with `readlines()`. You can see my snippet below: ``` def test...
38,105,507
I noticed that if I iterate over a file that I opened, it is much faster to iterate over it without "read"-ing it. i.e. ``` l = open('file','r') for line in l: pass (or code) ``` is much faster than ``` l = open('file','r') for line in l.read() / l.readlines(): pass (or code) ``` The 2nd loop will tak...
2016/06/29
[ "https://Stackoverflow.com/questions/38105507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6296435/" ]
Hope this helps! <https://docs.python.org/2/tutorial/inputoutput.html#methods-of-file-objects> > > When size is omitted or negative, the entire contents of the file will be read and returned; it’s your problem if the file is twice as large as your machine’s memory > > > Sorry for all the edits! > > For reading...
`readlines()` is better than `for line in file` when you know that the data you are interested starts from, for example, 2nd line. You can simply write `readlines()[1:]`. Such use cases are when you have a tab/comma separated value file and the first line is a header (and you don't want to use additional module for ts...
38,105,507
I noticed that if I iterate over a file that I opened, it is much faster to iterate over it without "read"-ing it. i.e. ``` l = open('file','r') for line in l: pass (or code) ``` is much faster than ``` l = open('file','r') for line in l.read() / l.readlines(): pass (or code) ``` The 2nd loop will tak...
2016/06/29
[ "https://Stackoverflow.com/questions/38105507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6296435/" ]
Hope this helps! <https://docs.python.org/2/tutorial/inputoutput.html#methods-of-file-objects> > > When size is omitted or negative, the entire contents of the file will be read and returned; it’s your problem if the file is twice as large as your machine’s memory > > > Sorry for all the edits! > > For reading...
``` #The difference between file.read(), file.readline(), file.readlines() file = open('samplefile', 'r') single_string = file.read() #Reads all the elements of the file #into a single string(\n characters might be included) line = file.readline() #Reads the current line where...
38,105,507
I noticed that if I iterate over a file that I opened, it is much faster to iterate over it without "read"-ing it. i.e. ``` l = open('file','r') for line in l: pass (or code) ``` is much faster than ``` l = open('file','r') for line in l.read() / l.readlines(): pass (or code) ``` The 2nd loop will tak...
2016/06/29
[ "https://Stackoverflow.com/questions/38105507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6296435/" ]
The short answer to your question is that each of these three methods of reading bits of a file have different use cases. As noted above, `f.read()` reads the file as an individual string, and so allows relatively easy file-wide manipulations, such as a file-wide regex search or substitution. `f.readline()` reads a si...
Note that `readline()` is not comparable to the case of reading all lines in for-loop since it reads line by line and there is an overhead which is pointed out by others already. I ran `timeit` on two identical snippts but one with for-loop and the other with `readlines()`. You can see my snippet below: ``` def test...
38,105,507
I noticed that if I iterate over a file that I opened, it is much faster to iterate over it without "read"-ing it. i.e. ``` l = open('file','r') for line in l: pass (or code) ``` is much faster than ``` l = open('file','r') for line in l.read() / l.readlines(): pass (or code) ``` The 2nd loop will tak...
2016/06/29
[ "https://Stackoverflow.com/questions/38105507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6296435/" ]
The short answer to your question is that each of these three methods of reading bits of a file have different use cases. As noted above, `f.read()` reads the file as an individual string, and so allows relatively easy file-wide manipulations, such as a file-wide regex search or substitution. `f.readline()` reads a si...
`readlines()` is better than `for line in file` when you know that the data you are interested starts from, for example, 2nd line. You can simply write `readlines()[1:]`. Such use cases are when you have a tab/comma separated value file and the first line is a header (and you don't want to use additional module for ts...
38,105,507
I noticed that if I iterate over a file that I opened, it is much faster to iterate over it without "read"-ing it. i.e. ``` l = open('file','r') for line in l: pass (or code) ``` is much faster than ``` l = open('file','r') for line in l.read() / l.readlines(): pass (or code) ``` The 2nd loop will tak...
2016/06/29
[ "https://Stackoverflow.com/questions/38105507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6296435/" ]
The short answer to your question is that each of these three methods of reading bits of a file have different use cases. As noted above, `f.read()` reads the file as an individual string, and so allows relatively easy file-wide manipulations, such as a file-wide regex search or substitution. `f.readline()` reads a si...
``` #The difference between file.read(), file.readline(), file.readlines() file = open('samplefile', 'r') single_string = file.read() #Reads all the elements of the file #into a single string(\n characters might be included) line = file.readline() #Reads the current line where...
92,245
On December 22 2019, Ramanujan would have been 132 years old. In his memory here are two puzzles around 132. In the six vertices of each of these graphs place six positive integers that add up to 132, and such that two vertices are joined by an edge if, and only if, they have a common divisor greater than 1 (that is,...
2019/12/26
[ "https://puzzling.stackexchange.com/questions/92245", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/19026/" ]
For the first one, With A starting from the top, B and C in the second. > > A = 9, B = 15, C = 21, D = 10, E = 70, F = 7 > > > ``` A B C D E F ``` > > ![Spoiler Warning!](https://i.stack.imgur.com/o1puI.png) > > > For the second one with A, C, E in the top row > > A = 9, B = 21, C = 42, D...
On both figures, the numbers are shown on the vertices. [![triangles](https://i.stack.imgur.com/vDaTW.png)](https://i.stack.imgur.com/vDaTW.png)
2,634,657
I am wondering if there is a function I could use in the standard libary. Do I need another library (BTW, I am developing for unix).
2010/04/14
[ "https://Stackoverflow.com/questions/2634657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/302206/" ]
See the `scanf()` function in stdio.h. It takes a format specifier like `printf()` and pointers to the variables to store the user input in
You seems quite new to C so let me add a little something to Prasoon answer, which is quite correct and complete, but maybe hard to understand for a beginner. When using scanf( const char \* format, ... ); in his exemple, Prasoon use : ``` scanf("%d",&n); ``` When using this, the "%d" indicate you're going to read ...
2,634,657
I am wondering if there is a function I could use in the standard libary. Do I need another library (BTW, I am developing for unix).
2010/04/14
[ "https://Stackoverflow.com/questions/2634657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/302206/" ]
See the `scanf()` function in stdio.h. It takes a format specifier like `printf()` and pointers to the variables to store the user input in
'Tis interesting - two answers so far both suggest `scanf()`; I wouldn't. When everything goes right, `scanf()` is OK. When things go wrong, recovery tends to be hard. I would normally use `fgets()` to read the user information for one line into a buffer (character array) first. I would then use `sscanf()` to collect...
2,634,657
I am wondering if there is a function I could use in the standard libary. Do I need another library (BTW, I am developing for unix).
2010/04/14
[ "https://Stackoverflow.com/questions/2634657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/302206/" ]
Use `scanf()` Format: `int scanf ( const char * format, ... );` `Read formatted data from stdin. Reads data from stdin and stores them according to the parameter format into the locations pointed by the additional arguments. The additional arguments should point to already allocated objects of the type specified by ...
You seems quite new to C so let me add a little something to Prasoon answer, which is quite correct and complete, but maybe hard to understand for a beginner. When using scanf( const char \* format, ... ); in his exemple, Prasoon use : ``` scanf("%d",&n); ``` When using this, the "%d" indicate you're going to read ...