codingbat-like site for C++

I don’t think such a site exists and I doubt it ever will. The reason is that C++ is huge – and I mean reeaallllyyy huge.When you start to write C++ code professionally (that is, 40hrs per week) and take 1 or 2 hrs for learning new stuff about C++ every day (that is, 5-10hrs per week), reading books … Read more

FtpClient storeFile always return False

The exact failure message can be found by calling FtpClient#getReplyCode(). From that page (my emphasis): Immediately after connecting is the only real time you need to check the reply code (because connect is of type void). The convention for all the FTP command methods in FTPClient is such that they either return a boolean value or … Read more

`ui-router` $stateParams vs. $state.params

The documentation reiterates your findings here: https://github.com/angular-ui/ui-router/wiki/URL-Routing#stateparams-service If my memory serves, $stateParams was introduced later than the original $state.params, and seems to be a simple helper injector to avoid continuously writing $state.params. I doubt there are any best practice guidelines, but context wins out for me. If you simply want access to the params received into the url, then use $stateParams. … Read more

How to execute AngularJS controller function on page load?

On the one hand as @Mark-Rajcok said you can just get away with private inner function: Also you can take a look at ng-init directive. Implementation will be much like: But take care about it as angular documentation implies (since v1.2) to NOT use ng-init for that. However imo it depends on architecture of your app. I used ng-init when I wanted to … Read more

How to subtract date/time in JavaScript?

This will give you the difference between two dates, in milliseconds In your example, it’d be You need to make sure that compareDate is a valid Date object. Something like this will probably work for you i.e. turning “2011-02-07 15:13:06” into new Date(‘2011/02/07 15:13:06’), which is a format the Date constructor can comprehend.