qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
51,915,320
`var string = "3y4jd424jfm` Ideally, I'd want it to be `["3","y","4","j","d","4","24","j","f","m"]` but when I split: `string.split("")`, the `2` and the `4` in `24` are separated. How can I account for double digits? Edit: Here is the question I was trying to solve from a coding practice: *Using the JavaScript lan...
2018/08/19
[ "https://Stackoverflow.com/questions/51915320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10245232/" ]
Use regex for number extract then split for char as following: ``` var regex = /\d+/g; var string = "3y4jd424jfm"; var numbers = string.match(regex); var chars = string.replace(/\d+/g, "").split(""); var parts = numbers.concat(chars); console.log(parts); ```
Starting from this example `7r5gg812`, the answer is true because there's a couple of even numbers `8` and `12` next to each other. A possible solution is to iterate over the string with a counter that is incremented when you see an even digit, reset to 0 when it's not a digit. Odd digits are simply ignored: ``` func...
51,915,320
`var string = "3y4jd424jfm` Ideally, I'd want it to be `["3","y","4","j","d","4","24","j","f","m"]` but when I split: `string.split("")`, the `2` and the `4` in `24` are separated. How can I account for double digits? Edit: Here is the question I was trying to solve from a coding practice: *Using the JavaScript lan...
2018/08/19
[ "https://Stackoverflow.com/questions/51915320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10245232/" ]
You could take a staged approach by * getting only numbers of the string in an array * filer by length of the string, * check if two of the digits are even ```js function even(n) { return !(n % 2); } function checkEvenPair(string) { return string .match(/\d+/g) .filter(s => s.length > 1...
Use regex for number extract then split for char as following: ``` var regex = /\d+/g; var string = "3y4jd424jfm"; var numbers = string.match(regex); var chars = string.replace(/\d+/g, "").split(""); var parts = numbers.concat(chars); console.log(parts); ```
51,915,320
`var string = "3y4jd424jfm` Ideally, I'd want it to be `["3","y","4","j","d","4","24","j","f","m"]` but when I split: `string.split("")`, the `2` and the `4` in `24` are separated. How can I account for double digits? Edit: Here is the question I was trying to solve from a coding practice: *Using the JavaScript lan...
2018/08/19
[ "https://Stackoverflow.com/questions/51915320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10245232/" ]
Use regex for number extract then split for char as following: ``` var regex = /\d+/g; var string = "3y4jd424jfm"; var numbers = string.match(regex); var chars = string.replace(/\d+/g, "").split(""); var parts = numbers.concat(chars); console.log(parts); ```
You can use `RegExp` for that, you don't need to check if two numbers are even, you just need to check two constitutive chars (which is numbers) are even. so for `1234` you don't have to check `12` and `34` in that case the question could have been more complicated (what will be solved here). you just need to check [`1...
51,915,320
`var string = "3y4jd424jfm` Ideally, I'd want it to be `["3","y","4","j","d","4","24","j","f","m"]` but when I split: `string.split("")`, the `2` and the `4` in `24` are separated. How can I account for double digits? Edit: Here is the question I was trying to solve from a coding practice: *Using the JavaScript lan...
2018/08/19
[ "https://Stackoverflow.com/questions/51915320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10245232/" ]
You could take a staged approach by * getting only numbers of the string in an array * filer by length of the string, * check if two of the digits are even ```js function even(n) { return !(n % 2); } function checkEvenPair(string) { return string .match(/\d+/g) .filter(s => s.length > 1...
Starting from this example `7r5gg812`, the answer is true because there's a couple of even numbers `8` and `12` next to each other. A possible solution is to iterate over the string with a counter that is incremented when you see an even digit, reset to 0 when it's not a digit. Odd digits are simply ignored: ``` func...
51,915,320
`var string = "3y4jd424jfm` Ideally, I'd want it to be `["3","y","4","j","d","4","24","j","f","m"]` but when I split: `string.split("")`, the `2` and the `4` in `24` are separated. How can I account for double digits? Edit: Here is the question I was trying to solve from a coding practice: *Using the JavaScript lan...
2018/08/19
[ "https://Stackoverflow.com/questions/51915320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10245232/" ]
You could take a staged approach by * getting only numbers of the string in an array * filer by length of the string, * check if two of the digits are even ```js function even(n) { return !(n % 2); } function checkEvenPair(string) { return string .match(/\d+/g) .filter(s => s.length > 1...
You can use `RegExp` for that, you don't need to check if two numbers are even, you just need to check two constitutive chars (which is numbers) are even. so for `1234` you don't have to check `12` and `34` in that case the question could have been more complicated (what will be solved here). you just need to check [`1...
968,806
How can xkb or some other tool be used to permanently bind Caps Lock to `ctrl`+`b` while in terminal? (This is to make `Caps Lock` the default prefix key for tmux. It could also be mapped to a specific key if that's too difficult, e.g. a function key, which could then be made the tmux prefix instead.)
2017/10/24
[ "https://askubuntu.com/questions/968806", "https://askubuntu.com", "https://askubuntu.com/users/40428/" ]
XKB will be appropriate for Xwindows or Wayland GUIs. It will not affect virtual consoles, but GUI terminal emulators will be fine. For XKB background I'll point you to [some (overview, system vs user)](https://askubuntu.com/a/896297/669043) .. [other (custom options)](https://superuser.com/a/1168603/685512) .. [answer...
I upvoted @quixotic, but the method is too difficult, and you need to do it again and again. Because: > > Your changes will be overwritten whenever the xkb-data package is > updated. > > > Finally, savior came out, simply: 1. Install `input-remapper` 2. Click, Click! Done! <https://github.com/sezanzeb/input-rem...
5,216,370
So my problem is simple, the data i am initalizing in my constructor is not saving at all. basically I have pin pointed to this one point. I have a constructor in a class ``` strSet::strSet(std::string s){ std::vector<std::string> strVector; strVector.push_back(s); } ``` and in my main file i have ``` els...
2011/03/07
[ "https://Stackoverflow.com/questions/5216370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647682/" ]
``` strSet::strSet(std::string s){ std::vector<std::string> strVector; //line 1 strVector.push_back(s); //line 2 } ``` This is your constructor, and here you're storing the value in the local vector which gets destroyed on returning from the constructor. How do you expect your data to be saved in st...
``` std::vector<std::string> strVector; strVector.push_back(s); ``` That creates a new local vector of strings in your constructor and adds a string to it. When the constructor exits, it will destroy your vector. If you want strVector to last longer than the constructor, make it a class member.
5,216,370
So my problem is simple, the data i am initalizing in my constructor is not saving at all. basically I have pin pointed to this one point. I have a constructor in a class ``` strSet::strSet(std::string s){ std::vector<std::string> strVector; strVector.push_back(s); } ``` and in my main file i have ``` els...
2011/03/07
[ "https://Stackoverflow.com/questions/5216370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647682/" ]
looks, like your class body already has strVector, so you was declaring it again in constructor, which was wrong, because compiler referenced your new local strVector and not class strVector. you need to change constructor to: ``` strSet::strSet(std::string s){ strVector.push_back(s); } ```
``` std::vector<std::string> strVector; strVector.push_back(s); ``` That creates a new local vector of strings in your constructor and adds a string to it. When the constructor exits, it will destroy your vector. If you want strVector to last longer than the constructor, make it a class member.
5,216,370
So my problem is simple, the data i am initalizing in my constructor is not saving at all. basically I have pin pointed to this one point. I have a constructor in a class ``` strSet::strSet(std::string s){ std::vector<std::string> strVector; strVector.push_back(s); } ``` and in my main file i have ``` els...
2011/03/07
[ "https://Stackoverflow.com/questions/5216370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647682/" ]
Tip: GCC has a compiler warning for this. Use -Wshadow to catch such problems in the future.
``` std::vector<std::string> strVector; strVector.push_back(s); ``` That creates a new local vector of strings in your constructor and adds a string to it. When the constructor exits, it will destroy your vector. If you want strVector to last longer than the constructor, make it a class member.
5,216,370
So my problem is simple, the data i am initalizing in my constructor is not saving at all. basically I have pin pointed to this one point. I have a constructor in a class ``` strSet::strSet(std::string s){ std::vector<std::string> strVector; strVector.push_back(s); } ``` and in my main file i have ``` els...
2011/03/07
[ "https://Stackoverflow.com/questions/5216370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647682/" ]
``` strSet::strSet(std::string s){ std::vector<std::string> strVector; //line 1 strVector.push_back(s); //line 2 } ``` This is your constructor, and here you're storing the value in the local vector which gets destroyed on returning from the constructor. How do you expect your data to be saved in st...
You're initializing a stack local variable in your `strSet::strSet` constructor. When you are returning from your constructor, all stack local variables are destroyed. The way to fix this would be to declare the `strVector` variable as a class member variable. An example: ``` class strSet { public: strSet(std::str...
5,216,370
So my problem is simple, the data i am initalizing in my constructor is not saving at all. basically I have pin pointed to this one point. I have a constructor in a class ``` strSet::strSet(std::string s){ std::vector<std::string> strVector; strVector.push_back(s); } ``` and in my main file i have ``` els...
2011/03/07
[ "https://Stackoverflow.com/questions/5216370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647682/" ]
``` strSet::strSet(std::string s){ std::vector<std::string> strVector; //line 1 strVector.push_back(s); //line 2 } ``` This is your constructor, and here you're storing the value in the local vector which gets destroyed on returning from the constructor. How do you expect your data to be saved in st...
Tip: GCC has a compiler warning for this. Use -Wshadow to catch such problems in the future.
5,216,370
So my problem is simple, the data i am initalizing in my constructor is not saving at all. basically I have pin pointed to this one point. I have a constructor in a class ``` strSet::strSet(std::string s){ std::vector<std::string> strVector; strVector.push_back(s); } ``` and in my main file i have ``` els...
2011/03/07
[ "https://Stackoverflow.com/questions/5216370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647682/" ]
looks, like your class body already has strVector, so you was declaring it again in constructor, which was wrong, because compiler referenced your new local strVector and not class strVector. you need to change constructor to: ``` strSet::strSet(std::string s){ strVector.push_back(s); } ```
You're initializing a stack local variable in your `strSet::strSet` constructor. When you are returning from your constructor, all stack local variables are destroyed. The way to fix this would be to declare the `strVector` variable as a class member variable. An example: ``` class strSet { public: strSet(std::str...
5,216,370
So my problem is simple, the data i am initalizing in my constructor is not saving at all. basically I have pin pointed to this one point. I have a constructor in a class ``` strSet::strSet(std::string s){ std::vector<std::string> strVector; strVector.push_back(s); } ``` and in my main file i have ``` els...
2011/03/07
[ "https://Stackoverflow.com/questions/5216370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647682/" ]
Tip: GCC has a compiler warning for this. Use -Wshadow to catch such problems in the future.
You're initializing a stack local variable in your `strSet::strSet` constructor. When you are returning from your constructor, all stack local variables are destroyed. The way to fix this would be to declare the `strVector` variable as a class member variable. An example: ``` class strSet { public: strSet(std::str...
5,216,370
So my problem is simple, the data i am initalizing in my constructor is not saving at all. basically I have pin pointed to this one point. I have a constructor in a class ``` strSet::strSet(std::string s){ std::vector<std::string> strVector; strVector.push_back(s); } ``` and in my main file i have ``` els...
2011/03/07
[ "https://Stackoverflow.com/questions/5216370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647682/" ]
looks, like your class body already has strVector, so you was declaring it again in constructor, which was wrong, because compiler referenced your new local strVector and not class strVector. you need to change constructor to: ``` strSet::strSet(std::string s){ strVector.push_back(s); } ```
Tip: GCC has a compiler warning for this. Use -Wshadow to catch such problems in the future.
37,414,994
I am looking for a way to stop a higher-level function after evaluating part of its input sequence. Consider a situation when you look for the first index in a sequence that satisfies a certain condition. For example, let's say we are looking for the first position in an array `a` of `Int`s where the sum of two consec...
2016/05/24
[ "https://Stackoverflow.com/questions/37414994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/335858/" ]
The issue with your code lies in `readingTheFile()`: This is the return-statement: ``` return null; ``` Which - Captain Obvious here - returns `null`. Thus `secret` is `null` and the `IllegalArgumentException` is thrown. If you absolutely want to stick to the `BufferedReader`-solution, this should solve the proble...
Change your Class "File" like below, this is how it will provide you the desire mechanism. I've modified the same class you have written. ``` public class File { public byte[] readingTheFile() throws IOException { java.io.File file = new java.io.File("/Users/user/Desktop/altiy.pdf"); /*FileReader in = new Fi...
45,714,606
Usually the question is for the main thread to wait for child thread which I can use `await` on the `Task`. But I have a situation where the child thread must wait for some method in the main thread to complete before continuing. How to make this communication possible? ``` public void MainThread() { Task t = Tas...
2017/08/16
[ "https://Stackoverflow.com/questions/45714606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/862147/" ]
You're looking for a "signal". Since the child is asynchronous and the signal is used only one time, a `TaskCompletionSource<T>` would work nicely: ``` public void MainThread() { var tcs = new TaskCompletionSource<object>(); // Create the signal Task t = Task.Run(() => ChildThread(tcs.Task)); // Pass the "receiver...
I would imagine something like this if WorkB was a Task: ``` public void MainThread() { Task workB = WorkB(); ChildThread(workB); // you don't need to use Task.Run here, the task is ran automatically WorkA(); WorkC(); } public async Task ChildThread(Task otherTaskToWait) { WorkD(); await other...
65,477,564
In `opentelemetery-api` version `0.8.0`, we used to set a new `SpanContext` in current `Context` via following code: ```scala TracingContextUtils.currentContextWith(DefaultSpan.create(newSpanCtx)) ``` However, in version `0.13.1`, both - `TracingContextUtils` and `DefaultSpan` are removed. Then how can I set a new `...
2020/12/28
[ "https://Stackoverflow.com/questions/65477564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3620633/" ]
From [opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) version [0.10.0 release notes](https://github.com/open-telemetry/opentelemetry-java/releases/tag/v0.10.0): > > * `TracingContextUtils` and `BaggageUtils` were removed from the public API. Instead, use the appropriate static methods on the...
How about using the `scope` and calling the `makeCurrent` method? ```java Span span = tracer.spanBuilder("my span").startSpan(); // put the span into the current Context try (Scope scope = span.makeCurrent()) { // your use case ... } catch (Throwable t) { span.setStatus(StatusCode.ERROR, "Change it to your...
37,651,258
I try to make WebApp using php & R . this is my php code: ``` exec("/usr/bin/Rscript /home/bella/Downloads/htdocs/laut/script.r $N"); $nocache = rand(); echo("<img src='tmp.png?$nocache' />"); ``` And this is my script.r code: ``` slices <- c(10, 12,4, 16, 8) lbls <- c("US", "UK", "Australia", "Germany", "France")...
2016/06/06
[ "https://Stackoverflow.com/questions/37651258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6428913/" ]
> > Note: If you want to convert a callback API to promises see [this question](https://stackoverflow.com/questions/22519784/how-do-i-convert-an-existing-callback-api-to-promises). > > > Let's start with something that should be said from the get go. An executor is *not* required in order to design promises. It is...
You need to pass a function to the `Promise` constructor ([more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)), which will get called to provide the `resolve` and `reject` functions: ``` function getDetails (someHash) { var url = "http://somewebsite.com/" + someHash;...
444,871
Using a stand alone Windows Server 2012 Standard edition (no Active Directory), I succeded to add a new rule to allow sql server connection, by entering the .exe file When I edited the rule property to specify the port number, text zones for ports are greyed and no way to write in them. Is there a new feature in Win...
2012/11/02
[ "https://serverfault.com/questions/444871", "https://serverfault.com", "https://serverfault.com/users/140342/" ]
setfacl on linux has the `-d` and `-k` options for manipulating default permissions which are probably what you are looking for (see man for more info).
It is easy to recursively set simple UNIX permissions at upon demand of an appropriately authorized user, the permissions of directories and files. It is not possible to automatically impose this. You could tell users to use the set the umask of 0002, and that helps to make new files at 0775 (depending on the applicat...
444,871
Using a stand alone Windows Server 2012 Standard edition (no Active Directory), I succeded to add a new rule to allow sql server connection, by entering the .exe file When I edited the rule property to specify the port number, text zones for ports are greyed and no way to write in them. Is there a new feature in Win...
2012/11/02
[ "https://serverfault.com/questions/444871", "https://serverfault.com", "https://serverfault.com/users/140342/" ]
I actually found something that so far does what I asked for, sharing here so anyone who runs into this issue can try out this solution: ``` sudo setfacl -Rdm g:groupnamehere:rwx /base/path/members/ sudo setfacl -Rm g:groupnamehere:rwx /base/path/members/ ``` **R** is recursive, which means everything under that dir...
It is easy to recursively set simple UNIX permissions at upon demand of an appropriately authorized user, the permissions of directories and files. It is not possible to automatically impose this. You could tell users to use the set the umask of 0002, and that helps to make new files at 0775 (depending on the applicat...
444,871
Using a stand alone Windows Server 2012 Standard edition (no Active Directory), I succeded to add a new rule to allow sql server connection, by entering the .exe file When I edited the rule property to specify the port number, text zones for ports are greyed and no way to write in them. Is there a new feature in Win...
2012/11/02
[ "https://serverfault.com/questions/444871", "https://serverfault.com", "https://serverfault.com/users/140342/" ]
To go with your accepted answer ... You can combine those commands together as: ``` sudo setfacl -Rm d:g:groupnamehere:rwx,g:groupnamehere:rwx /base/path/members/ ```
It is easy to recursively set simple UNIX permissions at upon demand of an appropriately authorized user, the permissions of directories and files. It is not possible to automatically impose this. You could tell users to use the set the umask of 0002, and that helps to make new files at 0775 (depending on the applicat...
444,871
Using a stand alone Windows Server 2012 Standard edition (no Active Directory), I succeded to add a new rule to allow sql server connection, by entering the .exe file When I edited the rule property to specify the port number, text zones for ports are greyed and no way to write in them. Is there a new feature in Win...
2012/11/02
[ "https://serverfault.com/questions/444871", "https://serverfault.com", "https://serverfault.com/users/140342/" ]
I actually found something that so far does what I asked for, sharing here so anyone who runs into this issue can try out this solution: ``` sudo setfacl -Rdm g:groupnamehere:rwx /base/path/members/ sudo setfacl -Rm g:groupnamehere:rwx /base/path/members/ ``` **R** is recursive, which means everything under that dir...
setfacl on linux has the `-d` and `-k` options for manipulating default permissions which are probably what you are looking for (see man for more info).
444,871
Using a stand alone Windows Server 2012 Standard edition (no Active Directory), I succeded to add a new rule to allow sql server connection, by entering the .exe file When I edited the rule property to specify the port number, text zones for ports are greyed and no way to write in them. Is there a new feature in Win...
2012/11/02
[ "https://serverfault.com/questions/444871", "https://serverfault.com", "https://serverfault.com/users/140342/" ]
To go with your accepted answer ... You can combine those commands together as: ``` sudo setfacl -Rm d:g:groupnamehere:rwx,g:groupnamehere:rwx /base/path/members/ ```
setfacl on linux has the `-d` and `-k` options for manipulating default permissions which are probably what you are looking for (see man for more info).
444,871
Using a stand alone Windows Server 2012 Standard edition (no Active Directory), I succeded to add a new rule to allow sql server connection, by entering the .exe file When I edited the rule property to specify the port number, text zones for ports are greyed and no way to write in them. Is there a new feature in Win...
2012/11/02
[ "https://serverfault.com/questions/444871", "https://serverfault.com", "https://serverfault.com/users/140342/" ]
I actually found something that so far does what I asked for, sharing here so anyone who runs into this issue can try out this solution: ``` sudo setfacl -Rdm g:groupnamehere:rwx /base/path/members/ sudo setfacl -Rm g:groupnamehere:rwx /base/path/members/ ``` **R** is recursive, which means everything under that dir...
To go with your accepted answer ... You can combine those commands together as: ``` sudo setfacl -Rm d:g:groupnamehere:rwx,g:groupnamehere:rwx /base/path/members/ ```
20,749,660
Using a Perl regex, I need to match a series of eight digits, for example, 12345678, but only if they are not all the same. 00000000 and 99999999 are typical patterns that should not match. I'm trying to weed out obviously invalid values from existing database records. I've got this: ``` my ($match) = /(\d{8})/; ```...
2013/12/23
[ "https://Stackoverflow.com/questions/20749660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2321898/" ]
How about: ``` ^(\d)(?!\1{7})\d{7}$ ``` This will match 8 digit number that haven't 8 same digit. **Sample code:** ``` my $re = qr/^(\d)(?!\1{7})\d{7}$/; while(<DATA>) { chomp; say (/$re/ ? "OK : $_" : "KO : $_"); } __DATA__ 12345678 12345123 123456 11111111 ``` **Output:** ``` OK : 12345678 OK : 12345...
> > This answer is **based** on the title of the question: *match **n** digits, but only if they are not all the same*. > > > --- So I've come with the following expression: ``` (\d)\1+\b(*SKIP)(*FAIL)|\d+ ``` What does this mean ? ``` (\d) # Match a digit and put it in group 1 \1+ ...
20,749,660
Using a Perl regex, I need to match a series of eight digits, for example, 12345678, but only if they are not all the same. 00000000 and 99999999 are typical patterns that should not match. I'm trying to weed out obviously invalid values from existing database records. I've got this: ``` my ($match) = /(\d{8})/; ```...
2013/12/23
[ "https://Stackoverflow.com/questions/20749660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2321898/" ]
How about: ``` ^(\d)(?!\1{7})\d{7}$ ``` This will match 8 digit number that haven't 8 same digit. **Sample code:** ``` my $re = qr/^(\d)(?!\1{7})\d{7}$/; while(<DATA>) { chomp; say (/$re/ ? "OK : $_" : "KO : $_"); } __DATA__ 12345678 12345123 123456 11111111 ``` **Output:** ``` OK : 12345678 OK : 12345...
``` my $number = "99999999"; # look for first digit, capture, print "ok\n" if $number =~ /(\d)\1{7}/; # use \1{7} to determine 7 matches of captured digit ```
20,749,660
Using a Perl regex, I need to match a series of eight digits, for example, 12345678, but only if they are not all the same. 00000000 and 99999999 are typical patterns that should not match. I'm trying to weed out obviously invalid values from existing database records. I've got this: ``` my ($match) = /(\d{8})/; ```...
2013/12/23
[ "https://Stackoverflow.com/questions/20749660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2321898/" ]
How about: ``` ^(\d)(?!\1{7})\d{7}$ ``` This will match 8 digit number that haven't 8 same digit. **Sample code:** ``` my $re = qr/^(\d)(?!\1{7})\d{7}$/; while(<DATA>) { chomp; say (/$re/ ? "OK : $_" : "KO : $_"); } __DATA__ 12345678 12345123 123456 11111111 ``` **Output:** ``` OK : 12345678 OK : 12345...
I'd do this in two regular expressions. One to match what you are looking for, and one to filter what you're not. Inspired by HamZa's answer though, I've also provided a single regex solution. ``` use strict; use warnings; while (my $num = <DATA>) { chomp $num; # Single Regex Solution - Inspired by HamZa's ...
20,749,660
Using a Perl regex, I need to match a series of eight digits, for example, 12345678, but only if they are not all the same. 00000000 and 99999999 are typical patterns that should not match. I'm trying to weed out obviously invalid values from existing database records. I've got this: ``` my ($match) = /(\d{8})/; ```...
2013/12/23
[ "https://Stackoverflow.com/questions/20749660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2321898/" ]
> > This answer is **based** on the title of the question: *match **n** digits, but only if they are not all the same*. > > > --- So I've come with the following expression: ``` (\d)\1+\b(*SKIP)(*FAIL)|\d+ ``` What does this mean ? ``` (\d) # Match a digit and put it in group 1 \1+ ...
``` my $number = "99999999"; # look for first digit, capture, print "ok\n" if $number =~ /(\d)\1{7}/; # use \1{7} to determine 7 matches of captured digit ```
20,749,660
Using a Perl regex, I need to match a series of eight digits, for example, 12345678, but only if they are not all the same. 00000000 and 99999999 are typical patterns that should not match. I'm trying to weed out obviously invalid values from existing database records. I've got this: ``` my ($match) = /(\d{8})/; ```...
2013/12/23
[ "https://Stackoverflow.com/questions/20749660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2321898/" ]
I'd do this in two regular expressions. One to match what you are looking for, and one to filter what you're not. Inspired by HamZa's answer though, I've also provided a single regex solution. ``` use strict; use warnings; while (my $num = <DATA>) { chomp $num; # Single Regex Solution - Inspired by HamZa's ...
> > This answer is **based** on the title of the question: *match **n** digits, but only if they are not all the same*. > > > --- So I've come with the following expression: ``` (\d)\1+\b(*SKIP)(*FAIL)|\d+ ``` What does this mean ? ``` (\d) # Match a digit and put it in group 1 \1+ ...
20,749,660
Using a Perl regex, I need to match a series of eight digits, for example, 12345678, but only if they are not all the same. 00000000 and 99999999 are typical patterns that should not match. I'm trying to weed out obviously invalid values from existing database records. I've got this: ``` my ($match) = /(\d{8})/; ```...
2013/12/23
[ "https://Stackoverflow.com/questions/20749660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2321898/" ]
I'd do this in two regular expressions. One to match what you are looking for, and one to filter what you're not. Inspired by HamZa's answer though, I've also provided a single regex solution. ``` use strict; use warnings; while (my $num = <DATA>) { chomp $num; # Single Regex Solution - Inspired by HamZa's ...
``` my $number = "99999999"; # look for first digit, capture, print "ok\n" if $number =~ /(\d)\1{7}/; # use \1{7} to determine 7 matches of captured digit ```
731,220
So I have this big file of fix length lines. I want to do a find and replace on a character line position. Example: ``` xxxxxxx 010109 xxxxxx xxxxx xxxxxxx 010309 xxxxxx xxxxx xxxxxxx 021506 xxxxxx xxxxx xxxxxxx 041187 xxxxxx xxxxx ``` So in this case I would want to find any value starting on posit...
2009/04/08
[ "https://Stackoverflow.com/questions/731220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/88737/" ]
**Edited: after testing, Notepad++ doesn't support the {n} method of defining an exact number of chars** This works, tested on your data: Find: ``` ^(............)...... ``` Replace: ``` \1010107 ```
Try this search pattern: ``` ^(.{12})\d{6} ``` And this as replacement expression: ``` \1010107 ```
731,220
So I have this big file of fix length lines. I want to do a find and replace on a character line position. Example: ``` xxxxxxx 010109 xxxxxx xxxxx xxxxxxx 010309 xxxxxx xxxxx xxxxxxx 021506 xxxxxx xxxxx xxxxxxx 041187 xxxxxx xxxxx ``` So in this case I would want to find any value starting on posit...
2009/04/08
[ "https://Stackoverflow.com/questions/731220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/88737/" ]
**Edited: after testing, Notepad++ doesn't support the {n} method of defining an exact number of chars** This works, tested on your data: Find: ``` ^(............)...... ``` Replace: ``` \1010107 ```
s/^(?:.{12})(.{6})(?:.\*)$/NNNNNN/ replacing NNNNNN by the desired number
731,220
So I have this big file of fix length lines. I want to do a find and replace on a character line position. Example: ``` xxxxxxx 010109 xxxxxx xxxxx xxxxxxx 010309 xxxxxx xxxxx xxxxxxx 021506 xxxxxx xxxxx xxxxxxx 041187 xxxxxx xxxxx ``` So in this case I would want to find any value starting on posit...
2009/04/08
[ "https://Stackoverflow.com/questions/731220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/88737/" ]
**Edited: after testing, Notepad++ doesn't support the {n} method of defining an exact number of chars** This works, tested on your data: Find: ``` ^(............)...... ``` Replace: ``` \1010107 ```
Something like this: ``` sed 's/^\(.\{12\}\).\{6\}\(.*\)$/\1010107\2/' ``` should do the trick (escaped for command line use)
731,220
So I have this big file of fix length lines. I want to do a find and replace on a character line position. Example: ``` xxxxxxx 010109 xxxxxx xxxxx xxxxxxx 010309 xxxxxx xxxxx xxxxxxx 021506 xxxxxx xxxxx xxxxxxx 041187 xxxxxx xxxxx ``` So in this case I would want to find any value starting on posit...
2009/04/08
[ "https://Stackoverflow.com/questions/731220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/88737/" ]
**Edited: after testing, Notepad++ doesn't support the {n} method of defining an exact number of chars** This works, tested on your data: Find: ``` ^(............)...... ``` Replace: ``` \1010107 ```
Just for the record, you don't need a regular expression for something like this. A simple split, or some kind of unpack function, would be just fine.
3,115,810
I would like to use the libical library in my project, but I have never used an external library before. I have downloaded the libical files, but I am pretty much stuck there. I do not how how, or even if, I need to build/extract them and then how to get them into Xcode. Any help would be greatly appreciated. Thank you...
2010/06/25
[ "https://Stackoverflow.com/questions/3115810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172131/" ]
If this a pre-built library then you can just drag it into your Xcode project (or use `Project` => `Add to Project…`) in the same way that you would for source/header files. If it's not pre-built then you'll need to build it for whatever environments and architecture you want to target. If it comes with an Xcode proje...
Getting libical to configure and build for arm is more tricky then ./configure -build=arm-apple-darwin. See this question and answer for more details: [Compiling libical](https://stackoverflow.com/questions/7197955/compiling-libical)
41,522,744
Trying to bundle the following file with Webpack fails with > > ERROR in ./~/pg/lib/native/index.js Module not found: Error: Cannot > resolve module 'pg-native' in > .../node\_modules/pg/lib/native > @ ./~/pg/lib/native/index.js 9:13-33 > > > I tried several `ignore` statements in the *.babelrc* but didnt get...
2017/01/07
[ "https://Stackoverflow.com/questions/41522744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3301344/" ]
This is an old thread but the problem still exists, so for anyone experiencing it, there is a workaround. The problem is an interaction between the way that `node-postgres` is written and how `babel` rewrites the code, which forces `pg-native` to be loaded even when you don't explicitly import/require it. The simplest...
You may have pg-native globally installed locally. Hence the packet manager does not include the pg-native in the lock file. That was a issue i experienced where it did run fine locally but every time i build in the cloud webpack complained about pg-native missing. I solved it by removing the lockfile in the files push...
41,522,744
Trying to bundle the following file with Webpack fails with > > ERROR in ./~/pg/lib/native/index.js Module not found: Error: Cannot > resolve module 'pg-native' in > .../node\_modules/pg/lib/native > @ ./~/pg/lib/native/index.js 9:13-33 > > > I tried several `ignore` statements in the *.babelrc* but didnt get...
2017/01/07
[ "https://Stackoverflow.com/questions/41522744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3301344/" ]
This is indeed an old thread, but one that helped me nonetheless. The solution provided by Steve Schafer [1](https://stackoverflow.com/a/59652739/2822888) is good, but not the simplest. Instead, the one provided by Marco Lüthy [2](https://github.com/brianc/node-postgres/issues/838#issuecomment-405646013) in the linked...
You may have pg-native globally installed locally. Hence the packet manager does not include the pg-native in the lock file. That was a issue i experienced where it did run fine locally but every time i build in the cloud webpack complained about pg-native missing. I solved it by removing the lockfile in the files push...
41,522,744
Trying to bundle the following file with Webpack fails with > > ERROR in ./~/pg/lib/native/index.js Module not found: Error: Cannot > resolve module 'pg-native' in > .../node\_modules/pg/lib/native > @ ./~/pg/lib/native/index.js 9:13-33 > > > I tried several `ignore` statements in the *.babelrc* but didnt get...
2017/01/07
[ "https://Stackoverflow.com/questions/41522744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3301344/" ]
I know that this is an old topic but I'm compelled to share how I solved it. It was maddening to deal with. So, here is the readers digest version as based on the recollection from the last brain cell that I have. ---------------------------------------------------------------------------------------------------------...
You may have pg-native globally installed locally. Hence the packet manager does not include the pg-native in the lock file. That was a issue i experienced where it did run fine locally but every time i build in the cloud webpack complained about pg-native missing. I solved it by removing the lockfile in the files push...
41,522,744
Trying to bundle the following file with Webpack fails with > > ERROR in ./~/pg/lib/native/index.js Module not found: Error: Cannot > resolve module 'pg-native' in > .../node\_modules/pg/lib/native > @ ./~/pg/lib/native/index.js 9:13-33 > > > I tried several `ignore` statements in the *.babelrc* but didnt get...
2017/01/07
[ "https://Stackoverflow.com/questions/41522744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3301344/" ]
This is indeed an old thread, but one that helped me nonetheless. The solution provided by Steve Schafer [1](https://stackoverflow.com/a/59652739/2822888) is good, but not the simplest. Instead, the one provided by Marco Lüthy [2](https://github.com/brianc/node-postgres/issues/838#issuecomment-405646013) in the linked...
This is an old thread but the problem still exists, so for anyone experiencing it, there is a workaround. The problem is an interaction between the way that `node-postgres` is written and how `babel` rewrites the code, which forces `pg-native` to be loaded even when you don't explicitly import/require it. The simplest...
41,522,744
Trying to bundle the following file with Webpack fails with > > ERROR in ./~/pg/lib/native/index.js Module not found: Error: Cannot > resolve module 'pg-native' in > .../node\_modules/pg/lib/native > @ ./~/pg/lib/native/index.js 9:13-33 > > > I tried several `ignore` statements in the *.babelrc* but didnt get...
2017/01/07
[ "https://Stackoverflow.com/questions/41522744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3301344/" ]
This is an old thread but the problem still exists, so for anyone experiencing it, there is a workaround. The problem is an interaction between the way that `node-postgres` is written and how `babel` rewrites the code, which forces `pg-native` to be loaded even when you don't explicitly import/require it. The simplest...
I know that this is an old topic but I'm compelled to share how I solved it. It was maddening to deal with. So, here is the readers digest version as based on the recollection from the last brain cell that I have. ---------------------------------------------------------------------------------------------------------...
41,522,744
Trying to bundle the following file with Webpack fails with > > ERROR in ./~/pg/lib/native/index.js Module not found: Error: Cannot > resolve module 'pg-native' in > .../node\_modules/pg/lib/native > @ ./~/pg/lib/native/index.js 9:13-33 > > > I tried several `ignore` statements in the *.babelrc* but didnt get...
2017/01/07
[ "https://Stackoverflow.com/questions/41522744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3301344/" ]
This is indeed an old thread, but one that helped me nonetheless. The solution provided by Steve Schafer [1](https://stackoverflow.com/a/59652739/2822888) is good, but not the simplest. Instead, the one provided by Marco Lüthy [2](https://github.com/brianc/node-postgres/issues/838#issuecomment-405646013) in the linked...
I know that this is an old topic but I'm compelled to share how I solved it. It was maddening to deal with. So, here is the readers digest version as based on the recollection from the last brain cell that I have. ---------------------------------------------------------------------------------------------------------...
14,977,697
I want to read data from one column of datagridview. My datagridview contains many columns but I want to read all cells but only from one column. I read all columns using this code: ``` foreach (DataGridViewColumn col in dataGridView1.Columns) col.Name.ToString(); ``` But I want to read all cell from particu...
2013/02/20
[ "https://Stackoverflow.com/questions/14977697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865258/" ]
Try this ``` string data = string.Empty; int indexOfYourColumn = 0; foreach (DataGridViewRow row in dataGridView1.Rows) data = row.Cells[indexOfYourColumn].Value; ```
try this ``` foreach (DataGridViewRow row in dataGridView1.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.ColumnIndex == 0) //Set your Column Index { //DO your Stuff here.. } } } ``` ...
14,977,697
I want to read data from one column of datagridview. My datagridview contains many columns but I want to read all cells but only from one column. I read all columns using this code: ``` foreach (DataGridViewColumn col in dataGridView1.Columns) col.Name.ToString(); ``` But I want to read all cell from particu...
2013/02/20
[ "https://Stackoverflow.com/questions/14977697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865258/" ]
Try this ``` string data = string.Empty; int indexOfYourColumn = 0; foreach (DataGridViewRow row in dataGridView1.Rows) data = row.Cells[indexOfYourColumn].Value; ```
To get the value of the clicked cell: ``` private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { textBox1.Text = dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString(); } ```
14,977,697
I want to read data from one column of datagridview. My datagridview contains many columns but I want to read all cells but only from one column. I read all columns using this code: ``` foreach (DataGridViewColumn col in dataGridView1.Columns) col.Name.ToString(); ``` But I want to read all cell from particu...
2013/02/20
[ "https://Stackoverflow.com/questions/14977697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865258/" ]
Try this ``` string data = string.Empty; int indexOfYourColumn = 0; foreach (DataGridViewRow row in dataGridView1.Rows) data = row.Cells[indexOfYourColumn].Value; ```
**FOREACH LOOP** ``` string data = string.Empty; string data = string.Empty; int indexOfYourColumn = 0; int indexOfYourColumn = 0; foreach (DataGridViewRow row in dataGridView1.Rows) foreach (DataGridViewRow row in dataGridView1.Rows) data = row.Cells[indexOfYourColumn].Value; ``` **FOR LOOP** ``` using System.C...
14,977,697
I want to read data from one column of datagridview. My datagridview contains many columns but I want to read all cells but only from one column. I read all columns using this code: ``` foreach (DataGridViewColumn col in dataGridView1.Columns) col.Name.ToString(); ``` But I want to read all cell from particu...
2013/02/20
[ "https://Stackoverflow.com/questions/14977697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865258/" ]
Maybe this helps too. To get one cell: ``` string data = (string)DataGridView1[iCol, iRow].Value; ``` Then you can simply loop rows and columns. [Documentation](http://msdn.microsoft.com/ru-ru/library/ms158656.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2).
try this ``` foreach (DataGridViewRow row in dataGridView1.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.ColumnIndex == 0) //Set your Column Index { //DO your Stuff here.. } } } ``` ...
14,977,697
I want to read data from one column of datagridview. My datagridview contains many columns but I want to read all cells but only from one column. I read all columns using this code: ``` foreach (DataGridViewColumn col in dataGridView1.Columns) col.Name.ToString(); ``` But I want to read all cell from particu...
2013/02/20
[ "https://Stackoverflow.com/questions/14977697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865258/" ]
Maybe this helps too. To get one cell: ``` string data = (string)DataGridView1[iCol, iRow].Value; ``` Then you can simply loop rows and columns. [Documentation](http://msdn.microsoft.com/ru-ru/library/ms158656.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2).
To get the value of the clicked cell: ``` private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { textBox1.Text = dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString(); } ```
14,977,697
I want to read data from one column of datagridview. My datagridview contains many columns but I want to read all cells but only from one column. I read all columns using this code: ``` foreach (DataGridViewColumn col in dataGridView1.Columns) col.Name.ToString(); ``` But I want to read all cell from particu...
2013/02/20
[ "https://Stackoverflow.com/questions/14977697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865258/" ]
Maybe this helps too. To get one cell: ``` string data = (string)DataGridView1[iCol, iRow].Value; ``` Then you can simply loop rows and columns. [Documentation](http://msdn.microsoft.com/ru-ru/library/ms158656.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2).
**FOREACH LOOP** ``` string data = string.Empty; string data = string.Empty; int indexOfYourColumn = 0; int indexOfYourColumn = 0; foreach (DataGridViewRow row in dataGridView1.Rows) foreach (DataGridViewRow row in dataGridView1.Rows) data = row.Cells[indexOfYourColumn].Value; ``` **FOR LOOP** ``` using System.C...
14,977,697
I want to read data from one column of datagridview. My datagridview contains many columns but I want to read all cells but only from one column. I read all columns using this code: ``` foreach (DataGridViewColumn col in dataGridView1.Columns) col.Name.ToString(); ``` But I want to read all cell from particu...
2013/02/20
[ "https://Stackoverflow.com/questions/14977697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865258/" ]
try this ``` foreach (DataGridViewRow row in dataGridView1.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.ColumnIndex == 0) //Set your Column Index { //DO your Stuff here.. } } } ``` ...
To get the value of the clicked cell: ``` private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { textBox1.Text = dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString(); } ```
14,977,697
I want to read data from one column of datagridview. My datagridview contains many columns but I want to read all cells but only from one column. I read all columns using this code: ``` foreach (DataGridViewColumn col in dataGridView1.Columns) col.Name.ToString(); ``` But I want to read all cell from particu...
2013/02/20
[ "https://Stackoverflow.com/questions/14977697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865258/" ]
try this ``` foreach (DataGridViewRow row in dataGridView1.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.ColumnIndex == 0) //Set your Column Index { //DO your Stuff here.. } } } ``` ...
**FOREACH LOOP** ``` string data = string.Empty; string data = string.Empty; int indexOfYourColumn = 0; int indexOfYourColumn = 0; foreach (DataGridViewRow row in dataGridView1.Rows) foreach (DataGridViewRow row in dataGridView1.Rows) data = row.Cells[indexOfYourColumn].Value; ``` **FOR LOOP** ``` using System.C...
54,187,563
Any suggestions on how to convert the [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) format `PnYnMnDTnHnMnS` (ex: P1W, P5D, P3D) to number of days? I'm trying to set the text of a button in a way that the days of free trial are displayed to the user. Google provides the billing information in t...
2019/01/14
[ "https://Stackoverflow.com/questions/54187563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10567570/" ]
java.time and ThreeTenABP ------------------------- This exists. Consider not reinventing the wheel. ``` import org.threeten.bp.Period; public class FormatPeriod { public static void main(String[] args) { String freeTrialString = "P3W"; Period freeTrial = Period.parse(freeTrialString); S...
If you do want to re-invent the wheel here is a simple solution to parse ISO 8601 durations, it only supports year/week/day and not the time part but it can of course be added. Another limitation of this solution is that it expects the different types, if present, comes in the order Year->Week->Day ``` private static ...
54,187,563
Any suggestions on how to convert the [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) format `PnYnMnDTnHnMnS` (ex: P1W, P5D, P3D) to number of days? I'm trying to set the text of a button in a way that the days of free trial are displayed to the user. Google provides the billing information in t...
2019/01/14
[ "https://Stackoverflow.com/questions/54187563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10567570/" ]
java.time and ThreeTenABP ------------------------- This exists. Consider not reinventing the wheel. ``` import org.threeten.bp.Period; public class FormatPeriod { public static void main(String[] args) { String freeTrialString = "P3W"; Period freeTrial = Period.parse(freeTrialString); S...
**I needed to convert to seconds,** so, I am Looking at > > @Joakim Danielson's > > > answer, I improved the regular expression slightly. Please refer to those who need it. ``` private int changeIso8601TimeIntervalsToSecond(String duration) throws Exception { //P#DT#H#M#S String REGEX = "^P((\...
54,187,563
Any suggestions on how to convert the [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) format `PnYnMnDTnHnMnS` (ex: P1W, P5D, P3D) to number of days? I'm trying to set the text of a button in a way that the days of free trial are displayed to the user. Google provides the billing information in t...
2019/01/14
[ "https://Stackoverflow.com/questions/54187563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10567570/" ]
If you do want to re-invent the wheel here is a simple solution to parse ISO 8601 durations, it only supports year/week/day and not the time part but it can of course be added. Another limitation of this solution is that it expects the different types, if present, comes in the order Year->Week->Day ``` private static ...
**I needed to convert to seconds,** so, I am Looking at > > @Joakim Danielson's > > > answer, I improved the regular expression slightly. Please refer to those who need it. ``` private int changeIso8601TimeIntervalsToSecond(String duration) throws Exception { //P#DT#H#M#S String REGEX = "^P((\...
18,819,048
I have a static double variable in a static class. When I create a specific class, I use the double variable as one of the args of the constructor. What would be the easiest way of manipulating field of the object by changing the variable in static class. Code for clarity: ``` public static class Vars { public sta...
2013/09/16
[ "https://Stackoverflow.com/questions/18819048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2679437/" ]
In short: no, you can't do this... at least, not seamlessly. As noted, this is generally considered to be A Bad Idea™. There is no reference encapsulation for value types, and no simple way to implement a seamless wrapper class to do it because you can't overload the assignment operators. You can use the techniques fr...
What you really want to do is have `Vars` be a regular class, not a static class. For all methods and classes that need to deal with the variables contained in `Vars`, you can pass in a reference to that `Vars` instance. Here is a very simple example program that illustrates the above. Note that you could probably do ...
13,433,844
I've been doing C# with XNA for a year or so now, and I'm pretty comfortable with 2D games. But after some reading, I'm worried about XNA's future since it isn't supported in Windows 8 and stuff like that. So I've been considering switching to Unity 3D? What are the benefits of Unity over XNA/C# and it is worth the mo...
2012/11/17
[ "https://Stackoverflow.com/questions/13433844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1739071/" ]
**XNA** XNA still works on Windows 8. The issue is that they are not supporting XNA based games in Windows 8 Modern UI. XNA still works for Windows 8 desktop games. The terminology is extremely confusing. XNA will either get a serious overhaul when the new XBox console is released or something brand new will be desi...
**[MonoGame](http://monogame.codeplex.com/)** is a free XNA-compatible library that allows you to make games in C# for WinRT, Windows Store apps and Windows Phone 8, and on top of the [Xamarin](http://www.xamarin.com) tools also for iOS and Android. This works on top of SharpDX, the optimized managed wrapper for Direct...
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
The `serialVersionUID` is also serialized in this case. *Any static variable that is provided a value during class initialization is serialized*. However in normal cases, where you would provide the value to a static variable at the main class / run-time would not be serialized. You can try to access the `serialVers...
Any static variable which has been initialised at the time of declaration will be serialized.
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
The `serialVersionUID` is also serialized in this case. *Any static variable that is provided a value during class initialization is serialized*. However in normal cases, where you would provide the value to a static variable at the main class / run-time would not be serialized. You can try to access the `serialVers...
No, if a class have static variable then at the time of serialization that variable will be skipped . because static variable is unique for all object and serialization is used for only save the object properties ( state of object ). static variable is a property of class
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
serialVersionUID is a **special** static variable used by the serialization and deserialization process, to verify that a local class is compatible with the class used to serialize an object. It's not just a static variable as others, which are definitely not serialized. When an object of a class is first serialized, ...
You can test this for yourself - here's some example code that should answer your question: ``` import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializ...
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
serialVersionUID is a **special** static variable used by the serialization and deserialization process, to verify that a local class is compatible with the class used to serialize an object. It's not just a static variable as others, which are definitely not serialized. When an object of a class is first serialized, ...
Any static variable which has been initialised at the time of declaration will be serialized.
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
1. **Instance Variables:** These variables are serialized, so during deserialization we will get back the serialized state. 2. **Static Variables:** These variables are not serialized, So during deserialization static variable value will loaded from the class.(Current value will be loaded.) 3. **transient Variables:** ...
`serialVersionUID` is special and is not subject to these rules. There is code within the serialization machinery that specifically handles this field to perform the automatic version checks.
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
`serialVersionUID` is special and is not subject to these rules. There is code within the serialization machinery that specifically handles this field to perform the automatic version checks.
No, if a class have static variable then at the time of serialization that variable will be skipped . because static variable is unique for all object and serialization is used for only save the object properties ( state of object ). static variable is a property of class
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
1. **Instance Variables:** These variables are serialized, so during deserialization we will get back the serialized state. 2. **Static Variables:** These variables are not serialized, So during deserialization static variable value will loaded from the class.(Current value will be loaded.) 3. **transient Variables:** ...
**Yes**, static variable will be serialized if it is initialized at the time of declaration. For example, **case 1 :** without initialization at the time of declaration ``` class Person implements Serializable{ public String firstName; static String lastName; } public class Employee { public static void...
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
You can test this for yourself - here's some example code that should answer your question: ``` import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializ...
**Yes**, static variable will be serialized if it is initialized at the time of declaration. For example, **case 1 :** without initialization at the time of declaration ``` class Person implements Serializable{ public String firstName; static String lastName; } public class Employee { public static void...
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
serialVersionUID is a **special** static variable used by the serialization and deserialization process, to verify that a local class is compatible with the class used to serialize an object. It's not just a static variable as others, which are definitely not serialized. When an object of a class is first serialized, ...
1. **Instance Variables:** These variables are serialized, so during deserialization we will get back the serialized state. 2. **Static Variables:** These variables are not serialized, So during deserialization static variable value will loaded from the class.(Current value will be loaded.) 3. **transient Variables:** ...
11,000,975
I'm stumbled upon understanding java serialization. I have read in many documents and books that static and transient variables cannot be serialized in Java. We declare a serialVersionUid as follows. ``` private static final long serialVersionUID = 1L; ``` If a static variable was not serialized then, we often face...
2012/06/12
[ "https://Stackoverflow.com/questions/11000975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/792580/" ]
serialVersionUID is a **special** static variable used by the serialization and deserialization process, to verify that a local class is compatible with the class used to serialize an object. It's not just a static variable as others, which are definitely not serialized. When an object of a class is first serialized, ...
No, if a class have static variable then at the time of serialization that variable will be skipped . because static variable is unique for all object and serialization is used for only save the object properties ( state of object ). static variable is a property of class
68,317
I am trying to figure out head-internal relative clauses. A paper I looked at presented two versions of the same sentence, one with the head word (りんご) outside the relative clause: > > [皿の上にあった]**りんご**をくすねた。 > > > And one version where it is inside the relative clause: > > [**りんご**が皿の上にあった]のをくすねた。 > > > Do...
2019/05/17
[ "https://japanese.stackexchange.com/questions/68317", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/33409/" ]
They are slightly different, if not much. The former sounds saying a fact relatively objectively. On the other hand, the latter rather means "although an apple was on the plate, s/he stole it" and it sounds somehow accusive in the sense that it should have been there. In grammar for old Japanese, a similar form is co...
I could have the wrong end of the stick here, but your second example doesn't make sense to me. ### Part 1: regular relative clause Let's look at your first example first. > > [皿の上にあった]**りんご**をくすねた。 > > > At its core (haha, pun not intended), we have: > > **りんご**をくすねた。 > > I pilfered the **apple**. > > ...
44,877,715
why do we need self referential object in javascript. example ``` let a = {}; a.self = a; ``` now a property self is referring to itself and become circular object. in nodejs when we use routing library like hapi. the request object which we receive is circular
2017/07/03
[ "https://Stackoverflow.com/questions/44877715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5949299/" ]
The problem came from ***malloc(total\_courses + sizeof(course\_collection))*** You only allocate array of pointer of course\_collection. You need allocate memory for whole the *struct Course* It should be **malloc(total\_courses \* sizeof(struct Course))**
User this malloc(total\_courses + sizeof(struct Course)) instead of malloc(total\_courses + sizeof(course\_collection)) segmentation fault due to memory allocation mostly for arrays arr[n] we use it till '0' to 'n-1' { carefully observe not 'n'}
38,796,482
Does it simply mean that I have a parameter in my 'model\_params' variable that is not in this line? ``` params.require(...).permit(...) ``` I can't find offending parameter. Is there a way to accept all parameters?
2016/08/05
[ "https://Stackoverflow.com/questions/38796482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1344643/" ]
A space is a [descendant combinator](https://www.w3.org/TR/css3-selectors/#descendant-combinators). It targets descendants, but the div is not a descendant of the button, it is a sibling. You need to use the [adjacent sibling combinator](https://www.w3.org/TR/css3-selectors/#adjacent-sibling-combinators) instead: a pl...
I'd move the `display: none;` to the `.dropcontent` itself - as it now pertains to its anchors, that is, links, and as such, neither current answer would work -, then use ``` .dropbutton:hover + .dropcontent { display: block; } ``` But you must not add anything between dropbutton and dropcontent afterwards, or ...
38,796,482
Does it simply mean that I have a parameter in my 'model\_params' variable that is not in this line? ``` params.require(...).permit(...) ``` I can't find offending parameter. Is there a way to accept all parameters?
2016/08/05
[ "https://Stackoverflow.com/questions/38796482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1344643/" ]
A space is a [descendant combinator](https://www.w3.org/TR/css3-selectors/#descendant-combinators). It targets descendants, but the div is not a descendant of the button, it is a sibling. You need to use the [adjacent sibling combinator](https://www.w3.org/TR/css3-selectors/#adjacent-sibling-combinators) instead: a pl...
Are you using Javascript to do this? ``` var button = document.getElementsByClassName('.dropbutton')[0], menuContent = docuemnt.getElementsByClassName('.dropcontent')[0]; button.onmouseover = function(event) { menuContent.style.display['block']; } button.onmouseout = function(event) { menuContent.style.di...
44,105,977
This is what I have: ``` class encoded { public static void main(String[] args) { String s1 = "hello"; char[] ch = s1.toCharArray(); for(int i=0;i<ch.length;i++) { char c = (char) (((i - 'a' + 1) % 26) + 'a'); System.out.print(c); } } } ``` ...
2017/05/22
[ "https://Stackoverflow.com/questions/44105977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8046403/" ]
You are using the loop index `i` instead of the `i`th character in your loop, which means the output of your code does not depend the input `String` (well, except for the length of the output, which is the same as the length of the input). Change ``` char c = (char) (((i - 'a' + 1) % 26) + 'a'); ``` to ``` char c ...
Replace `i - 'a' + 1` with `ch[i] - 'a' + 1` ``` class encoded { public static void main(String[] args) { String s1 = "hello"; char[] ch = s1.toCharArray(); for(int i=0;i<ch.length;i++) { char c = (char) (((ch[i] - 'a' + 1) % 26) + 'a'); System.out.print(c); } } } `...
40,428,510
I have a directory "FolderName" with 10,000 new files every day. Almost a half of those files are named as follows: ``` filename_yyyy-mm-dd_hh:mm ``` while the other half are named: ``` filename_yyyy-mm-dd hh:mm ``` (with space instead of underscore) The script I'd like to set up should do the following: Rename...
2016/11/04
[ "https://Stackoverflow.com/questions/40428510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5233499/" ]
`for f in "$(find . -name '* *')"; do mv $f $(echo $f | sed 's/\ /_/'); done` will do it. There should be a better way using find's `-exec` option as well. EDIT: If the function is put in a script, then find can be used directly: ``` cat <<EOF > space_to_underscore #!/usr/bin/env bash mv "$1" "$(sed 's/\ /_/' <(echo ...
Rename only the files containing a space in their name, skipping files that need no processing: ``` for file in *\ * ; do mv "$file" "${file// /_}" ; done ``` Move all the files older than one week to a "NewFolderName" folder: ``` find -mtime 7 -exec mv {} NewFolderName/ \; ```
40,428,510
I have a directory "FolderName" with 10,000 new files every day. Almost a half of those files are named as follows: ``` filename_yyyy-mm-dd_hh:mm ``` while the other half are named: ``` filename_yyyy-mm-dd hh:mm ``` (with space instead of underscore) The script I'd like to set up should do the following: Rename...
2016/11/04
[ "https://Stackoverflow.com/questions/40428510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5233499/" ]
Check out the [`rename`](http://search.cpan.org/~rmbarker/File-Rename-0.06/rename.PL) utility, a Perl script designed just for this, it's powerful and fast. ``` rename -n ' ' _ *\ * ``` Or: ``` find /path/to/dir -type f -name '* *' -exec rename -n ' ' _ {} \; ``` The `-n` flag is for dry run, to print what works ...
`for f in "$(find . -name '* *')"; do mv $f $(echo $f | sed 's/\ /_/'); done` will do it. There should be a better way using find's `-exec` option as well. EDIT: If the function is put in a script, then find can be used directly: ``` cat <<EOF > space_to_underscore #!/usr/bin/env bash mv "$1" "$(sed 's/\ /_/' <(echo ...
40,428,510
I have a directory "FolderName" with 10,000 new files every day. Almost a half of those files are named as follows: ``` filename_yyyy-mm-dd_hh:mm ``` while the other half are named: ``` filename_yyyy-mm-dd hh:mm ``` (with space instead of underscore) The script I'd like to set up should do the following: Rename...
2016/11/04
[ "https://Stackoverflow.com/questions/40428510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5233499/" ]
Check out the [`rename`](http://search.cpan.org/~rmbarker/File-Rename-0.06/rename.PL) utility, a Perl script designed just for this, it's powerful and fast. ``` rename -n ' ' _ *\ * ``` Or: ``` find /path/to/dir -type f -name '* *' -exec rename -n ' ' _ {} \; ``` The `-n` flag is for dry run, to print what works ...
Rename only the files containing a space in their name, skipping files that need no processing: ``` for file in *\ * ; do mv "$file" "${file// /_}" ; done ``` Move all the files older than one week to a "NewFolderName" folder: ``` find -mtime 7 -exec mv {} NewFolderName/ \; ```
40,428,510
I have a directory "FolderName" with 10,000 new files every day. Almost a half of those files are named as follows: ``` filename_yyyy-mm-dd_hh:mm ``` while the other half are named: ``` filename_yyyy-mm-dd hh:mm ``` (with space instead of underscore) The script I'd like to set up should do the following: Rename...
2016/11/04
[ "https://Stackoverflow.com/questions/40428510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5233499/" ]
with the legacy `rename` you can easily convert single space to underlines ``` $ rename ' ' '_' files ```
Rename only the files containing a space in their name, skipping files that need no processing: ``` for file in *\ * ; do mv "$file" "${file// /_}" ; done ``` Move all the files older than one week to a "NewFolderName" folder: ``` find -mtime 7 -exec mv {} NewFolderName/ \; ```
40,428,510
I have a directory "FolderName" with 10,000 new files every day. Almost a half of those files are named as follows: ``` filename_yyyy-mm-dd_hh:mm ``` while the other half are named: ``` filename_yyyy-mm-dd hh:mm ``` (with space instead of underscore) The script I'd like to set up should do the following: Rename...
2016/11/04
[ "https://Stackoverflow.com/questions/40428510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5233499/" ]
Check out the [`rename`](http://search.cpan.org/~rmbarker/File-Rename-0.06/rename.PL) utility, a Perl script designed just for this, it's powerful and fast. ``` rename -n ' ' _ *\ * ``` Or: ``` find /path/to/dir -type f -name '* *' -exec rename -n ' ' _ {} \; ``` The `-n` flag is for dry run, to print what works ...
with the legacy `rename` you can easily convert single space to underlines ``` $ rename ' ' '_' files ```
25,440,573
i have created Lead Management System. i have created to type of user category as given below 1. user - Normal user of System who can see only his/her data while logged in system 2. admin - treating as manager login in which manager can see all data of user which has been register under his/her name Function:- i hav...
2014/08/22
[ "https://Stackoverflow.com/questions/25440573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3270076/" ]
Check whether logged\_in\_as() returns the proper bool value. Maybe u have a bug in that function and it always returns false. Since it is false, it will return all the leads entered by that user (i.e. admin), and since admin has not entered any data, it shows blank. This is only a guess. It should work otherwise, y...
Just on a side note, why not save the usergroup (admin or normal user) to a session instead of running that function all the time when checking who is and isn't a system admin? Potentially you would run that sql routine many times on a page just to check the usergroup which seems a bit much. At that juncture it would c...
25,440,573
i have created Lead Management System. i have created to type of user category as given below 1. user - Normal user of System who can see only his/her data while logged in system 2. admin - treating as manager login in which manager can see all data of user which has been register under his/her name Function:- i hav...
2014/08/22
[ "https://Stackoverflow.com/questions/25440573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3270076/" ]
Check whether logged\_in\_as() returns the proper bool value. Maybe u have a bug in that function and it always returns false. Since it is false, it will return all the leads entered by that user (i.e. admin), and since admin has not entered any data, it shows blank. This is only a guess. It should work otherwise, y...
I hope I am mistaken but does your `logged_in_as()` method even works? It doesn't even seems to have an input. As long as your `user` table contains at least 1 admin it'll always return true. try this and see if it helps ``` function logged_in_as() { return (mysql_result(mysql_query("SELECT if(user_type='admin',...
25,440,573
i have created Lead Management System. i have created to type of user category as given below 1. user - Normal user of System who can see only his/her data while logged in system 2. admin - treating as manager login in which manager can see all data of user which has been register under his/her name Function:- i hav...
2014/08/22
[ "https://Stackoverflow.com/questions/25440573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3270076/" ]
Just on a side note, why not save the usergroup (admin or normal user) to a session instead of running that function all the time when checking who is and isn't a system admin? Potentially you would run that sql routine many times on a page just to check the usergroup which seems a bit much. At that juncture it would c...
I hope I am mistaken but does your `logged_in_as()` method even works? It doesn't even seems to have an input. As long as your `user` table contains at least 1 admin it'll always return true. try this and see if it helps ``` function logged_in_as() { return (mysql_result(mysql_query("SELECT if(user_type='admin',...
42,014,274
Haven't seen a solution similar enough to this yet... I have two files each containing a list of file names. There are overlap in the contents of the files but file A contain some file names that are not in file B. Also, the file extensions are different in files A and B. That is: ``` A B --------...
2017/02/02
[ "https://Stackoverflow.com/questions/42014274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3741624/" ]
You could do: ``` $ awk 'function base(fn) {sub("[.][^.]*$", "", fn); return fn} NR==FNR { fn[$1]; next} {for (e in fn){ if (base(e)==base($1)){ printf "%s,%s\n", e, $1 }}} ' f1 f2 file-1-2.txt,file-1-2.png file-3-4.txt,file-3-4.png ``` Since `awk` associative arrays are unordered, the order of the p...
The unix join command should do what you want. Set the field separator -t '.' to be a dot and join by the first column in both files. You may need to sort the files ahead of time. The sort can be done on the same command line as the join with the proper syntax. <(sort -k 2 file1.txt) <(sort file2.txt)
42,014,274
Haven't seen a solution similar enough to this yet... I have two files each containing a list of file names. There are overlap in the contents of the files but file A contain some file names that are not in file B. Also, the file extensions are different in files A and B. That is: ``` A B --------...
2017/02/02
[ "https://Stackoverflow.com/questions/42014274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3741624/" ]
This pure bash solution should work and handle dots, backslashes, dashes, and other special characters in either file. ``` mapfile -t arr_a < A mapfile -t arr_b < B for a in "${arr_a[@]}"; do for b in "${arr_b[@]}"; do [[ ${a%.*} == "${b%.*}" ]] && printf '%s,%s\n' "$a" "$b" && break done; done ``` First, we re...
The unix join command should do what you want. Set the field separator -t '.' to be a dot and join by the first column in both files. You may need to sort the files ahead of time. The sort can be done on the same command line as the join with the proper syntax. <(sort -k 2 file1.txt) <(sort file2.txt)
42,014,274
Haven't seen a solution similar enough to this yet... I have two files each containing a list of file names. There are overlap in the contents of the files but file A contain some file names that are not in file B. Also, the file extensions are different in files A and B. That is: ``` A B --------...
2017/02/02
[ "https://Stackoverflow.com/questions/42014274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3741624/" ]
You could do: ``` $ awk 'function base(fn) {sub("[.][^.]*$", "", fn); return fn} NR==FNR { fn[$1]; next} {for (e in fn){ if (base(e)==base($1)){ printf "%s,%s\n", e, $1 }}} ' f1 f2 file-1-2.txt,file-1-2.png file-3-4.txt,file-3-4.png ``` Since `awk` associative arrays are unordered, the order of the p...
Here's something fairly brute force: ``` file1="file1.txt" file2="file2.txt" out_file="out.txt" touch $out_file while read line ; do # read the first file line by line file1_name="$(echo "$line" | cut -d'.' -f1)" # get the filename without extension file2_name="$(grep "$file1_name\." $file2)" if [ -n "$file2...
42,014,274
Haven't seen a solution similar enough to this yet... I have two files each containing a list of file names. There are overlap in the contents of the files but file A contain some file names that are not in file B. Also, the file extensions are different in files A and B. That is: ``` A B --------...
2017/02/02
[ "https://Stackoverflow.com/questions/42014274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3741624/" ]
This pure bash solution should work and handle dots, backslashes, dashes, and other special characters in either file. ``` mapfile -t arr_a < A mapfile -t arr_b < B for a in "${arr_a[@]}"; do for b in "${arr_b[@]}"; do [[ ${a%.*} == "${b%.*}" ]] && printf '%s,%s\n' "$a" "$b" && break done; done ``` First, we re...
You could do: ``` $ awk 'function base(fn) {sub("[.][^.]*$", "", fn); return fn} NR==FNR { fn[$1]; next} {for (e in fn){ if (base(e)==base($1)){ printf "%s,%s\n", e, $1 }}} ' f1 f2 file-1-2.txt,file-1-2.png file-3-4.txt,file-3-4.png ``` Since `awk` associative arrays are unordered, the order of the p...
42,014,274
Haven't seen a solution similar enough to this yet... I have two files each containing a list of file names. There are overlap in the contents of the files but file A contain some file names that are not in file B. Also, the file extensions are different in files A and B. That is: ``` A B --------...
2017/02/02
[ "https://Stackoverflow.com/questions/42014274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3741624/" ]
This pure bash solution should work and handle dots, backslashes, dashes, and other special characters in either file. ``` mapfile -t arr_a < A mapfile -t arr_b < B for a in "${arr_a[@]}"; do for b in "${arr_b[@]}"; do [[ ${a%.*} == "${b%.*}" ]] && printf '%s,%s\n' "$a" "$b" && break done; done ``` First, we re...
Here's something fairly brute force: ``` file1="file1.txt" file2="file2.txt" out_file="out.txt" touch $out_file while read line ; do # read the first file line by line file1_name="$(echo "$line" | cut -d'.' -f1)" # get the filename without extension file2_name="$(grep "$file1_name\." $file2)" if [ -n "$file2...
8,797,791
I'm trying to run a simple `test\spec` but getting an error. Error is only happening when the tests fail. ``` begin require 'rubygems' require 'test/spec' rescue LoadError puts "==> you need test/spec to run tests. {sudo gem install test-spec}" end context "Foo" do specify "should bar" do "ttes".should...
2012/01/10
[ "https://Stackoverflow.com/questions/8797791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44286/" ]
I can only guess, but there is something very strange going on here. Are you mixing Ruby versions or something? Are you using a gem that's not compatible with your version of Ruby? Every encoding instance should respond to [`ascii_compatible?`](http://apidock.com/ruby/Encoding/ascii_compatible%3F) in Ruby 1.9, so maybe...
I was getting a similar problem running Ruby 1.9.1 on Windows. My environment had been previously set up to run Ruby for some scripting of automated tests for embedded development. I tried installing 1.9.3, but the problem was still there. Eventually uninstalled both 1.9.1 and 1.9.3, re-installed Ruby 1.9.3 and test-u...
8,797,791
I'm trying to run a simple `test\spec` but getting an error. Error is only happening when the tests fail. ``` begin require 'rubygems' require 'test/spec' rescue LoadError puts "==> you need test/spec to run tests. {sudo gem install test-spec}" end context "Foo" do specify "should bar" do "ttes".should...
2012/01/10
[ "https://Stackoverflow.com/questions/8797791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44286/" ]
I can only guess, but there is something very strange going on here. Are you mixing Ruby versions or something? Are you using a gem that's not compatible with your version of Ruby? Every encoding instance should respond to [`ascii_compatible?`](http://apidock.com/ruby/Encoding/ascii_compatible%3F) in Ruby 1.9, so maybe...
My version of Ruby 1.9.1 had a gems that depended upon 'test-unit'. At least one of them forced the install of test-unit-2.4.7. For me, removing the 'test-unit-2.4.7' gem solved the problem. In test-unit-2.4.7 we have this code: ``` in /home/davei/.gem/ruby/1.9.1/gems/test-unit-2.4.7/lib/test/unit/assertions.rb 14...
48,073,506
I did a lot of research on the web, but did not find a documentation of the composer error log. In the discussions I found, nobody had an explanation that was consistent with the error log. For example: * [[Support] Need explanation for "Conclusion: don't install ..."](https://github.com/composer/composer/issues/2702)...
2018/01/03
[ "https://Stackoverflow.com/questions/48073506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/486218/" ]
Documentation of Composer can be found at [getcomposer.org/doc](https://getcomposer.org/doc/), especially [Troubleshooting](https://getcomposer.org/doc/articles/troubleshooting.md) section. Usually the dependency problems comes from misconfiguration of your `composer.json` and understanding Composer logs comes with exp...
### Error: > > somevendor/somepackage[v1.0.0, ..., v1.9.1] require composer-plugin-api ~[X.X] > > > This means that that `somevendor/somepacakge` requires that a specific version range of Composer to be installed. Run `composer -v` and compare it to the version constraint in the error message (shown as `~X.X` in...
35,661,088
I am new to bootstrap and I am attempting to learn the basics. However, I have put a color background for the div and it is only appears when I have resize the browser. Here is my code: ``` <html> <body> <div id="header"> <div class="col-md-8"><img src="images/logo.png"></div> <div class="col-md-...
2016/02/26
[ "https://Stackoverflow.com/questions/35661088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5335546/" ]
You might want to try something like this. You will have to replace the hard coded elements... ```js var fruits = ["Apple", "Banana"]; var tempString = "Pie,Dumpling,Cider"; var tempArray = new Array(); tempArray.push(tempString); tempString = "Bread,Republic"; tempArray.push(tempString); var output = {}; for (...
try this: ``` var fruits = ["Apple", "Banana"], i, k, members, tmp, output = []; var final = []; for (i=0; i < fruits.length; ++i) { members = document.getElementById(fruits[i]).getAttribute("data-makes"); tmp = members.split(","); output[i] = new Object(); for (k=0; k < tmp.length;...
35,661,088
I am new to bootstrap and I am attempting to learn the basics. However, I have put a color background for the div and it is only appears when I have resize the browser. Here is my code: ``` <html> <body> <div id="header"> <div class="col-md-8"><img src="images/logo.png"></div> <div class="col-md-...
2016/02/26
[ "https://Stackoverflow.com/questions/35661088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5335546/" ]
Here's an alternative method you might find useful in the future. ``` // loop over the fruits var arr = fruits.reduce(function (fp, fc) { // get the string (in your example the data-makes value) // and add each to a new object var temp = makes[fc].split(', ').reduce(function (p, c, i) { p[i + 1] = c; re...
try this: ``` var fruits = ["Apple", "Banana"], i, k, members, tmp, output = []; var final = []; for (i=0; i < fruits.length; ++i) { members = document.getElementById(fruits[i]).getAttribute("data-makes"); tmp = members.split(","); output[i] = new Object(); for (k=0; k < tmp.length;...
35,661,088
I am new to bootstrap and I am attempting to learn the basics. However, I have put a color background for the div and it is only appears when I have resize the browser. Here is my code: ``` <html> <body> <div id="header"> <div class="col-md-8"><img src="images/logo.png"></div> <div class="col-md-...
2016/02/26
[ "https://Stackoverflow.com/questions/35661088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5335546/" ]
You might want to try something like this. You will have to replace the hard coded elements... ```js var fruits = ["Apple", "Banana"]; var tempString = "Pie,Dumpling,Cider"; var tempArray = new Array(); tempArray.push(tempString); tempString = "Bread,Republic"; tempArray.push(tempString); var output = {}; for (...
First, remember that JSON keys are always Strings -- no integers. ``` ["Apple", "Banana"] // data-makes="Pie,Dumpling,Cider", data-makes="Bread,Republic" var output = []; var type; var fruits = ["Apple", "Banana"]; for (i=0; i < fruits.length; ++i) { members = document.getElementById(fruits[i]).getAttribute("data-m...
35,661,088
I am new to bootstrap and I am attempting to learn the basics. However, I have put a color background for the div and it is only appears when I have resize the browser. Here is my code: ``` <html> <body> <div id="header"> <div class="col-md-8"><img src="images/logo.png"></div> <div class="col-md-...
2016/02/26
[ "https://Stackoverflow.com/questions/35661088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5335546/" ]
You might want to try something like this. You will have to replace the hard coded elements... ```js var fruits = ["Apple", "Banana"]; var tempString = "Pie,Dumpling,Cider"; var tempArray = new Array(); tempArray.push(tempString); tempString = "Bread,Republic"; tempArray.push(tempString); var output = {}; for (...
You have two problems in your code: First, you're never putting `fruits[i]` in the `output` array. Second, you can't assign to `output[i][k+1]` until you first initialize `output[i]` to be an array or object. ``` for (i=0; i < fruits.length; ++i) { output.push(fruits[i]); var members = document.getElementById(f...
35,661,088
I am new to bootstrap and I am attempting to learn the basics. However, I have put a color background for the div and it is only appears when I have resize the browser. Here is my code: ``` <html> <body> <div id="header"> <div class="col-md-8"><img src="images/logo.png"></div> <div class="col-md-...
2016/02/26
[ "https://Stackoverflow.com/questions/35661088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5335546/" ]
You might want to try something like this. You will have to replace the hard coded elements... ```js var fruits = ["Apple", "Banana"]; var tempString = "Pie,Dumpling,Cider"; var tempArray = new Array(); tempArray.push(tempString); tempString = "Bread,Republic"; tempArray.push(tempString); var output = {}; for (...
Here's an alternative method you might find useful in the future. ``` // loop over the fruits var arr = fruits.reduce(function (fp, fc) { // get the string (in your example the data-makes value) // and add each to a new object var temp = makes[fc].split(', ').reduce(function (p, c, i) { p[i + 1] = c; re...
35,661,088
I am new to bootstrap and I am attempting to learn the basics. However, I have put a color background for the div and it is only appears when I have resize the browser. Here is my code: ``` <html> <body> <div id="header"> <div class="col-md-8"><img src="images/logo.png"></div> <div class="col-md-...
2016/02/26
[ "https://Stackoverflow.com/questions/35661088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5335546/" ]
Here's an alternative method you might find useful in the future. ``` // loop over the fruits var arr = fruits.reduce(function (fp, fc) { // get the string (in your example the data-makes value) // and add each to a new object var temp = makes[fc].split(', ').reduce(function (p, c, i) { p[i + 1] = c; re...
First, remember that JSON keys are always Strings -- no integers. ``` ["Apple", "Banana"] // data-makes="Pie,Dumpling,Cider", data-makes="Bread,Republic" var output = []; var type; var fruits = ["Apple", "Banana"]; for (i=0; i < fruits.length; ++i) { members = document.getElementById(fruits[i]).getAttribute("data-m...
35,661,088
I am new to bootstrap and I am attempting to learn the basics. However, I have put a color background for the div and it is only appears when I have resize the browser. Here is my code: ``` <html> <body> <div id="header"> <div class="col-md-8"><img src="images/logo.png"></div> <div class="col-md-...
2016/02/26
[ "https://Stackoverflow.com/questions/35661088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5335546/" ]
Here's an alternative method you might find useful in the future. ``` // loop over the fruits var arr = fruits.reduce(function (fp, fc) { // get the string (in your example the data-makes value) // and add each to a new object var temp = makes[fc].split(', ').reduce(function (p, c, i) { p[i + 1] = c; re...
You have two problems in your code: First, you're never putting `fruits[i]` in the `output` array. Second, you can't assign to `output[i][k+1]` until you first initialize `output[i]` to be an array or object. ``` for (i=0; i < fruits.length; ++i) { output.push(fruits[i]); var members = document.getElementById(f...
40,378
I am performing 10-folds cross-validation to evaluate the performances of a series of models (variable selection + regression) with R. I created manually the folds with this [code](https://stats.stackexchange.com/questions/61090/how-to-split-a-data-set-to-do-10-fold-cross-validation). At the moment I'm performing fir...
2018/10/29
[ "https://datascience.stackexchange.com/questions/40378", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/56923/" ]
I recommend trying both (more than once), and exploring any differences. In my experience, using the same set of folds for all models or using a new set of folds for each model doesn't make any material difference. Post if you find different! Regarding "I'm performing first variable selection, then hyperparameters tun...
If you want to evaluate the performance of different models i.e. Model Benchmarking, it is necessary to keep the input environment same i.e. any external input like CV (number of folds). While you can tune the model-specific parameters to optimize the model.
40,378
I am performing 10-folds cross-validation to evaluate the performances of a series of models (variable selection + regression) with R. I created manually the folds with this [code](https://stats.stackexchange.com/questions/61090/how-to-split-a-data-set-to-do-10-fold-cross-validation). At the moment I'm performing fir...
2018/10/29
[ "https://datascience.stackexchange.com/questions/40378", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/56923/" ]
I recommend trying both (more than once), and exploring any differences. In my experience, using the same set of folds for all models or using a new set of folds for each model doesn't make any material difference. Post if you find different! Regarding "I'm performing first variable selection, then hyperparameters tun...
IMHO I would use the same fold for all models. First of all it can be reproducible and you are evaluating all models with the same data. So it's the same environment for benchmarking. Also you can use folds predictions for stacking. ps: You can try to use validation set for hyperparameters tuning.
26,231,939
I am learning Laravel as my first framework, I saw, they have own syntax for create forms eg: Laravel Inputs: ``` {{ Form::text('email', '', array('placeholder' => 'Email')) }} {{ Form::password('password', array('placeholder' => 'Password')) }} {{ Form::submit('Login', array('class' => 'btn btn-success')...
2014/10/07
[ "https://Stackoverflow.com/questions/26231939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3099298/" ]
There are many advantages of using the Laravel syntax. 1. The Laravel Form automatically adds CSRF protection . 2. You can autofill form easily using the Form::model() instead of the plain PHP. 3. Your code remains clean and consistent and is not filled with a mix of HTML and PHP 4. It gives extensibility i.e others ...
* Cleaner syntax. Compare for example a traditional HTML select vs using [`Form::select('name', $array)`](http://laravel.com/docs/4.2/html#drop-down-lists). * Integrated [CSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) protection. * Integrated URLs to named routes, actions and RESTful controllers of your...
26,231,939
I am learning Laravel as my first framework, I saw, they have own syntax for create forms eg: Laravel Inputs: ``` {{ Form::text('email', '', array('placeholder' => 'Email')) }} {{ Form::password('password', array('placeholder' => 'Password')) }} {{ Form::submit('Login', array('class' => 'btn btn-success')...
2014/10/07
[ "https://Stackoverflow.com/questions/26231939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3099298/" ]
There are many advantages of using the Laravel syntax. 1. The Laravel Form automatically adds CSRF protection . 2. You can autofill form easily using the Form::model() instead of the plain PHP. 3. Your code remains clean and consistent and is not filled with a mix of HTML and PHP 4. It gives extensibility i.e others ...
Laravel's [Blade synta](http://laravel.com/docs/4.2/templates)x based on ASP.NET's Razor can be very useful because it allows for template inheritance and it has useful syntax sugar for control structures like `if` and `for` and it helps with CSRF by assigning a token to your forms and verifying it when they're posted....
26,231,939
I am learning Laravel as my first framework, I saw, they have own syntax for create forms eg: Laravel Inputs: ``` {{ Form::text('email', '', array('placeholder' => 'Email')) }} {{ Form::password('password', array('placeholder' => 'Password')) }} {{ Form::submit('Login', array('class' => 'btn btn-success')...
2014/10/07
[ "https://Stackoverflow.com/questions/26231939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3099298/" ]
* Cleaner syntax. Compare for example a traditional HTML select vs using [`Form::select('name', $array)`](http://laravel.com/docs/4.2/html#drop-down-lists). * Integrated [CSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) protection. * Integrated URLs to named routes, actions and RESTful controllers of your...
Laravel's [Blade synta](http://laravel.com/docs/4.2/templates)x based on ASP.NET's Razor can be very useful because it allows for template inheritance and it has useful syntax sugar for control structures like `if` and `for` and it helps with CSRF by assigning a token to your forms and verifying it when they're posted....
908,077
I'm looking at the PayPal `IPN docs`, and it says the `datetime` stamps of their strings are formatted as: ``` HH:MM:SS DD Mmm YY, YYYY PST ``` So year is specified twice? Once in double digits, and another with 4 digits? This looks bizarre.
2009/05/25
[ "https://Stackoverflow.com/questions/908077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73398/" ]
This seems to be a bug in the documentation. The actual format should be "HH:MM:SS Mmm DD, YYYY PST" (e.g. "08:30:06 Apr 19, 2017 PDT")
Complete date plus hours, minutes, seconds and a decimal fraction of a second YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) Where TZD = time zone designator (Z or +hh:mm or -hh:mm) Example 1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time. 1994-11-05T13:15:3...
908,077
I'm looking at the PayPal `IPN docs`, and it says the `datetime` stamps of their strings are formatted as: ``` HH:MM:SS DD Mmm YY, YYYY PST ``` So year is specified twice? Once in double digits, and another with 4 digits? This looks bizarre.
2009/05/25
[ "https://Stackoverflow.com/questions/908077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73398/" ]
Complete date plus hours, minutes, seconds and a decimal fraction of a second YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) Where TZD = time zone designator (Z or +hh:mm or -hh:mm) Example 1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time. 1994-11-05T13:15:3...
Actually, I think the right format is: yyyy-MM-ddTHH:MM:ssZ The case is important.
908,077
I'm looking at the PayPal `IPN docs`, and it says the `datetime` stamps of their strings are formatted as: ``` HH:MM:SS DD Mmm YY, YYYY PST ``` So year is specified twice? Once in double digits, and another with 4 digits? This looks bizarre.
2009/05/25
[ "https://Stackoverflow.com/questions/908077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73398/" ]
this is the correct format according to their documentation - 2010-03-27T12:34:49Z so it is - YYYY-MM-DDTHH:MM:SSZ (I don't know what the T in the middle and Z is but it's constant for all the dates) I've created PayPal NVP library in Java, so if you want to check how it works, or use it, you are more than welcome. it...
Complete date plus hours, minutes, seconds and a decimal fraction of a second YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) Where TZD = time zone designator (Z or +hh:mm or -hh:mm) Example 1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time. 1994-11-05T13:15:3...