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
18,715,775
I switched my project from pg2.9 to 3.0 and got one issue which drives me crazy, and I am not able to fix it now:( So, basically everything is working fine, but not backbutton event listener. ```js bindEvents: function() { document.addEventListener('deviceready', this.onDeviceReady, false); }, ...
2013/09/10
[ "https://Stackoverflow.com/questions/18715775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/800278/" ]
Ok, fixed this. For some reason phonegap is not adding their plugin called App which have all that functions. just add to config.xml next lines: ``` <feature name="App"> <param name="android-package" value="org.apache.cordova.App" /> </feature> ```
I faced this bug after upgrading to cordova 3.1. Turns out that this has to be explicitly added in config.xml phonegap 3.\* onwards. ``` <feature name="App"> <param name="android-package" value="org.apache.cordova.App" /> </feature> ``` See this [link](http://www.icenium.com/resources/forums/icenium-gene...
75,946
Edit: everyone who's answered has been very helpful -- I tried to select all 3 answers as "the" answer but in the end it only let me choose one. Thanks to all! I'm interested in purchasing my first pair of clipless bike shoes, principally in order to get the bike fitted properly, but also for performance reasons. I've...
2021/04/01
[ "https://bicycles.stackexchange.com/questions/75946", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50677/" ]
Your shoes should fit quite snug. That means that the heel should not move up and down when you are trying it. Later when riding you will want to pull the pedal with your foot. On the other hand it should not restrict your blood flow or otherwise painfully press on any portion of the foot. Be aware that for a gravel ...
> > I'm interested in purchasing my first pair of clipless bike shoes, principally in order to get the bike fitted properly, but also for performance reasons. I've put it off until now because I've been a bit nervous about getting stuck and falling over. > > > Don't be nervous. You'll learn the unclipping motion i...
75,946
Edit: everyone who's answered has been very helpful -- I tried to select all 3 answers as "the" answer but in the end it only let me choose one. Thanks to all! I'm interested in purchasing my first pair of clipless bike shoes, principally in order to get the bike fitted properly, but also for performance reasons. I've...
2021/04/01
[ "https://bicycles.stackexchange.com/questions/75946", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50677/" ]
You need shoes, cleats and pedals all to be compatible. (There's also an implication that you have two feet, and nothing unusual there.) Shoes have to fit your feet comfortably, with a close fit around the rear and across the instep. Personally I find a slight roominess around the toes to be ideal. You can get shoes ...
> > I'm interested in purchasing my first pair of clipless bike shoes, principally in order to get the bike fitted properly, but also for performance reasons. I've put it off until now because I've been a bit nervous about getting stuck and falling over. > > > Don't be nervous. You'll learn the unclipping motion i...
75,946
Edit: everyone who's answered has been very helpful -- I tried to select all 3 answers as "the" answer but in the end it only let me choose one. Thanks to all! I'm interested in purchasing my first pair of clipless bike shoes, principally in order to get the bike fitted properly, but also for performance reasons. I've...
2021/04/01
[ "https://bicycles.stackexchange.com/questions/75946", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/50677/" ]
One minor thing may be worth mentioning: different brands tend to make shoes that fit differently. From your other footwear, you may have got the sense that your feet are relatively wide or narrow, or you may have got the sense that they're relatively high volume (aka high instep). If you have feedback like this, ask s...
> > I'm interested in purchasing my first pair of clipless bike shoes, principally in order to get the bike fitted properly, but also for performance reasons. I've put it off until now because I've been a bit nervous about getting stuck and falling over. > > > Don't be nervous. You'll learn the unclipping motion i...
26,511,664
I have the following: ``` hive> CREATE TABLE foo (bar timestamp) STORED AS ORC; OK Time taken: 0.041 seconds hive> INSERT INTO TABLE foo VALUES ('2014-01-17 00:17:13'); NoViableAltException(26@[]) at org.apache.hadoop.hive.ql.parse.HiveParser_SelectClauseParser.selectClause(HiveParser_SelectClauseParser.java:...
2014/10/22
[ "https://Stackoverflow.com/questions/26511664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/127508/" ]
According to [Hive Language Manual](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-InsertingvaluesintotablesfromSQL) "INSERT...VALUES is available starting in Hive 0.14". So, you have only two options left: 1. Insert timestamp value from existing table or call a function to get ...
This kind of writing is correct: insert into table foo; select '2014-01-17 00:17:13' as bar from foo
23,514,964
I started with my first Apps on Android some days ago. I'm using Eclipse with Android SDK. In every Tutorial, I see Code in onCreate(). But whenever I'm doing something in onCreate(), my App crashes at the start. Do you know what the problem could be? If I do things like ``` Button btn1 = (Button) findViewById(R.id...
2014/05/07
[ "https://Stackoverflow.com/questions/23514964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3611656/" ]
Try: ``` string = 'shid!' reg = Regexp.new string.split('').join('+') !!('shid!' =~ reg) #=> true !!('shid' =~ reg) #=> false !!('shhhhiddd!' =~ reg) #=> true !!('ssssshhhhiiiiiddd!!!!' =~ reg) #=> true !!('hsid!' =~ reg) #=> false ```
I'm not sure I've got the question. But maybe it's what you are looking for: ``` str = 'ssssshhhhiiiiiddd!!!!' str.split('').uniq.join == 'shid!' #=> true ```
23,514,964
I started with my first Apps on Android some days ago. I'm using Eclipse with Android SDK. In every Tutorial, I see Code in onCreate(). But whenever I'm doing something in onCreate(), my App crashes at the start. Do you know what the problem could be? If I do things like ``` Button btn1 = (Button) findViewById(R.id...
2014/05/07
[ "https://Stackoverflow.com/questions/23514964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3611656/" ]
You can do using [`#squeeze`](http://www.ruby-doc.org/core-2.1.1/String.html#method-i-squeeze) ``` str.squeeze == 'shid!' #=> true ```
I'm not sure I've got the question. But maybe it's what you are looking for: ``` str = 'ssssshhhhiiiiiddd!!!!' str.split('').uniq.join == 'shid!' #=> true ```
23,514,964
I started with my first Apps on Android some days ago. I'm using Eclipse with Android SDK. In every Tutorial, I see Code in onCreate(). But whenever I'm doing something in onCreate(), my App crashes at the start. Do you know what the problem could be? If I do things like ``` Button btn1 = (Button) findViewById(R.id...
2014/05/07
[ "https://Stackoverflow.com/questions/23514964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3611656/" ]
Try: ``` string = 'shid!' reg = Regexp.new string.split('').join('+') !!('shid!' =~ reg) #=> true !!('shid' =~ reg) #=> false !!('shhhhiddd!' =~ reg) #=> true !!('ssssshhhhiiiiiddd!!!!' =~ reg) #=> true !!('hsid!' =~ reg) #=> false ```
You can do using [`#squeeze`](http://www.ruby-doc.org/core-2.1.1/String.html#method-i-squeeze) ``` str.squeeze == 'shid!' #=> true ```
39,305,257
I'm trying to pre select a table row when the view load, however i have tried several methods, but none seem to work. At first i've set following two methods in order to define the textColor changes when a row is selected and deselected ``` open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: Inde...
2016/09/03
[ "https://Stackoverflow.com/questions/39305257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4034437/" ]
According Apple's documentation: Calling **selectRowAtIndexPath** does not cause the delegate to receive a tableView(*:willSelectRowAt:) or tableView(*:didSelectRowAt:) message <https://developer.apple.com/reference/uikit/uitableview/1614875-selectrowatindexpath> --- So in viewDidAppear method you should call manua...
Is this what you're after? ``` override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) let iPath = NSIndexPath(forRow: 0, inSection: 0) tableView.selectRowAtIndexPath(iPath, animated: true, scrollPosition: .Top ) } ```
39,305,257
I'm trying to pre select a table row when the view load, however i have tried several methods, but none seem to work. At first i've set following two methods in order to define the textColor changes when a row is selected and deselected ``` open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: Inde...
2016/09/03
[ "https://Stackoverflow.com/questions/39305257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4034437/" ]
Is this what you're after? ``` override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) let iPath = NSIndexPath(forRow: 0, inSection: 0) tableView.selectRowAtIndexPath(iPath, animated: true, scrollPosition: .Top ) } ```
Remember that `tableView(_:didSelectRowAt:)` is part of a delegate protocol designed to handle user interactions with the `UITableView` instance. It is therefore called in response to user interaction, not programatic changes. To resolve this, move your appearance changes into a separate function called something like...
39,305,257
I'm trying to pre select a table row when the view load, however i have tried several methods, but none seem to work. At first i've set following two methods in order to define the textColor changes when a row is selected and deselected ``` open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: Inde...
2016/09/03
[ "https://Stackoverflow.com/questions/39305257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4034437/" ]
Is this what you're after? ``` override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) let iPath = NSIndexPath(forRow: 0, inSection: 0) tableView.selectRowAtIndexPath(iPath, animated: true, scrollPosition: .Top ) } ```
I think it's most appropriate to select the row in the `viewWillAppear` method as the view must have been fully initialized. The example below selects the first cell of the first section: ```swift override func viewWillAppear(_ animated: Bool) { let selectedIndexPath = IndexPath(row: 0, section: 0) tableView....
39,305,257
I'm trying to pre select a table row when the view load, however i have tried several methods, but none seem to work. At first i've set following two methods in order to define the textColor changes when a row is selected and deselected ``` open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: Inde...
2016/09/03
[ "https://Stackoverflow.com/questions/39305257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4034437/" ]
According Apple's documentation: Calling **selectRowAtIndexPath** does not cause the delegate to receive a tableView(*:willSelectRowAt:) or tableView(*:didSelectRowAt:) message <https://developer.apple.com/reference/uikit/uitableview/1614875-selectrowatindexpath> --- So in viewDidAppear method you should call manua...
Remember that `tableView(_:didSelectRowAt:)` is part of a delegate protocol designed to handle user interactions with the `UITableView` instance. It is therefore called in response to user interaction, not programatic changes. To resolve this, move your appearance changes into a separate function called something like...
39,305,257
I'm trying to pre select a table row when the view load, however i have tried several methods, but none seem to work. At first i've set following two methods in order to define the textColor changes when a row is selected and deselected ``` open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: Inde...
2016/09/03
[ "https://Stackoverflow.com/questions/39305257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4034437/" ]
According Apple's documentation: Calling **selectRowAtIndexPath** does not cause the delegate to receive a tableView(*:willSelectRowAt:) or tableView(*:didSelectRowAt:) message <https://developer.apple.com/reference/uikit/uitableview/1614875-selectrowatindexpath> --- So in viewDidAppear method you should call manua...
I think it's most appropriate to select the row in the `viewWillAppear` method as the view must have been fully initialized. The example below selects the first cell of the first section: ```swift override func viewWillAppear(_ animated: Bool) { let selectedIndexPath = IndexPath(row: 0, section: 0) tableView....
490,663
I've found some references, [when looking for information on WAIK installs of Windows 8](http://www.eightforums.com/installation-setup/6824-professional-core-editions-windows-8-both-rp-setup-iso.html) of a varient called Windows 8 core, that can be installed off the professional edition disk. There's also a mention of ...
2012/10/21
[ "https://superuser.com/questions/490663", "https://superuser.com", "https://superuser.com/users/10165/" ]
Windows 8 (Core) is simply Windows 8. It's the base (core) product, which Pro and Enterprise built on. And I say that because I can find no official reference to a *Core product* and it was in parenthesis in your source (compared to the other editions where no parenthesis was used).
**The "Core" from "Windows 8 Core" simply emphasizes it is the "plain" Windows 8 and not one of the other versions (Pro, Enterprise, RT).** Paul Thurrott of WinSuperSite explicitly names Windows 8 Core in his giant [comparison table of different Windows 8 editions](http://www.winsupersite.com/article/windows8/windows-...
490,663
I've found some references, [when looking for information on WAIK installs of Windows 8](http://www.eightforums.com/installation-setup/6824-professional-core-editions-windows-8-both-rp-setup-iso.html) of a varient called Windows 8 core, that can be installed off the professional edition disk. There's also a mention of ...
2012/10/21
[ "https://superuser.com/questions/490663", "https://superuser.com", "https://superuser.com/users/10165/" ]
Windows 8 (Core) is simply Windows 8. It's the base (core) product, which Pro and Enterprise built on. And I say that because I can find no official reference to a *Core product* and it was in parenthesis in your source (compared to the other editions where no parenthesis was used).
It means the "Home" edition for all intents and purposes. Perhaps the best source for this is MSFT's own site (for Windows programmers). Search for "PRODUCT\_CORE" here (which programmers rely on) and look at the "Meaning" column: <https://msdn.microsoft.com/en-us/library/windows/desktop/ms724358(v=vs.85).aspx> Note ...
490,663
I've found some references, [when looking for information on WAIK installs of Windows 8](http://www.eightforums.com/installation-setup/6824-professional-core-editions-windows-8-both-rp-setup-iso.html) of a varient called Windows 8 core, that can be installed off the professional edition disk. There's also a mention of ...
2012/10/21
[ "https://superuser.com/questions/490663", "https://superuser.com", "https://superuser.com/users/10165/" ]
**The "Core" from "Windows 8 Core" simply emphasizes it is the "plain" Windows 8 and not one of the other versions (Pro, Enterprise, RT).** Paul Thurrott of WinSuperSite explicitly names Windows 8 Core in his giant [comparison table of different Windows 8 editions](http://www.winsupersite.com/article/windows8/windows-...
It means the "Home" edition for all intents and purposes. Perhaps the best source for this is MSFT's own site (for Windows programmers). Search for "PRODUCT\_CORE" here (which programmers rely on) and look at the "Meaning" column: <https://msdn.microsoft.com/en-us/library/windows/desktop/ms724358(v=vs.85).aspx> Note ...
128,522
I'm working in a software company in India where I have lodged a complaint to the owner regarding a director I have had difficulties with. Now I am applying for a position in a new company but the director (whom I complained about) is withholding providing verification of my employment unless I withdraw my complaint....
2019/02/08
[ "https://workplace.stackexchange.com/questions/128522", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/99391/" ]
This is an unpleasant situation - it's certainly not fair or right that the director is holding your verification to ransom in this manner. That said however - if there is no-one else in the company who can provide you with the verification (Company owner maybe?) then ultimately you're going to have to choose whether ...
Bullies enjoy power and hate it when that power is worked around or removed. Best way for that to happen for you to get alternative proof of employment and any proof you can of the situation you are in. 1. Get copies of any e-mails relating to the complaint. Anything that goes back and forth to show that it is an on-g...
128,522
I'm working in a software company in India where I have lodged a complaint to the owner regarding a director I have had difficulties with. Now I am applying for a position in a new company but the director (whom I complained about) is withholding providing verification of my employment unless I withdraw my complaint....
2019/02/08
[ "https://workplace.stackexchange.com/questions/128522", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/99391/" ]
This is an unpleasant situation - it's certainly not fair or right that the director is holding your verification to ransom in this manner. That said however - if there is no-one else in the company who can provide you with the verification (Company owner maybe?) then ultimately you're going to have to choose whether ...
For some reason I'd make the point to this director and raise another complaint against him about withholding the letter of employment and his attempt of blackmail... I'd bet the owner would love to hear about this too; and bullies will only stop when someone doesn't back down. I'd also go around him and ask the HR te...
128,522
I'm working in a software company in India where I have lodged a complaint to the owner regarding a director I have had difficulties with. Now I am applying for a position in a new company but the director (whom I complained about) is withholding providing verification of my employment unless I withdraw my complaint....
2019/02/08
[ "https://workplace.stackexchange.com/questions/128522", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/99391/" ]
Bullies enjoy power and hate it when that power is worked around or removed. Best way for that to happen for you to get alternative proof of employment and any proof you can of the situation you are in. 1. Get copies of any e-mails relating to the complaint. Anything that goes back and forth to show that it is an on-g...
For some reason I'd make the point to this director and raise another complaint against him about withholding the letter of employment and his attempt of blackmail... I'd bet the owner would love to hear about this too; and bullies will only stop when someone doesn't back down. I'd also go around him and ask the HR te...
52,919,047
I have thousands of URLs and I want to extract domain names. I am using the following regex to do this: `http://|https://|www\\.` This manages to extract domains like so: ``` elpais.com veren.elpais.com canaris7.es vertele.eldiario.es eldiario.es ``` The problem is that I want to only extract the domain -- that is...
2018/10/21
[ "https://Stackoverflow.com/questions/52919047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7901537/" ]
This regular expression `.*\\.(.*\\.(com|es))` used with `sub` to call the group (which is between parentheses) will do it. ``` url <- c( "http://www.elpais.com", "http://www.veren.elpais.com", "http://www.canaris7.es", "http://www.vertele.eldiario.es", "http://www.eldiario.es" ) sub(".*\\.(.*\\.(com|es))"...
I think that you just want the last two components of the URL. You can get that from `sub` and a regular expression. ``` URLs = c("http://www.elpais.com", "http://veren.elpais.com", "http://www.canaris7.es", "http://vertele.eldiario.es", "http://eldiario.es") sub(".*\\b(\\w+\\.\\w+)", "\\1", URLs) [1] "elpais.com" ...
1,127,223
I want to request reports from a third party and they require "Basic Access Authentication" via POST: > > > ``` > Your client application must use Basic Access Authentication > to send the user name and password. > > ``` > > Can someone point me in the right direction? Edit: I did see [this post](https://stack...
2009/07/14
[ "https://Stackoverflow.com/questions/1127223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71904/" ]
Assuming you use a WebRequest, you attach a CredentialCache to your request: ``` NetworkCredential nc = new NetworkCredential("user", "password"); CredentialCache cc = new CredentialCache(); cc.Add("www.site.com", 443, "Basic", nc); WebRequest request = WebRequest.Create("https://www.s...
The basic gist is like this: ``` HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = WebRequestMethods.Http.Get; request.Credentials = new NetworkCredential(username, password); ``` but sometimes there are issues with using request credentials, the alternative is add the authenticat...
24,570,445
[In Swift documentation, it says the following](https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/swift_programming_language/TypeCasting.html#//apple_ref/doc/uid/TP40014097-CH22-XID_448): > > Swift provides two special type aliases for working with non-specific types: > > AnyObject ca...
2014/07/04
[ "https://Stackoverflow.com/questions/24570445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2360798/" ]
Apart from just creating a C function somewhere, you could also add a [category](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html) to `NSString`, which would probably be more in keeping with the Objective-C philos...
Use plain C methods, for example: ``` // .h file NSNumber *sum(NSNumber *x, NSNumber *y); // .m file NSNumber *sum(NSNumber *x, NSNumber *y) { return @(x.intValue + y.intValue); } ```
24,570,445
[In Swift documentation, it says the following](https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/swift_programming_language/TypeCasting.html#//apple_ref/doc/uid/TP40014097-CH22-XID_448): > > Swift provides two special type aliases for working with non-specific types: > > AnyObject ca...
2014/07/04
[ "https://Stackoverflow.com/questions/24570445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2360798/" ]
Apart from just creating a C function somewhere, you could also add a [category](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html) to `NSString`, which would probably be more in keeping with the Objective-C philos...
Objective C does not have functions, it only has methods. If you want to write function use plain C.
1,146,132
getc (stdin) reads keyboard input to integers, but what if I want to read keyboard input to character strings? ``` #include "stdafx.h" #include "string.h" #include "stdio.h" void CharReadWrite(FILE *fin); FILE *fptr2; int _tmain(int argc, _TCHAR* argv[]) { char alpha= getc(stdin); char filename=alpha; ...
2009/07/17
[ "https://Stackoverflow.com/questions/1146132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
Continuing with the theme of getc you can use `fgets` to read a line of input into a character buffer. E.g. ``` char buffer[1024]; char *line = fgets(buffer, sizeof(buffer), stdin); if( !line ) { if( feof(stdin) ) { printf("end of file\n"); } else if( ferror(stdin) ) { printf("An error occurerd\n"); ...
A character (ASCII) is just an unsigned 8 bit integral value, ie. it can have a value between 0-255. If you have a look at an ASCII table you can see how the integer values map to characters. But in general you can just jump between the types, ie: ``` int chInt = getc(stdin); char ch = chInt; // more simple char ch =...
1,146,132
getc (stdin) reads keyboard input to integers, but what if I want to read keyboard input to character strings? ``` #include "stdafx.h" #include "string.h" #include "stdio.h" void CharReadWrite(FILE *fin); FILE *fptr2; int _tmain(int argc, _TCHAR* argv[]) { char alpha= getc(stdin); char filename=alpha; ...
2009/07/17
[ "https://Stackoverflow.com/questions/1146132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
A character (ASCII) is just an unsigned 8 bit integral value, ie. it can have a value between 0-255. If you have a look at an ASCII table you can see how the integer values map to characters. But in general you can just jump between the types, ie: ``` int chInt = getc(stdin); char ch = chInt; // more simple char ch =...
Since you already are mixing "C" code with "C++" by using printf, why not continue and use [scanf](http://www.cplusplus.com/reference/clibrary/cstdio/scanf/) `scanf("%s", &mystring);` in order to read and format it all nicely ? Or of course what already was said.. [getline](http://www.cplusplus.com/reference/iostream/...
1,146,132
getc (stdin) reads keyboard input to integers, but what if I want to read keyboard input to character strings? ``` #include "stdafx.h" #include "string.h" #include "stdio.h" void CharReadWrite(FILE *fin); FILE *fptr2; int _tmain(int argc, _TCHAR* argv[]) { char alpha= getc(stdin); char filename=alpha; ...
2009/07/17
[ "https://Stackoverflow.com/questions/1146132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
Continuing with the theme of getc you can use `fgets` to read a line of input into a character buffer. E.g. ``` char buffer[1024]; char *line = fgets(buffer, sizeof(buffer), stdin); if( !line ) { if( feof(stdin) ) { printf("end of file\n"); } else if( ferror(stdin) ) { printf("An error occurerd\n"); ...
<http://www.cplusplus.com/reference/iostream/istream/getline/> Ta da!
1,146,132
getc (stdin) reads keyboard input to integers, but what if I want to read keyboard input to character strings? ``` #include "stdafx.h" #include "string.h" #include "stdio.h" void CharReadWrite(FILE *fin); FILE *fptr2; int _tmain(int argc, _TCHAR* argv[]) { char alpha= getc(stdin); char filename=alpha; ...
2009/07/17
[ "https://Stackoverflow.com/questions/1146132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
<http://www.cplusplus.com/reference/iostream/istream/getline/> Ta da!
Since you already are mixing "C" code with "C++" by using printf, why not continue and use [scanf](http://www.cplusplus.com/reference/clibrary/cstdio/scanf/) `scanf("%s", &mystring);` in order to read and format it all nicely ? Or of course what already was said.. [getline](http://www.cplusplus.com/reference/iostream/...
1,146,132
getc (stdin) reads keyboard input to integers, but what if I want to read keyboard input to character strings? ``` #include "stdafx.h" #include "string.h" #include "stdio.h" void CharReadWrite(FILE *fin); FILE *fptr2; int _tmain(int argc, _TCHAR* argv[]) { char alpha= getc(stdin); char filename=alpha; ...
2009/07/17
[ "https://Stackoverflow.com/questions/1146132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
Continuing with the theme of getc you can use `fgets` to read a line of input into a character buffer. E.g. ``` char buffer[1024]; char *line = fgets(buffer, sizeof(buffer), stdin); if( !line ) { if( feof(stdin) ) { printf("end of file\n"); } else if( ferror(stdin) ) { printf("An error occurerd\n"); ...
Since you already are mixing "C" code with "C++" by using printf, why not continue and use [scanf](http://www.cplusplus.com/reference/clibrary/cstdio/scanf/) `scanf("%s", &mystring);` in order to read and format it all nicely ? Or of course what already was said.. [getline](http://www.cplusplus.com/reference/iostream/...
11,881,638
This seemed simply but i'm running into a problem. I'm building an autocomplete drop down box using jquery ui. It works fine with static information but when i try put dynamic data from mysql in the array it freaks out. Parse error: syntax error, unexpected T\_DO, expecting ')' on line 46 Line 46 is the do in the arr...
2012/08/09
[ "https://Stackoverflow.com/questions/11881638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1124199/" ]
You can't execute code inside an array statement. Please read the manual for the [array](http://il.php.net/manual/en/function.array.php) method. It excepts values , not code. You should initialise your array , and then use your do/while loop to populate data. ```php $items = array(); do{ $items[] = $row['artist...
Your code should be like below, even should not use `do ... while` loop. ``` while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) { $items[] = $row_Recordset1 ['ARTIST']; } ```
11,288,791
I am doing a test to see if the connection string user ID is a sys Admin. But my code keeps breaking when i try return the value of the bit? To do this i use the following stored proc: ``` ALTER PROCEDURE [dbo].[CheckIfAdmin] @SQLLoginName nvarchar(50), @IsAdmin bit OUTPUT As SET @IsAdmin = IS_SRVROLEMEMBER('sysad...
2012/07/02
[ "https://Stackoverflow.com/questions/11288791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356321/" ]
You've missed the `ExecuteXXXXX`() method. ``` con.Open(); cmd1.ExecuteNonQuery(); // cmd1.ExecuteScalar(); con.Close(); ```
You didn't execute between opening and closing the connection.
18,088,662
I want to allow users to copy a large number of email addresses to their clipboard. This answer seemed like the most reliable way to do that: [How do I copy to the clipboard in JavaScript?](https://stackoverflow.com/questions/400212/how-to-copy-to-the-clipboard-in-javascript?rq=1) However, when testing I found that `...
2013/08/06
[ "https://Stackoverflow.com/questions/18088662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1101095/" ]
The character limit for the prompt seems to be the reason like MVP said. There is a pretty better workaround for it. Use a `textarea` with the emails text as its content and use the `select` function to select the whole text in the textarea like you did with the prompt. Example: ``` $('#container').append('To copy em...
The window.prompt() function is limited to 2000 characters in Chromium. If the input string exceeds this limit (your example has 2059 characters), the input string is cut in the middle marked with dots. This is called an [ellipsis](http://en.wikipedia.org/wiki/Ellipsis). Here's a demonstration using exactly 2000 chara...
18,088,662
I want to allow users to copy a large number of email addresses to their clipboard. This answer seemed like the most reliable way to do that: [How do I copy to the clipboard in JavaScript?](https://stackoverflow.com/questions/400212/how-to-copy-to-the-clipboard-in-javascript?rq=1) However, when testing I found that `...
2013/08/06
[ "https://Stackoverflow.com/questions/18088662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1101095/" ]
The window.prompt() function is limited to 2000 characters in Chromium. If the input string exceeds this limit (your example has 2059 characters), the input string is cut in the middle marked with dots. This is called an [ellipsis](http://en.wikipedia.org/wiki/Ellipsis). Here's a demonstration using exactly 2000 chara...
If I had more reputation points I would comment on Jitesh's answer... If you aren't using jquery, you can't do this: ``` emailsTxtArea.select().focus(); ``` Instead you have to do this: ``` emailsTxtArea.select(); emailsTxtArea.focus(); ``` In regular javascript, the select method doesn't return the object.
18,088,662
I want to allow users to copy a large number of email addresses to their clipboard. This answer seemed like the most reliable way to do that: [How do I copy to the clipboard in JavaScript?](https://stackoverflow.com/questions/400212/how-to-copy-to-the-clipboard-in-javascript?rq=1) However, when testing I found that `...
2013/08/06
[ "https://Stackoverflow.com/questions/18088662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1101095/" ]
The character limit for the prompt seems to be the reason like MVP said. There is a pretty better workaround for it. Use a `textarea` with the emails text as its content and use the `select` function to select the whole text in the textarea like you did with the prompt. Example: ``` $('#container').append('To copy em...
If I had more reputation points I would comment on Jitesh's answer... If you aren't using jquery, you can't do this: ``` emailsTxtArea.select().focus(); ``` Instead you have to do this: ``` emailsTxtArea.select(); emailsTxtArea.focus(); ``` In regular javascript, the select method doesn't return the object.
130,373
I'm in the middle of updating the colours of our app and making them as consistent as possible, but also trying to bring them in line with the WCAG AA rating for contrast. One area I'm unsure if I need to do this for, is an alert/info message that is displayed say at the top of a form to give users info about any warn...
2019/11/29
[ "https://ux.stackexchange.com/questions/130373", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/117863/" ]
I could see a couple of things happening here: 1. Saying "**None of the above**" could signal the user that he doesn't fit into typical categories of whatever you are trying to distinguish. Not fitting *generally* invokes negative feelings such as feelings of exclusion or not being understood by your environment. 2. "...
It could be a weird inversed effect of Negativy Bias, as the working hypothesis could be related to the idea that respondents liley associate 'none of the above' as a failure and feel compelled to evaluate the question proposed with weighted attention. > > "..people combine information, they weigh negative informatio...
130,373
I'm in the middle of updating the colours of our app and making them as consistent as possible, but also trying to bring them in line with the WCAG AA rating for contrast. One area I'm unsure if I need to do this for, is an alert/info message that is displayed say at the top of a form to give users info about any warn...
2019/11/29
[ "https://ux.stackexchange.com/questions/130373", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/117863/" ]
It could be a weird inversed effect of Negativy Bias, as the working hypothesis could be related to the idea that respondents liley associate 'none of the above' as a failure and feel compelled to evaluate the question proposed with weighted attention. > > "..people combine information, they weigh negative informatio...
I believe the restraint comes from people not wanting to be **no one**. One solution for this is to give an option to describe oneself. [![enter image description here](https://i.stack.imgur.com/mqJS8.png)](https://i.stack.imgur.com/mqJS8.png) You can then collect this data or group all manual entries as "other" on t...
130,373
I'm in the middle of updating the colours of our app and making them as consistent as possible, but also trying to bring them in line with the WCAG AA rating for contrast. One area I'm unsure if I need to do this for, is an alert/info message that is displayed say at the top of a form to give users info about any warn...
2019/11/29
[ "https://ux.stackexchange.com/questions/130373", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/117863/" ]
I could see a couple of things happening here: 1. Saying "**None of the above**" could signal the user that he doesn't fit into typical categories of whatever you are trying to distinguish. Not fitting *generally* invokes negative feelings such as feelings of exclusion or not being understood by your environment. 2. "...
I believe the restraint comes from people not wanting to be **no one**. One solution for this is to give an option to describe oneself. [![enter image description here](https://i.stack.imgur.com/mqJS8.png)](https://i.stack.imgur.com/mqJS8.png) You can then collect this data or group all manual entries as "other" on t...
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
This is probably due to the standard notation of calling parent methods, regardless of state. You could check if the `$this` keyword is set in the `__call` method and if not, make a call to `__callStatic` ? EDIT: This isn't a bug per se, the static call is being made from an object context. Take a look at [this bug th...
Inheritance of static methods is a bit weird in PHP. I suspect you need to redefine `__callStatic` in `B`
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
After thinking about it, it's not really a bug. But it's definitely unintuitive. ``` <?php class A { public function foo() { static::bar(); } public function bar() { echo "bar()\n"; } } $a = new A(); $a->foo(); ``` This is valid, and calls bar(). It does not mean call bar statically. It means t...
This is probably due to the standard notation of calling parent methods, regardless of state. You could check if the `$this` keyword is set in the `__call` method and if not, make a call to `__callStatic` ? EDIT: This isn't a bug per se, the static call is being made from an object context. Take a look at [this bug th...
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
This is probably due to the standard notation of calling parent methods, regardless of state. You could check if the `$this` keyword is set in the `__call` method and if not, make a call to `__callStatic` ? EDIT: This isn't a bug per se, the static call is being made from an object context. Take a look at [this bug th...
First, make sure you're using PHP 5.3.0 or newer, as that's when \_\_callStatic was implemented. It all seems to work as expected, see this example: ``` <?php class A { public function __call($method, $args) { echo 'A::__call, ' . var_export(array($method, $args), true), PHP_EOL; } /** ...
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
This is probably due to the standard notation of calling parent methods, regardless of state. You could check if the `$this` keyword is set in the `__call` method and if not, make a call to `__callStatic` ? EDIT: This isn't a bug per se, the static call is being made from an object context. Take a look at [this bug th...
**Good news** I make a BIG work arround, but it works pretty fine. This is the code: ``` class NoContext { public static function call($callback, $args = null){ return call_user_func_array($callback, $args ?: array()); } } ``` You need to call `NoContext::call` (statically) like you call `call_user_...
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
After thinking about it, it's not really a bug. But it's definitely unintuitive. ``` <?php class A { public function foo() { static::bar(); } public function bar() { echo "bar()\n"; } } $a = new A(); $a->foo(); ``` This is valid, and calls bar(). It does not mean call bar statically. It means t...
Inheritance of static methods is a bit weird in PHP. I suspect you need to redefine `__callStatic` in `B`
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
First, make sure you're using PHP 5.3.0 or newer, as that's when \_\_callStatic was implemented. It all seems to work as expected, see this example: ``` <?php class A { public function __call($method, $args) { echo 'A::__call, ' . var_export(array($method, $args), true), PHP_EOL; } /** ...
Inheritance of static methods is a bit weird in PHP. I suspect you need to redefine `__callStatic` in `B`
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
After thinking about it, it's not really a bug. But it's definitely unintuitive. ``` <?php class A { public function foo() { static::bar(); } public function bar() { echo "bar()\n"; } } $a = new A(); $a->foo(); ``` This is valid, and calls bar(). It does not mean call bar statically. It means t...
First, make sure you're using PHP 5.3.0 or newer, as that's when \_\_callStatic was implemented. It all seems to work as expected, see this example: ``` <?php class A { public function __call($method, $args) { echo 'A::__call, ' . var_export(array($method, $args), true), PHP_EOL; } /** ...
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
After thinking about it, it's not really a bug. But it's definitely unintuitive. ``` <?php class A { public function foo() { static::bar(); } public function bar() { echo "bar()\n"; } } $a = new A(); $a->foo(); ``` This is valid, and calls bar(). It does not mean call bar statically. It means t...
**Good news** I make a BIG work arround, but it works pretty fine. This is the code: ``` class NoContext { public static function call($callback, $args = null){ return call_user_func_array($callback, $args ?: array()); } } ``` You need to call `NoContext::call` (statically) like you call `call_user_...
6,181,603
I'm havinh a problem on PHP 5.3. I need to call a method by using `__callStatic`, but if I use it in a instancied object, PHP call `__call` instead. Above a real life example: ``` <?php class A { function __call($method, $args){ // Note: $this is defined! echo "Ops! Don't works. {...
2011/05/30
[ "https://Stackoverflow.com/questions/6181603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755393/" ]
First, make sure you're using PHP 5.3.0 or newer, as that's when \_\_callStatic was implemented. It all seems to work as expected, see this example: ``` <?php class A { public function __call($method, $args) { echo 'A::__call, ' . var_export(array($method, $args), true), PHP_EOL; } /** ...
**Good news** I make a BIG work arround, but it works pretty fine. This is the code: ``` class NoContext { public static function call($callback, $args = null){ return call_user_func_array($callback, $args ?: array()); } } ``` You need to call `NoContext::call` (statically) like you call `call_user_...
6,194,576
I am running a Linux server and one of our suppliers only knows how to send me an Excel file which I need to import into our system daily. Does anyone know of a good way to export the Excel file to a delimited file? Preferably with php or perl. Thanks! Chris Edwards
2011/05/31
[ "https://Stackoverflow.com/questions/6194576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/187254/" ]
Something like this if the names match, maybe? ``` System.Data.SqlDbType otherEnumTypeValue = System.Data.SqlDbType.Xml; Microsoft.SqlServer.Management.Smo.SqlDataTypeconverted = (Microsoft.SqlServer.Management.Smo.SqlDataType)Enum.Parse(typeof(Microsoft.SqlServer.Management.Smo.SqlDataType), otherEnumType...
Conversion from SqlDataType to SqlDbType using Bala R's enum parsing code plus special cases for unsupported conversions. ``` private static SqlDbType ConvertSqlTypeEnum(SqlDataType sqlDataType) { SqlDbType sqlDbType; switch (sqlDataType) { case SqlDataType.U...
43,233,376
Say I have three arrays depicting some names, number of books read and how awesome these people [in names] are: ``` let names = ["Mary", "Joe", "Kenan"]; let numberOfBooks = [2, 1, 4]; let awesomenessLevel = ["pretty cool", "meh", "super-reader"]; ``` I'm trying to use `.reduce()` to bring them together to create an...
2017/04/05
[ "https://Stackoverflow.com/questions/43233376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3845851/" ]
You could do it with `map`, like this: ``` let result = names.map( (v, i) => ({ name: names[i], noOfBooks: numberOfBooks[i], awesomenessLevel: awesomenessLevel[i] })); ``` ```js let names = ["Mary", "Joe", "Kenan"]; let numberOfBooks = [2, 1, 4]; let awesomenessLevel = ["pretty cool", "meh", "super-re...
Use `map` to create a 1-to-1 mapping between the input arrays and the output arrays. ``` let people = names.map(function (e, i) { return {name:e, noOfBooks:numberOfBooks[i],awesomeness: awesomenessLevel[i]}; }); ``` ```js let names = ["Mary", "Joe", "Kenan"]; let numberOfBooks = [2, 1, 4]; let awesomenessLeve...
43,233,376
Say I have three arrays depicting some names, number of books read and how awesome these people [in names] are: ``` let names = ["Mary", "Joe", "Kenan"]; let numberOfBooks = [2, 1, 4]; let awesomenessLevel = ["pretty cool", "meh", "super-reader"]; ``` I'm trying to use `.reduce()` to bring them together to create an...
2017/04/05
[ "https://Stackoverflow.com/questions/43233376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3845851/" ]
Use `map` to create a 1-to-1 mapping between the input arrays and the output arrays. ``` let people = names.map(function (e, i) { return {name:e, noOfBooks:numberOfBooks[i],awesomeness: awesomenessLevel[i]}; }); ``` ```js let names = ["Mary", "Joe", "Kenan"]; let numberOfBooks = [2, 1, 4]; let awesomenessLeve...
You could use a dynamic approach by combining all arrays to one object and use the key names as property names for the result objects in the array ```js let names = ["Mary", "Joe", "Kenan"], numberOfBooks = [2, 1, 4], awesomenessLevel = ["pretty cool", "meh", "super-reader"], object = { name: names, noO...
43,233,376
Say I have three arrays depicting some names, number of books read and how awesome these people [in names] are: ``` let names = ["Mary", "Joe", "Kenan"]; let numberOfBooks = [2, 1, 4]; let awesomenessLevel = ["pretty cool", "meh", "super-reader"]; ``` I'm trying to use `.reduce()` to bring them together to create an...
2017/04/05
[ "https://Stackoverflow.com/questions/43233376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3845851/" ]
You could do it with `map`, like this: ``` let result = names.map( (v, i) => ({ name: names[i], noOfBooks: numberOfBooks[i], awesomenessLevel: awesomenessLevel[i] })); ``` ```js let names = ["Mary", "Joe", "Kenan"]; let numberOfBooks = [2, 1, 4]; let awesomenessLevel = ["pretty cool", "meh", "super-re...
You could use a dynamic approach by combining all arrays to one object and use the key names as property names for the result objects in the array ```js let names = ["Mary", "Joe", "Kenan"], numberOfBooks = [2, 1, 4], awesomenessLevel = ["pretty cool", "meh", "super-reader"], object = { name: names, noO...
44,332,383
I currently have a need to have a set of function arguments defined as a comma separated string and passed in at a later time. I would like my code to function somewhat as follows. ``` function bar() { console.log("My name is " + arguments[0].name + " and my species is " arguments[0].species); console.log("St...
2017/06/02
[ "https://Stackoverflow.com/questions/44332383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6637352/" ]
It's not pretty, but you can use `eval`: ```js function bar() { console.log("My name is " + arguments[0].name + " and my species is " + arguments[0].species); console.log("String 1: " + arguments[1]); console.log("String 2: " + arguments[2]); } function foo() { var args = "{name: 'Dean Brunt', s...
You can use eval(). Writing a regex would be quite tedious. ``` function stringToArgs(str){ return eval(`(function(){return arguments;})(${str})`); } function bar(arguments) { console.log("My name is " + arguments[0].name + " and my species is " +arguments[0].species); console.log("String 1: " + arguments[...
44,332,383
I currently have a need to have a set of function arguments defined as a comma separated string and passed in at a later time. I would like my code to function somewhat as follows. ``` function bar() { console.log("My name is " + arguments[0].name + " and my species is " arguments[0].species); console.log("St...
2017/06/02
[ "https://Stackoverflow.com/questions/44332383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6637352/" ]
It's not pretty, but you can use `eval`: ```js function bar() { console.log("My name is " + arguments[0].name + " and my species is " + arguments[0].species); console.log("String 1: " + arguments[1]); console.log("String 2: " + arguments[2]); } function foo() { var args = "{name: 'Dean Brunt', s...
It's not fool-proof, but it's a start. You should begin by formatting your data to *look like* JSON, then parse it. This is the easiest way. ```js function printInfo() { console.log("My name is " + arguments[0].name + " and my species is " + arguments[0].species); console.log("String 1: " + arguments[1]); co...
7,913,511
I am doing pathfinding on a 2D grid. I need to calculate distance as one of my heuristics. Furthermore I need to return the closest spot if the full path is not found. Calculating the exact distance to a double precision seems like unnecessary overhead. Is there any fast approximation I can use, which will still be ...
2011/10/27
[ "https://Stackoverflow.com/questions/7913511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1012037/" ]
> > ***I need to return the closest spot if the full path is not found.*** > > > In this case you could skip the square root operation in the distance calculation, i.e. compare squared distances using just `dy * dy + dx * dx`. This works since *a2 < b2* if and only if *a < b* for two arbitrary distances *a* and *...
If it is a 2D grid you could consider using the [Manhattan distance](http://en.wikipedia.org/wiki/Manhattan_distance). This would allow you to work in grid units all the time and avoid the square root. As aioobe suggests, this is probably micro-optimizing.
7,913,511
I am doing pathfinding on a 2D grid. I need to calculate distance as one of my heuristics. Furthermore I need to return the closest spot if the full path is not found. Calculating the exact distance to a double precision seems like unnecessary overhead. Is there any fast approximation I can use, which will still be ...
2011/10/27
[ "https://Stackoverflow.com/questions/7913511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1012037/" ]
> > ***I need to return the closest spot if the full path is not found.*** > > > In this case you could skip the square root operation in the distance calculation, i.e. compare squared distances using just `dy * dy + dx * dx`. This works since *a2 < b2* if and only if *a < b* for two arbitrary distances *a* and *...
Slightly better than Manhattan distance and nearly as fast would be: ``` unsigned int fastDist(unsigned int dx, unsigned int dy) { if ( dy < dx ) return (dx + (dy >> 1)); else return (dy + (dx >> 1)); } ``` It's exact when either dx or dy are zero. The error on the diagonal is about 6% and the maximum error ...
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had a similar problem trying to ping a machine across our VPN I made *two* identical entries, each on a separate line, and that made it work
You have a strange problem! But here are some ideas. a)make sure you're opening the right file notepad C:\WINDOWS\system32\drivers\etc\hosts b)Check that the file path is right here at this registry key. Check that the path there is The actual HOSTS file location HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Ser...
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had the same problem none of presented suggestions worked for me. I found the clue there: <https://serverfault.com/a/50950/161292> I rigth-clicked on hosts file and went to Properties->Security->Advanced. then I checked *Inherit from Parent* and clicked 'apply'. That solved my problem.
You have a strange problem! But here are some ideas. a)make sure you're opening the right file notepad C:\WINDOWS\system32\drivers\etc\hosts b)Check that the file path is right here at this registry key. Check that the path there is The actual HOSTS file location HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Ser...
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had a similar problem trying to ping a machine across our VPN I made *two* identical entries, each on a separate line, and that made it work
If you just edited your host file, you maybe need to flush your dns table ipconfig -flushdns ping test
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had the same problem none of presented suggestions worked for me. I found the clue there: <https://serverfault.com/a/50950/161292> I rigth-clicked on hosts file and went to Properties->Security->Advanced. then I checked *Inherit from Parent* and clicked 'apply'. That solved my problem.
If you just edited your host file, you maybe need to flush your dns table ipconfig -flushdns ping test
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had a similar problem trying to ping a machine across our VPN I made *two* identical entries, each on a separate line, and that made it work
Check the advaced settings of your TCP/IP settings, make sure the LMHOSTS option is **enabled**. ![enter image description here](https://i.stack.imgur.com/SdWca.png)
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had the same problem none of presented suggestions worked for me. I found the clue there: <https://serverfault.com/a/50950/161292> I rigth-clicked on hosts file and went to Properties->Security->Advanced. then I checked *Inherit from Parent* and clicked 'apply'. That solved my problem.
Check the advaced settings of your TCP/IP settings, make sure the LMHOSTS option is **enabled**. ![enter image description here](https://i.stack.imgur.com/SdWca.png)
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had a similar problem trying to ping a machine across our VPN I made *two* identical entries, each on a separate line, and that made it work
Your host file NEEDS the first entry to be 127.0.0.1 localhost to properly function, according to Microsoft. That may be an issue as well. Add that in then reboot and try
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had the same problem none of presented suggestions worked for me. I found the clue there: <https://serverfault.com/a/50950/161292> I rigth-clicked on hosts file and went to Properties->Security->Advanced. then I checked *Inherit from Parent* and clicked 'apply'. That solved my problem.
Your host file NEEDS the first entry to be 127.0.0.1 localhost to properly function, according to Microsoft. That may be an issue as well. Add that in then reboot and try
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had a similar problem trying to ping a machine across our VPN I made *two* identical entries, each on a separate line, and that made it work
Maybe this is overstating the obvious; The hosts file resides in C:\Windows\System32\drivers\etc if you have edited this file in a text editor ensure that it hasnt added an extension, as far as windows is concerned the file must have no extension ie hosts. not hosts.txt
230,897
Here's my hosts(with a single entry): ``` 127.0.0.1 test ``` But it's not working any more: ``` C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the name and try again. ``` Why? **UPDATE** It stops working ever since I used **[openvpn](http://openvpn.net/)** ...
2011/01/09
[ "https://superuser.com/questions/230897", "https://superuser.com", "https://superuser.com/users/36771/" ]
I had the same problem none of presented suggestions worked for me. I found the clue there: <https://serverfault.com/a/50950/161292> I rigth-clicked on hosts file and went to Properties->Security->Advanced. then I checked *Inherit from Parent* and clicked 'apply'. That solved my problem.
Maybe this is overstating the obvious; The hosts file resides in C:\Windows\System32\drivers\etc if you have edited this file in a text editor ensure that it hasnt added an extension, as far as windows is concerned the file must have no extension ie hosts. not hosts.txt
38,486,093
I am getting some odd behavior with my exported routes using Express.js. My HTML routes work fine, but my api routes (api routes are in a separate file) return "Cannot GET /api". However if I move my api routes into the same file as my html routes, the api routes suddenly works. I looked at other examples on Stack but ...
2016/07/20
[ "https://Stackoverflow.com/questions/38486093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3754851/" ]
I see two issues. First is the order in which you are mounting the routers. You should mount more specific routers first: ``` // more specific app.use('/api/:dogs?', require('./app/routing/api-routes')); // less specific app.use('/', require('./app/routing/html-routes')); ``` (your declarations for `/add` and `/sur...
try with only these 2 lines in server.js ``` //html routes app.use('/', require('./app/routing/html-routes')); //api routes app.use('/api', require('./app/routing/api-routes')); ```
38,486,093
I am getting some odd behavior with my exported routes using Express.js. My HTML routes work fine, but my api routes (api routes are in a separate file) return "Cannot GET /api". However if I move my api routes into the same file as my html routes, the api routes suddenly works. I looked at other examples on Stack but ...
2016/07/20
[ "https://Stackoverflow.com/questions/38486093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3754851/" ]
In your server.js file you don't need the `app.use`s you have under //html and //api routes. You can delete those and then just put ``` require("./app/routing/api-routes")(app); require("./app/routing/html-routes")(app); ``` Now inside your html-routes file turn you don't need to use your `router var = express.Rout...
try with only these 2 lines in server.js ``` //html routes app.use('/', require('./app/routing/html-routes')); //api routes app.use('/api', require('./app/routing/api-routes')); ```
38,486,093
I am getting some odd behavior with my exported routes using Express.js. My HTML routes work fine, but my api routes (api routes are in a separate file) return "Cannot GET /api". However if I move my api routes into the same file as my html routes, the api routes suddenly works. I looked at other examples on Stack but ...
2016/07/20
[ "https://Stackoverflow.com/questions/38486093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3754851/" ]
In your server.js file you don't need the `app.use`s you have under //html and //api routes. You can delete those and then just put ``` require("./app/routing/api-routes")(app); require("./app/routing/html-routes")(app); ``` Now inside your html-routes file turn you don't need to use your `router var = express.Rout...
I see two issues. First is the order in which you are mounting the routers. You should mount more specific routers first: ``` // more specific app.use('/api/:dogs?', require('./app/routing/api-routes')); // less specific app.use('/', require('./app/routing/html-routes')); ``` (your declarations for `/add` and `/sur...
38,486,093
I am getting some odd behavior with my exported routes using Express.js. My HTML routes work fine, but my api routes (api routes are in a separate file) return "Cannot GET /api". However if I move my api routes into the same file as my html routes, the api routes suddenly works. I looked at other examples on Stack but ...
2016/07/20
[ "https://Stackoverflow.com/questions/38486093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3754851/" ]
I see two issues. First is the order in which you are mounting the routers. You should mount more specific routers first: ``` // more specific app.use('/api/:dogs?', require('./app/routing/api-routes')); // less specific app.use('/', require('./app/routing/html-routes')); ``` (your declarations for `/add` and `/sur...
Under `app.js/server.js` file make sure you require your new route file at the top. Then on `app.use` do the following: ``` app.use('/', your_new_route); ``` From there you'll be able to call any endpoints defined in your new route e.g ``` router.get('/filesize', function(req, res) { console.log('File Uplaod');...
38,486,093
I am getting some odd behavior with my exported routes using Express.js. My HTML routes work fine, but my api routes (api routes are in a separate file) return "Cannot GET /api". However if I move my api routes into the same file as my html routes, the api routes suddenly works. I looked at other examples on Stack but ...
2016/07/20
[ "https://Stackoverflow.com/questions/38486093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3754851/" ]
In your server.js file you don't need the `app.use`s you have under //html and //api routes. You can delete those and then just put ``` require("./app/routing/api-routes")(app); require("./app/routing/html-routes")(app); ``` Now inside your html-routes file turn you don't need to use your `router var = express.Rout...
Under `app.js/server.js` file make sure you require your new route file at the top. Then on `app.use` do the following: ``` app.use('/', your_new_route); ``` From there you'll be able to call any endpoints defined in your new route e.g ``` router.get('/filesize', function(req, res) { console.log('File Uplaod');...
65,064,060
I am building Node JS, Express with TypeScript api, where I want to get the data stored by a particular user. I want to get the reocrd from mongodb based on user ID. My DataRouter.ts ``` router.get('/:userId', Data.findByUserId); ``` My Service.ts ``` async findByUserId(id: string): Promise<IRecord[]> { tr...
2020/11/29
[ "https://Stackoverflow.com/questions/65064060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3144924/" ]
You need to understand the difference between user consent and admin consent: Each application registers permissions it requires. Some permissions can be granted by users, some other only by the administrator. Let's suppose you have only permissions that can be consented by users. The first time they use the applicat...
This may be relevant to the last question: > > * For delegated permissions, the effective permissions of your app are the least-privileged intersection of the delegated permissions the app has been granted (by consent) and the privileges of the currently signed-in user. Your app can never have more privileges than th...
1,099,614
How do I set the font of an UI element (ex. UILabel) to the "System" font in IB? In code, I know I can do the following: ``` UIFont * tempFont = [[UIFont systemFontOfSize:24] retain]; ``` But what about doing the same thing in IB? What is the default system font on the IPhone?
2009/07/08
[ "https://Stackoverflow.com/questions/1099614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25/" ]
When you add a user control from the code behind, you have to actually load the control. You can do this by doing something like this: ``` protected void Page_Load(object sender, EventArgs e) { for(int i=0;i<5;i++) { InnerUserControl cuc = (InnerUserControl)this.Page.LoadControl("InnerUserControl.ascx"...
Have you tried adding ``` <%@ Reference Control="InnerUserControl.ascx" %> ``` to OuterUserControl.ascx
1,099,614
How do I set the font of an UI element (ex. UILabel) to the "System" font in IB? In code, I know I can do the following: ``` UIFont * tempFont = [[UIFont systemFontOfSize:24] retain]; ``` But what about doing the same thing in IB? What is the default system font on the IPhone?
2009/07/08
[ "https://Stackoverflow.com/questions/1099614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25/" ]
When you add a user control from the code behind, you have to actually load the control. You can do this by doing something like this: ``` protected void Page_Load(object sender, EventArgs e) { for(int i=0;i<5;i++) { InnerUserControl cuc = (InnerUserControl)this.Page.LoadControl("InnerUserControl.ascx"...
I'd recommend a different approach. Instead of instantiating the control object in the code-behind and adding it to the controls collection (which I think you'd probably need LoadControl() to do properly and do it earlier than page\_load to hook it into the page lifecycle), add the inner control declaratively in the Ou...
36,407,575
I'm trying to unmarshal my xml file: ``` public Object convertFromXMLToObject(String xmlfile) throws IOException { FileInputStream is = null; File file = new File(String.valueOf(this.getClass().getResource("xmlToParse/companies.xml"))); try { is = new FileInputStream(file); return getUnmars...
2016/04/04
[ "https://Stackoverflow.com/questions/36407575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4625667/" ]
I had the same problem trying to load some XML files into my test classes. If you use Spring, as one can suggest from your question, the easiest way is to use [org.springframework.core.io.Resource](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/io/Resource.html) - the one [Raphael Rot](h...
you are suppose to give an absolute path (so add a loading ´/´, where resource-folder is the root-folder): ``` public Object convertFromXMLToObject(String xmlfile) throws IOException { FileInputStream is = null; File file = new File(String.valueOf(this.getClass().getResource("/xmlToParse/companies.xml"))); ...
36,407,575
I'm trying to unmarshal my xml file: ``` public Object convertFromXMLToObject(String xmlfile) throws IOException { FileInputStream is = null; File file = new File(String.valueOf(this.getClass().getResource("xmlToParse/companies.xml"))); try { is = new FileInputStream(file); return getUnmars...
2016/04/04
[ "https://Stackoverflow.com/questions/36407575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4625667/" ]
``` ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("fileName").getFile()); ```
you are suppose to give an absolute path (so add a loading ´/´, where resource-folder is the root-folder): ``` public Object convertFromXMLToObject(String xmlfile) throws IOException { FileInputStream is = null; File file = new File(String.valueOf(this.getClass().getResource("/xmlToParse/companies.xml"))); ...
36,407,575
I'm trying to unmarshal my xml file: ``` public Object convertFromXMLToObject(String xmlfile) throws IOException { FileInputStream is = null; File file = new File(String.valueOf(this.getClass().getResource("xmlToParse/companies.xml"))); try { is = new FileInputStream(file); return getUnmars...
2016/04/04
[ "https://Stackoverflow.com/questions/36407575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4625667/" ]
I had the same problem trying to load some XML files into my test classes. If you use Spring, as one can suggest from your question, the easiest way is to use [org.springframework.core.io.Resource](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/io/Resource.html) - the one [Raphael Rot](h...
``` ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("fileName").getFile()); ```
12,461,300
I'm trying to index a 3 channel image in opencv. When I read in image files this code works ``` int Blue = LeftCol.at<cv::Vec3b>(v,u)[0]; int Green = LeftCol.at<cv::Vec3b>(v,u)[1]; int Red = LeftCol.at<cv::Vec3b>(v,u)[2]; ``` But it crashes when I use a webcam input. The webcam has 3 channels and `u,v` starts ...
2012/09/17
[ "https://Stackoverflow.com/questions/12461300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1566066/" ]
OpenCV makes soft copies of images whenever possible. [From the documentation](http://opencv.itseez.com/modules/core/doc/basic_structures.html#mat): > > the array assignment is an O(1) operation because it only copies the header and increases the reference counter. The Mat::clone() method can be used to get a full (d...
You can check the type with cv::Mat.type() and the number of channels with cv::Mat.channels() The data returned from the camera will be converted into Vec3b (ie uchar \* 3) in B,G,R order. Are you sure the image is valid- is there a mistake somewhere else?
12,461,300
I'm trying to index a 3 channel image in opencv. When I read in image files this code works ``` int Blue = LeftCol.at<cv::Vec3b>(v,u)[0]; int Green = LeftCol.at<cv::Vec3b>(v,u)[1]; int Red = LeftCol.at<cv::Vec3b>(v,u)[2]; ``` But it crashes when I use a webcam input. The webcam has 3 channels and `u,v` starts ...
2012/09/17
[ "https://Stackoverflow.com/questions/12461300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1566066/" ]
OpenCV makes soft copies of images whenever possible. [From the documentation](http://opencv.itseez.com/modules/core/doc/basic_structures.html#mat): > > the array assignment is an O(1) operation because it only copies the header and increases the reference counter. The Mat::clone() method can be used to get a full (d...
Just because you tried all Vec\* combinations, here is the full list, my 2ct: ``` typedef Vec< uchar, 3 > Vec3b (so normal 8 bit) typedef Vec< double,3 > Vec3d (so normal double precision) typedef Vec< float, 3 > Vec3f (so normal floating point) typedef Vec< int, 3 > Vec3i (normal int) typede...
97,417
I have a boolean modifier with the following settings that is modifying the object outlined in green with the following settings: [![enter image description here](https://i.stack.imgur.com/R8qYU.png)](https://i.stack.imgur.com/R8qYU.png) where Cube.018 are the 'ribs' around the edges (they are all joined together in ...
2017/12/28
[ "https://blender.stackexchange.com/questions/97417", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/50224/" ]
Finally I understand what @Brenticus was getting at when he kept using the word "deform"! If you use either the "Object" or "Group" methods to render the particles, you can in fact affect the rotation and/or location of the objects. Here is a video showing that much: [![enter image description here](https://i.stack.im...
If you follow the above answer and it still doesn't work, check your **Viewport Display** > **amount**. The amount **MUST** be turned up to 100 for it to show in the viewport. [![Amount 100%](https://i.stack.imgur.com/eMUGa.jpg)](https://i.stack.imgur.com/eMUGa.jpg)
67,390,420
I am starting to learn and understand panda module in Python. However, my issue is with the rename string. The rename works fine when i use print, this shows the column has been renamed: ``` print(data.rename(columns={"Rep": "Name"})) ``` However, when i use print(data), to show all of the data from the document, th...
2021/05/04
[ "https://Stackoverflow.com/questions/67390420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can do this: ``` Sub Main() Dim localM As Func(Of Integer, Integer) = AddressOf C.m Console.writeline(localM(5)) End Sub ``` You can see it work here: > > <https://dotnetfiddle.net/Uxl0Y7> > > > I didn't change anything in the sample class, except to complete the function so it returns a value (re...
Is this what you are looking for? ``` Class C Public Shared Add1 As Func(Of Integer, Integer) = Function(value As Integer) Return value + 1 End Function End Class ``` to use ``` Private Sub Button1_C...
33,506,490
I'm having problems with "boost library" usage for Visual Studio 2015. I have Common Tools installed, followed this video instructions: <https://www.youtube.com/watch?v=GOhHMS4I9Zw> (Basically, unzip boost, in visual studio prompt, execute, boostrap.bat, b2.exe, and in visual studio project properties, in C/C++>Gener...
2015/11/03
[ "https://Stackoverflow.com/questions/33506490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3116664/" ]
Add the absolute path of the installed boost includes at project properties / VC++ Directories / Include Directories ``` $(VC_IncludePath);$(WindowsSDK_IncludePath);SOME_PATH_HERE ```
Edited. I had the same problem, but what cheated me was the configurations. When the solution was set to active on "Release" and "x64", then when opening properties in the C++ project under the solution, it could be "Debug" instead and hence missed to set the right properties for the target.
33,506,490
I'm having problems with "boost library" usage for Visual Studio 2015. I have Common Tools installed, followed this video instructions: <https://www.youtube.com/watch?v=GOhHMS4I9Zw> (Basically, unzip boost, in visual studio prompt, execute, boostrap.bat, b2.exe, and in visual studio project properties, in C/C++>Gener...
2015/11/03
[ "https://Stackoverflow.com/questions/33506490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3116664/" ]
Yes, make sure you select 'All Configurations' in the 'Configuration' combo box when the project properties window shows up. That will apply the settings for the 'Include Directories' to all config.
Add the absolute path of the installed boost includes at project properties / VC++ Directories / Include Directories ``` $(VC_IncludePath);$(WindowsSDK_IncludePath);SOME_PATH_HERE ```
33,506,490
I'm having problems with "boost library" usage for Visual Studio 2015. I have Common Tools installed, followed this video instructions: <https://www.youtube.com/watch?v=GOhHMS4I9Zw> (Basically, unzip boost, in visual studio prompt, execute, boostrap.bat, b2.exe, and in visual studio project properties, in C/C++>Gener...
2015/11/03
[ "https://Stackoverflow.com/questions/33506490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3116664/" ]
Well, after some research, I still can't figure out what's really happening. I've installed Visual Studio 2015 in Windows 10 machine, and make boost libraries work has been pretty straightforward. After that, in my regular machine, I've installed Visual Studio 2013 (last version), and one more time, has been incredibl...
Edited. I had the same problem, but what cheated me was the configurations. When the solution was set to active on "Release" and "x64", then when opening properties in the C++ project under the solution, it could be "Debug" instead and hence missed to set the right properties for the target.
33,506,490
I'm having problems with "boost library" usage for Visual Studio 2015. I have Common Tools installed, followed this video instructions: <https://www.youtube.com/watch?v=GOhHMS4I9Zw> (Basically, unzip boost, in visual studio prompt, execute, boostrap.bat, b2.exe, and in visual studio project properties, in C/C++>Gener...
2015/11/03
[ "https://Stackoverflow.com/questions/33506490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3116664/" ]
Yes, make sure you select 'All Configurations' in the 'Configuration' combo box when the project properties window shows up. That will apply the settings for the 'Include Directories' to all config.
Well, after some research, I still can't figure out what's really happening. I've installed Visual Studio 2015 in Windows 10 machine, and make boost libraries work has been pretty straightforward. After that, in my regular machine, I've installed Visual Studio 2013 (last version), and one more time, has been incredibl...
33,506,490
I'm having problems with "boost library" usage for Visual Studio 2015. I have Common Tools installed, followed this video instructions: <https://www.youtube.com/watch?v=GOhHMS4I9Zw> (Basically, unzip boost, in visual studio prompt, execute, boostrap.bat, b2.exe, and in visual studio project properties, in C/C++>Gener...
2015/11/03
[ "https://Stackoverflow.com/questions/33506490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3116664/" ]
Yes, make sure you select 'All Configurations' in the 'Configuration' combo box when the project properties window shows up. That will apply the settings for the 'Include Directories' to all config.
Edited. I had the same problem, but what cheated me was the configurations. When the solution was set to active on "Release" and "x64", then when opening properties in the C++ project under the solution, it could be "Debug" instead and hence missed to set the right properties for the target.
995,200
Assume x is a n by 1 column vector, then , it is easily known that $x^Tx$ is the sum of squares. When calculate $xx^T$, it will give you a n by n matrix. I am wondering what is the mathematical meaning of such results.
2014/10/28
[ "https://math.stackexchange.com/questions/995200", "https://math.stackexchange.com", "https://math.stackexchange.com/users/186542/" ]
If $x$ has length 1, then $xx^T$ is the orthogonal projection on the subspace of $\mathbb{R}^n$ (endowed with the canonical scalar product) generated by $x$.
$x$ and $x^T$ are actually matrices which represent linear maps from one vector space to another and their multiplication is the same as composition of the corresponding linear maps. In your case $x$ is a map from 1 dimensional to n (the length of the column) dimensional space and $x^T$ is just the opposite (from n dim...
995,200
Assume x is a n by 1 column vector, then , it is easily known that $x^Tx$ is the sum of squares. When calculate $xx^T$, it will give you a n by n matrix. I am wondering what is the mathematical meaning of such results.
2014/10/28
[ "https://math.stackexchange.com/questions/995200", "https://math.stackexchange.com", "https://math.stackexchange.com/users/186542/" ]
$xx^T$ encodes all pairs $x\_ix\_j$ in the matrix that's formed. This is commonly used for calculating [Covariance matrices](http://en.wikipedia.org/wiki/Covariance_matrix)
$x$ and $x^T$ are actually matrices which represent linear maps from one vector space to another and their multiplication is the same as composition of the corresponding linear maps. In your case $x$ is a map from 1 dimensional to n (the length of the column) dimensional space and $x^T$ is just the opposite (from n dim...
995,200
Assume x is a n by 1 column vector, then , it is easily known that $x^Tx$ is the sum of squares. When calculate $xx^T$, it will give you a n by n matrix. I am wondering what is the mathematical meaning of such results.
2014/10/28
[ "https://math.stackexchange.com/questions/995200", "https://math.stackexchange.com", "https://math.stackexchange.com/users/186542/" ]
If $x$ has length 1, then $xx^T$ is the orthogonal projection on the subspace of $\mathbb{R}^n$ (endowed with the canonical scalar product) generated by $x$.
$xx^T$ encodes all pairs $x\_ix\_j$ in the matrix that's formed. This is commonly used for calculating [Covariance matrices](http://en.wikipedia.org/wiki/Covariance_matrix)
18,762,566
``` class test { public void read() { int a=convert.toint32(textbox1.text); } } ``` Error shows that String format is not correct Can any one solve this....
2013/09/12
[ "https://Stackoverflow.com/questions/18762566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2772356/" ]
Use `Int32.TryParse` to make sure the value in textbox1 is convertable into `int` ``` class test { public void read() { int a = 0; if(Int32.TryParse(textbox1.Text, out a)) { // a is the integer from the textbox } else { MessageBox.Show("The textbo...
It means that the value of `textbox1.text` is not integer.
18,762,566
``` class test { public void read() { int a=convert.toint32(textbox1.text); } } ``` Error shows that String format is not correct Can any one solve this....
2013/09/12
[ "https://Stackoverflow.com/questions/18762566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2772356/" ]
Use `Int32.TryParse` to make sure the value in textbox1 is convertable into `int` ``` class test { public void read() { int a = 0; if(Int32.TryParse(textbox1.Text, out a)) { // a is the integer from the textbox } else { MessageBox.Show("The textbo...
The error is probably because the text value of `textbox1.Text1` cannot be converted to an `int`. You might want to consider using [Int32.TryParse()](http://msdn.microsoft.com/en-us/library/f02979c7.aspx): ``` public void read() { int val = 0; if(Int32.TryParse(textbox1.Text, out val)) { //parse...
432,339
Why does Steinbeck, when describing an old man's death, say "his breath *was* stopped" rather than "his breath *had* stopped"? The context and full sentence below: > > Grampa seemed to be struggling; all his muscles twitched. And suddenly he jarred as though under a heavy blow. He lay still and his breath *was stopp...
2018/02/22
[ "https://english.stackexchange.com/questions/432339", "https://english.stackexchange.com", "https://english.stackexchange.com/users/283029/" ]
I think people have been misinterpreting the question. I believe the poster wants to know how to rephrase "They invited their friend(s)" to have each of those four meanings. Here's how I'd do it: 1. They invited their friend. 2. They each invited a friend. 3. (Can't think of a way to concisely say one or more) 4. Th...
> > They invited only one person, who is the common friend of all of them. > > > This means that a common or mutual friend of them all has been invited. > > They invited one friend for each of them. > > > This may be rephrased to "Each one of them invited a friend." > > They invited one or more friend for ...
74,057,066
I have my project link as follows : `http://localhost/prolist_admin/` and I use the move\_uploaded\_file as follows `move_uploaded_file($temp_name, "../assets/img/static/$projectLogo");` The above code moves my file to the right folder, with the permission set to 777 on that folder. Now, I want to move the files to a...
2022/10/13
[ "https://Stackoverflow.com/questions/74057066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19771569/" ]
You may use this `replace` code in javascript with a regex that matches `($i)..` and grabs remaining non-whitespace string in a capture group. Then we use a replacer that removes all word characters from the captured group value. ```js var s = '(?i).*!$abc£aa$bb' var r = s.replace(/\(\?i\)..(\S+)/, (m, g1) => { ret...
You can use ```js text = text.replace(/\(\?i\)..([^\w\s:]*)\w+(\W*)/, '$1$2') // or even text = text.replace(/\(\?i\)..([^\w\s:]*)\w+/, '$1') ``` See the [regex demo #1](https://regex101.com/r/ucPyfE/1) / [regex demo #2](https://regex101.com/r/ucPyfE/2) *Details*: * `\(\?i\)` - a `(?i)` string * `..` - any two cha...
74,057,066
I have my project link as follows : `http://localhost/prolist_admin/` and I use the move\_uploaded\_file as follows `move_uploaded_file($temp_name, "../assets/img/static/$projectLogo");` The above code moves my file to the right folder, with the permission set to 777 on that folder. Now, I want to move the files to a...
2022/10/13
[ "https://Stackoverflow.com/questions/74057066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19771569/" ]
``` /[^!$£]/g ``` Replace everything but !, $, and £. ```js const str = `(?i).*!$abc£`; const rgx = /[^!$£]/g; const res = str.replaceAll(rgx, ''); console.log(res); ```
You can use ```js text = text.replace(/\(\?i\)..([^\w\s:]*)\w+(\W*)/, '$1$2') // or even text = text.replace(/\(\?i\)..([^\w\s:]*)\w+/, '$1') ``` See the [regex demo #1](https://regex101.com/r/ucPyfE/1) / [regex demo #2](https://regex101.com/r/ucPyfE/2) *Details*: * `\(\?i\)` - a `(?i)` string * `..` - any two cha...
16,197,394
I'm trying to read a string ``` char *string=malloc(sizeof(char)); char *start_string=string; //pointer to string start while ((readch=read(file, buffer, 4000))!=0){ // read filelen=filelen+readch; //string length for (d=0;d<readch;d++) *start_string++=buffer[d]; //append buffer to str realloc(stri...
2013/04/24
[ "https://Stackoverflow.com/questions/16197394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2191749/" ]
[`realloc()`](http://en.cppreference.com/w/c/memory/realloc) does not update the pointer passed in to it. If `realloc()` is successful the pointer passed in is `free()`d and the address of the allocated memory is returned. In the posted code `realloc()` will attempt to `free(string)` multiple times, which is undefined ...
The address of string may change when you call `realloc()`. ``` char *string=malloc(sizeof(char)); char *start_string=string; //pointer to string start while ((readch=read(file, buffer, 4000))!=0){ // read filelen=filelen+readch; //string length for (d=0;d<readch;d++) *start_string++=buffer[d]; //appe...
10,167,635
Trying to implement an MVC pattern, keep coming back to a `NullPointerException`. I feel I'm missing a trick when it comes to setting up an area of the GUI which should replot data based on user inputs. The exception points to this; `display.replot(model.getData(), model.getSamples());` `display` is an instance of ...
2012/04/16
[ "https://Stackoverflow.com/questions/10167635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1333730/" ]
A `NullPointerException` means that either you are calling a function on a non-existing (`null`) object, or a function call can throw that exception deliberately if one of its parameters is `null`. You need to check which is the case and either put an `if` guard around it or otherwise ensure the objects are valid.
NPE is easy to figure out with a capable IDE (e.g. IntelliJ). A pass through with a debugger will make it plain as day. Even without one, NPE is easy to figure out because the stack trace tells you the .java source file and the line number at which it occurred. You should be able to open the .java source file, turn on...
3,187,240
Let $(M,g)$ be a Riemannian manifold and $g$ the Riemannian metric in coordinates $g=g\_{\alpha \beta}dx^{\alpha} \otimes dx^{\beta}$, where $x^{i}$ are local coordinates on $M$. Denote by $g^{\alpha \beta}$ the inverse components of the inverse metric $g^{-1}$. Let $\nabla$ be the Levi-Civita connection of the metric ...
2019/04/14
[ "https://math.stackexchange.com/questions/3187240", "https://math.stackexchange.com", "https://math.stackexchange.com/users/494250/" ]
Better to specify your direction vector with $\theta$ and $\varphi$ in [spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system) $(r,\theta,\varphi)$. Otherwise you have a problem with how to specify which of the three coordinates is omitted $-$ this requires another parameter. But in fact a l...
The idea is right, but, in general, we cannot fix a given coordinate of the direction vector to be $0$ or $1$. So usually we assume that the direction vector $(d\_1,d\_2,d\_3)$ has unit length, that means that $d\_1^2+d^2\_2+d^2\_3=1$.
3,187,240
Let $(M,g)$ be a Riemannian manifold and $g$ the Riemannian metric in coordinates $g=g\_{\alpha \beta}dx^{\alpha} \otimes dx^{\beta}$, where $x^{i}$ are local coordinates on $M$. Denote by $g^{\alpha \beta}$ the inverse components of the inverse metric $g^{-1}$. Let $\nabla$ be the Levi-Civita connection of the metric ...
2019/04/14
[ "https://math.stackexchange.com/questions/3187240", "https://math.stackexchange.com", "https://math.stackexchange.com/users/494250/" ]
Better to specify your direction vector with $\theta$ and $\varphi$ in [spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system) $(r,\theta,\varphi)$. Otherwise you have a problem with how to specify which of the three coordinates is omitted $-$ this requires another parameter. But in fact a l...
The specification of lines in three dimensional Euclidean space by four numbers is not trivial. Let us start with a Euclidean plane. We can construct a Cartesian coordinate system where each point is uniquely specified by two coordinates. What about lines? Without projective coordinates, there is a difficulty. For exam...
35,413,454
I currently have a webpage that looks like this: [![enter image description here](https://i.stack.imgur.com/PW7hY.png)](https://i.stack.imgur.com/PW7hY.png) I would like to make it so the "Click to view Gallery of This property" button does not show on the initial load, but does show once the property links are click...
2016/02/15
[ "https://Stackoverflow.com/questions/35413454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2701059/" ]
I think this is one of those exceptional cases where you want to use inline style to hide your element. This is because it takes a few seconds for the JavaScript to load. So some users may end up seeing the element when they first get on the page, then see it quickly disappear. ``` <img src="INITALPAGELOADIMAGE" alt="...
Using css, you can have the block have `display: none;` and then when you use show it will change the display to default (usually `display: block;`)
54,616,310
I have a 2-D numpy array each row of which consists of three elements - ['dataframe\_column\_name', 'dataframe\_index', 'value']. Now, I tried populating the pandas dataframe using iloc double for loop but it is quite slow. Is there any faster way of doing this. I am a bit new to pandas, so apologies in case this is so...
2019/02/10
[ "https://Stackoverflow.com/questions/54616310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9912260/" ]
Wouldn't this work: ``` def convert_to_klist(map) do Enum.map(map, fn({key, value}) -> {String.to_existing_atom(key), value} end) end ```
I would put it here for the sake of future readers. While one surely might blindly call [`String.to_atom/1`](https://hexdocs.pm/elixir/master/String.html#to_atom/1) here and there, that approach is **strongly discouraged** due to its vulnerability to atom DoS attacks. Here is the excerpt from Erlang docs: > > Atoms...
54,616,310
I have a 2-D numpy array each row of which consists of three elements - ['dataframe\_column\_name', 'dataframe\_index', 'value']. Now, I tried populating the pandas dataframe using iloc double for loop but it is quite slow. Is there any faster way of doing this. I am a bit new to pandas, so apologies in case this is so...
2019/02/10
[ "https://Stackoverflow.com/questions/54616310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9912260/" ]
Wouldn't this work: ``` def convert_to_klist(map) do Enum.map(map, fn({key, value}) -> {String.to_existing_atom(key), value} end) end ```
You can use the `Keyword.new` function and pass in a transform function as the second argument. ``` Keyword.new(%{"browser_name" => "Chrome", "platform" => "linux"}, fn {k,v} -> {String.to_existing_atom(k), v} end) > [browser_name: "Chrome", platform: "linux"] ``` Although this is basically equivalent to the accepte...
54,616,310
I have a 2-D numpy array each row of which consists of three elements - ['dataframe\_column\_name', 'dataframe\_index', 'value']. Now, I tried populating the pandas dataframe using iloc double for loop but it is quite slow. Is there any faster way of doing this. I am a bit new to pandas, so apologies in case this is so...
2019/02/10
[ "https://Stackoverflow.com/questions/54616310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9912260/" ]
Wouldn't this work: ``` def convert_to_klist(map) do Enum.map(map, fn({key, value}) -> {String.to_existing_atom(key), value} end) end ```
For future reference. You can also use [Enum.into/3](https://hexdocs.pm/elixir/Enum.html#into/3) ``` %{"browser_name" => "Chrome", "platform" => "linux"} |> Enum.into([], fn {k, v} -> {String.to_existing_atom(k), v} end) ``` or in its shorter version: ``` %{"browser_name" => "Chrome", "platform" => "linux"} |> Enum...
54,616,310
I have a 2-D numpy array each row of which consists of three elements - ['dataframe\_column\_name', 'dataframe\_index', 'value']. Now, I tried populating the pandas dataframe using iloc double for loop but it is quite slow. Is there any faster way of doing this. I am a bit new to pandas, so apologies in case this is so...
2019/02/10
[ "https://Stackoverflow.com/questions/54616310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9912260/" ]
I would put it here for the sake of future readers. While one surely might blindly call [`String.to_atom/1`](https://hexdocs.pm/elixir/master/String.html#to_atom/1) here and there, that approach is **strongly discouraged** due to its vulnerability to atom DoS attacks. Here is the excerpt from Erlang docs: > > Atoms...
For future reference. You can also use [Enum.into/3](https://hexdocs.pm/elixir/Enum.html#into/3) ``` %{"browser_name" => "Chrome", "platform" => "linux"} |> Enum.into([], fn {k, v} -> {String.to_existing_atom(k), v} end) ``` or in its shorter version: ``` %{"browser_name" => "Chrome", "platform" => "linux"} |> Enum...