Tutorial by Examples: and

Encapsulation is a basic concept in OOP. It is about wrapping data and code as a single unit. In this case, it is a good practice to declare the variables as private and then access them through Getters and Setters to view and/or modify them. public class Sample { private String name; privat...
The following function is returning another function as its result which can be later assigned to a variable and called: func jediTrainer () -> ((String, Int) -> String) { func train(name: String, times: Int) -> (String) { return "\(name) has been trained in the Force \(times)...
This is the basic HTML file that can be used as a boilerplate when starting a project. This boilerplate uses orbit controls with damping (camera that can move around an object with deceleration effect) and creates a spinning cube. <!DOCTYPE html> <html> <head> <t...
Any time SQL executed through an ADO connection needs to contain user input, it is considered best practice to parameterize it in order to minimize the chance of SQL injection. This method is also more readable than long concatenations and facilitates more robust and maintainable code (i.e. by using...
Python uses internal caching for a range of integers to reduce unnecessary overhead from their repeated creation. In effect, this can lead to confusing behavior when comparing integer identities: >>> -8 is (-7 - 1) False >>> -3 is (-2 - 1) True and, using another example: ...
Dim stringOfSpaces As String 'Assign a string with 255 repeated spaces using Space$ stringOfSpaces = Space$(255) 'Assign a string with 255 repeated spaces using String$ stringOfSpaces = String$(255, " ")
// Uses Windows authentication. Replace the Trusted_Connection parameter with // User Id=...;Password=...; to use SQL Server authentication instead. You may // want to find the appropriate connection string for your server. string connectionString = @"Server=myServer\myInstance;Database=myDa...
To initialize react-native init MyAwesomeProject To initialize with a specific version of React Native react-native init --version="0.36.0" MyAwesomeProject To Run for Android cd MyAwesomeProject react-native run-android To Run for iOS cd MyAwesomeProject react-native run-io...
There are two functions that can be used to obtain a readable representation of an object. repr(x) calls x.__repr__(): a representation of x. eval will usually convert the result of this function back to the original object. str(x) calls x.__str__(): a human-readable string that describes the obje...
A simple example: CL-USER> (defun make-apply-twice (fun) "return a new function that applies twice the function`fun' to its argument" (lambda (x) (funcall fun (funcall fun x)))) MAKE-APPLY-TWICE CL-USER> (funcall (make-apply-twice #'1+) 3) 5 ...
NA is a logical type and a logical operator with an NA will return NA if the outcome is ambiguous. Below, NA OR TRUE evaluates to TRUE because at least one side evaluates to TRUE, however NA OR FALSE returns NA because we do not know whether NA would have been TRUE or FALSE NA | TRUE # [1] TRUE ...
Sometimes you may want maintain versions of a git repository on machines that have no network connection. Bundles allow you to package git objects and references in a repository on one machine and import those into a repository on another. git tag 2016_07_24 git bundle create changes_between_tags...
Create new Jekyll Post To create a new Jekyll Post, create a new file on _posts directory with the format YYYY-MM-DD-title.MARKUP Replace MARKUP with the file extension for the language you want to use. This is usually Markdown(.md or .markdown) or HTML(.html). _posts/2017-01-01-hello-jekyll.m...
$sce ("Strict Contextual Escaping") is a built-in angular service that automatically sanitize content and internal sources in templates. injecting external sources and raw HTML into the template requires manual wrapping of$sce. In this example we'll create a simple $sce sanitation f...
The Ionic Platform offers a range of powerful, hybrid-focused mobile backend services and tools to make it easy to scale beautiful, performant hybrid apps, at a rapid pace. In order to use Ionic Platform you need to have the Ionic Framework installed. 1.) Registration (sign-up) You need to enter...
var regExp = new RegExp(r"(\w+)"); var str = "Parse my string"; Iterable<Match> matches = regExp.allMatches(str); It's a good idea to use "raw strings" (prefix with r) when writing regular expressions so you can use unescaped backslashes in your expression. ...
Locally created images can be pushed to Docker Hub or any other docker repo host, known as a registry. Use docker login to sign in to an existing docker hub account. docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https...
Java provides a conditional-and and a conditional-or operator, that both take one or two operands of type boolean and produce a boolean result. These are: && - the conditional-AND operator, || - the conditional-OR operators. The evaluation of <left-expr> && <righ...
In your Storyboard, add a UITableView object on your UIViewController and let it cover the entire view. Setup the UITableviewDataSource and UITableviewDelegate connections. Objective-C In your .h file NSMutableArray *arrayForBool; NSMutableArray *sectionTitleArray; In your .m file - (void)vi...
We can directly copy data from a source to a data sink using a loop. In this example, we are reading data from an InputStream and at the same time, writing to an OutputStream. Once we are done reading and writing, we have to close the resource. public void copy(InputStream source, OutputStream dest...

Page 53 of 153