Observe the notifications UIKeyboardWillShowNotification and UIKeyboardWillHideNotification, update the scrollView content insets according to keyboard height, then scroll to the focused control.
- (void)viewDidLoad
{
[super viewDidLoad];
// register for keyboard notifications
[[...
Because of security reasons, by default cookies are accessible only on the same domain from which they were set.
For example, if you have set a cookie on domain example.com, you cannot get it on domain www.example.com.
So if you're planning to use subdomains (i.e. admin.example.com, profile.exampl...
In case of autologin or "remember me" cookie, the same quirks as in case of subdomain cookies are applying.
But this time you need to configure user component, setting identityCookie array to desired cookie config.
Open you application config file and add identityCookie parameters to use...
The default box model (content-box) can be counter-intuitive, since the width / height for an element will not represent its actual width or height on screen as soon as you start adding padding and border styles to the element.
The following example demonstrates this potential issue with content-...
This is a normal function call:
console.log("Hello World!");
When you call a normal function, it does its job and then returns control back to the caller.
However, sometimes a function needs to return control back to the caller in order to do its job:
[1,2,3].map(function double(x) {...
This directive is useful to limit input events based on certain existing conditions.
The ng-disabled directive accepts and expression that should evaluate to either a truthy or a falsy values.
ng-disabled is used to conditionally apply the disabled attribute on an input element.
HTML
<input t...
The ng-dblclick directive is useful when you want to bind a double-click event into your DOM elements.
This directive accepts an expression
HTML
<input type="number" ng-model="num = num + 1" ng-init="num=0">
<button ng-dblclick="num++">Double...
Cheatsheet
DODON'TControl flow with control statementsControl flow with exceptionsKeep track of ignored (absorbed) exception by loggingIgnore exceptionRepeat exception by using throwRe-throw exception - throw new ArgumentNullException() or throw exThrow predefined system exceptionsThrow custom exce...
ng-app Sets the AngularJS section.
ng-init Sets a default variable value.
ng-bind Alternative to {{ }} template.
ng-bind-template Binds multiple expressions to the view.
ng-non-bindable States that the data isn't bindable.
ng-bind-html Binds inner HTML property of an HTML element....
Placeholders allow you to feed values into a tensorflow graph. Aditionally They allow you to specify constraints regarding the dimensions and data type of the values being fed in. As such they are useful when creating a neural network to feed new training examples.
The following example declares a ...
Variable tensors are used when the values require updating within a session. It is the type of tensor that would be used for the weights matrix when creating neural networks, since these values will be updated as the model is being trained.
Declaring a variable tensor can be done using the tf.Varia...
Set MONGO_URL to any arbitrary value except for a database URL and ensure no collections are defined in your Meteor project (including collections defined by Meteor packages) to run Meteor without MongoDB.
Note that without MongoDB, server/client methods alongside any packages related to Meteor's u...
A Bag/ultiset stores each object in the collection together with a count of occurrences. Extra methods on the interface allow multiple copies of an object to be added or removed at once. JDK analog is HashMap<T, Integer>, when values is count of copies this key.
TypeGuavaApache Commons Collec...
Suppose we want to count how many counties are there in Texas:
var counties = dbContext.States.Single(s => s.Code == "tx").Counties.Count();
The query is correct, but inefficient. States.Single(…) loads a state from the database. Next, Counties loads all 254 counties with all of the...
select_dtypes method can be used to select columns based on dtype.
In [1]: df = pd.DataFrame({'A': [1, 2, 3], 'B': [1.0, 2.0, 3.0], 'C': ['a', 'b', 'c'],
'D': [True, False, True]})
In [2]: df
Out[2]:
A B C D
0 1 1.0 a True
1 2 2.0 b False
2...
This example shows how to create a prepared statement with an insert statement with parameters, set values to those parameters and then executing the statement.
Connection connection = ... // connection created earlier
try (PreparedStatement insert = connection.prepareStatement(
"i...
In PaaS sites such as Heroku, it is usual to receive the database information as a single URL environment variable, instead of several parameters (host, port, user, password...).
There is a module, dj_database_url which automatically extracts the DATABASE_URL environment variable to a Python dictio...
When you create a function in TypeScript you can specify the data type of the function's arguments and the data type for the return value
Example:
function sum(x: number, y: number): number {
return x + y;
}
Here the syntax x: number, y: number means that the function can accept two argum...
You can search Docker Hub for images by using the search command:
docker search <term>
For example:
$ docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. ...