[Solved] Regular expression for phone numbers

If the first part of an alternation matches, then the regex engine doesn’t even try the second part. Presuming you want to match only three-digit, 11 digit, or 11 digit hyphen 1 digit numbers, then you can use lookarounds to ensure that the preceding and following characters aren’t digits. (?<!\d)(\d{3}|\d{11}|\d{11}-\d{1})(?!\d) 2 solved Regular expression for … Read more

[Solved] My codes work well In Dev c++ IDE, but in linux terminal, it doesn’t. (especially in the part of ‘while’ loop.) [closed]

You are most likely running into the NL/CR issue. Instead of if (a[i]==””) Use something like: if (isEmptyLine(a[i])) where bool isEmptyLine(std::string const& s) { for ( auto c : s ) { if ( !std::isspace(c) ) return false; } return true; } You can also convert the file into a file with UNIX style line … Read more

[Solved] Very disturbing error message

MyObject->MyFunc, as the error says, cannot be used for anything except an immediate function call. You can’t even take its sizeof, even if some compilers allow that. I think what you mean is sizeof(&ClassName::FunctionName). That’s simpler, will actually compile, and doesn’t invoke undefined behavior (dereferencing a null pointer is UB, even if you don’t do … Read more

[Solved] Need to find Facebook username from user id

me/username is no longer available. Source: https://developers.facebook.com/docs/apps/changelog#v2_0 You are not supposed to use the username anymore, just use the App Scoped User ID to identify users. solved Need to find Facebook username from user id

[Solved] Operator in C/C++ [closed]

In this expression (b,a) there is the comma operator. Its value is the value of the last (right) subexpression after the comma. The value of the first (left) subexpression is discarded. So the output will be 6 From the C++ Standard A pair of expressions separated by a comma is evaluated left-to-right; the left expression … Read more

[Solved] input day,month,year and store in a seperate structure

I recently saw the nice answer of Kerrek for a similar problem in SO: Read file line by line with an additional comment for the separator trick. So, I looked for this and transformed it to your standard input requirement (which was actually easy and less effort): #include <iostream> struct Date { int day, month, … Read more

[Solved] Problematic understanding of IEEE 754 [closed]

What is precision? It refers to how closely a binary floating point representation can represent a real value. Real values have infinite precision and infinite range. Digital values have finite range and precision. In practice a single-precision IEEE-754 can represent real values of a precision of 6 significant figures (decimal), while double-precision is good for … Read more

[Solved] Play local video file in UIwebview [closed]

Try this : NSString* htmlString = [NSString stringWithFormat:@”!DOCTYPE html> <html lang=”en”> <head> <title>test</title> <body> <div> <embed src=”https://stackoverflow.com/questions/24551251/yourVideoName.mov” Pluginspage=”http://www.apple.com/quicktime/” width=”90%” height=”166px” CONTROLLER=”true” LOOP=”false” AUTOPLAY=”false” name=”IBM Video”></embed> </div> </body></html>”]; UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(frame+(i*20), 0, 300, height)]; webview.allowsInlineMediaPlayback = YES; webview.delegate = self; [webview loadHTMLString:htmlString baseURL:[[NSBundle mainBundle] bundleURL]]; [previewScrollView addSubview:webview]; 3 solved Play local video file … Read more

[Solved] Cakephp routing (in PHP too) [closed]

As indicated in the docs, you can use regular expressions to restrict matching route elements. The regex snippet you are looking for is: ‘(?i:hellouser)’ Route definition Putting the docs and your specific regex together, here’s a route that will match the url /hellouser in a case insensitive manner: Router::connect( ‘/:user’, array(‘controller’ => ‘teachers’, ‘action’ => … Read more

[Solved] Unable to bind some data between components?

To achieve what you need with the same architecture you can use the $rootScope to pass the data between your controllers. Here is the updated code : (function(angular) { ‘use strict’; function someOtherTabPageController($scope,$rootScope) { var ctrl = this; //do some work with the passingObject alert($rootScope.passingObject); } angular.module(‘heroApp’).component(‘someOtherTabPage’, { templateUrl: ‘someOtherTabPage.html’, controller: someOtherTabPageController, bindings :{ passingObject: … Read more