How to parse a string to an int in C++?

How to parse a string to an int in C++?

What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of returning zero). 1:In the new C++11 there are functions for that: stoi, stol, stoll, stoul and so on.int myNr = s

How do I return the response from an asynchronous call?

How do I return the response from an asynchronous call?

I have a function foo which makes an Ajax request. How can I return the response from foo? I tried returning the value from the success callback as well as assigning the response to a local variable inside the function and returning that on

How to upload Video to youtube using Google.Apis.YouTube.v3 and C#?

How to upload Video to youtube using Google.Apis.YouTube.v3 and C#?

I have created console application using C#. Which will upload Video from local drive to youtube.I have created new app in google api using this link. I have also installed all required packages using nuget.When I run my application I am ge

Zbar + python, crashes on import (OSX 10.9.1)

Zbar + python, crashes on import (OSX 10.9.1)

I've attempted to install Zbar for use with python 2.7.6 with Homebrew and pip (brew install zbar, then pip install zbar) but every time I import it, python crashes. Simply running:#!/usr/bin/pythonimport zbarlands me with this from the ter

What is the equivalent to 'play stop' for Play Framework 2.1?

What is the equivalent to 'play stop' for Play Framework 2.1?

What is the equivalent of play stop for Play 2.1?If I did play start, how do I cleanly terminate the process? 1:As stated in the doc: When you run the start command, Play forks a new JVM and runs the default Netty HTTP server. The stand

Register @ControllerAdvice annotated Controller in JUnitTest with MockMVC

Register @ControllerAdvice annotated Controller in JUnitTest with MockMVC

My @ControllerAdvice annotated Controller looks like this:@ControllerAdvicepublic class GlobalControllerExceptionHandler { @ResponseStatus(value = HttpStatus.UNAUTHORIZED) @ExceptionHandler(AuthenticationException.class) public voi

How to determine a 404 response status when using the HttpClient.GetAsync()

How to determine a 404 response status when using the HttpClient.GetAsync()

I am trying to determine the response returned by HttpClient's GetAsync method in the case of 404 errors using C# and .NET 4.5.At present I can only tell that an error has occurred rather than the error's status such as 404 or timeout.Curre

How does “not something we can merge” arise?

How does “not something we can merge” arise?

This is a new one to me. I'm a fairly experienced user of git, and have just added a remote to a repo that was forked from mine, fetched the updates and then tried to merge them in:$ git merge HEAD f6ff240dbf47234249a68b34c8a98bb11237aa7fat

How to display loading status with preloader and multiple images?

How to display loading status with preloader and multiple images?

I am building a slideshow with a few hundred images and would like to build a nice loading bar, so the idea was to preload the images using JavaScript, then initialize the rest of the UI afterwords.Preloading the images is not a problem, bu

Error code 1005, SQL state HY000: Can't create table errno: 150

Error code 1005, SQL state HY000: Can't create table errno: 150

I'm trying to create a table but the script fails as soon as my netbeans errors the first table of DB. How can this be solved?CREATE TABLE filmy( Film_Id int NOT NULL, Nazwa varchar(250), Adres varchar(250), Data_Utworzenia date

Store LiveConnectSession in WP7

Store LiveConnectSession in WP7

I want to use the Hotmail API on my Windows Phone 7 App. Therefore, I have to grant access to my mobile app. I do that using the Microsoft Live Connect API, which really works great for the start. I use the following code for authentication

Reading a file to string with mmap

Reading a file to string with mmap

I'm trying to read a file to a string using mmap.I was following this example: http://www.lemoda.net/c/mmap-example/index.htmlMy code looks like thisunsigned char *f;int size;int main(int argc, char const *argv[]){ struct stat s; cons

objective c check if Bluetooth Availability Changed [duplicate]

objective c check if Bluetooth Availability Changed [duplicate]

This question already has an answer here: How to get the status of bluetooth (ON/OFF) in iphone programmatically 6 answers The question is simple: Is t

error +HTTPACTION:0,601,0

error +HTTPACTION:0,601,0

I m trying to access a website using sim900 GSM module. This is the list of commandsAT+CSQ +CSQ: 16,0 OK AT+HTTPINIT OK AT+HTTPPARA="CID",1 OK AT+HTTPPARA="URL","www.google.com"

Drawing route on Google Maps using Google Maps Android API v2

Drawing route on Google Maps using Google Maps Android API v2

I have an app in which I am continuously tracking user's location using Google Plays new service API for Maps. I am updating the location every single second and I am also checking user activity like STILL, TILTING, IN VEHICLE, etc to get t

Different transition on presentModalViewController:animated:

Different transition on presentModalViewController:animated:

I present a modal view controller which is a tab bar controller with a navigation controller inside it.The problem is my first view has a black background and I want the new view to have a white background.This means I either have to have t

SQL query for Courses Enrolment on Moodle

SQL query for Courses Enrolment on Moodle

I was looking for the proper SQL queries for retrieving all students enrolled in a certain course, or all courses a certain student has enrolled in, on Moodle.I have found a few solutions from the Internet, and most of them suggest joining

Play ! 2.2.4 / Akka : tests failed when run together, but ok separately

Play ! 2.2.4 / Akka : tests failed when run together, but ok separately

I have a controller that asks an actor before answering and two test cases:When I run play test the second test failsWhen I run play testOnly ApplicationSpec and play testOnly IntegrationSpec, both succeedI think that the Akka system is shu

How to get the HTML source of a website with PhantomJS

How to get the HTML source of a website with PhantomJS

Below is an example of PhantomJS that gets some element by DOM id from an external webpage:var page = require('webpage').create();console.log('The default user agent is ' + page.settings.userAgent);page.settings.userAgent = 'SpecialAgent';p

Detect if a web user is currently logged in Google?

Detect if a web user is currently logged in Google?

Suppose I want to display certain content only if I know the user coming to my website has a valid Google Account and it's logged into that account.Is there any way to do this in Javascript? I know that the Facebook API provides ways to tel

Java - Stop a long running thread which accesses database

Java - Stop a long running thread which accesses database

I start couple of threads, but I do not have their references to stop by signalling or something.For example, I can't pass a variable like running=false to those threads, because I do not have their references, but have their names.I'm usin

Cancel AsyncTask after some time

Cancel AsyncTask after some time

This could be a duplicate question but I did not find what I was looking for.I am calling an AsyncTask in the UI activity new LoadData().execute(); and in doInBackground I call a method which takes time. I want to interrupt this thread if

Check if task is already running before starting new

Check if task is already running before starting new

There is a process which is executed in a task. I do not want more than one of these to execute simultaneously.Is this the correct way to check to see if a task is already running?private Task task;public void StartTask(){ if (task != n

how to detect a build error from ant/maven via a bash script?

how to detect a build error from ant/maven via a bash script?

i'm writing a bash script to automate the build process. there are two major build blocks, one is an ant task and one is a plain old "mvn clean install". i want to do something when there are build error coming from either of this two build

Using the HTML 'label' tag with radio buttons

Using the HTML 'label' tag with radio buttons

Does the label tag work with radio buttons? If so, how do you use it? I have a form that displays like this:First Name: (text field)Hair Color: (color drop-down)Description: (text area)Salutation: (radio buttons for Mr., Mrs., Miss)I'd li