Tutorial by Examples

The return statement can be a useful way to create output for a function. The return statement is especially useful if you do not know in which context the function will be used yet. //An example function that will take a string as input and return //the first character of the string. function...
From your Mac, download and install Xcode from the Mac App Store following this link. After the installation is complete, open Xcode and select Get started with a Playground: On the next panel, you can give your Playground a name or you can leave it MyPlayground and press Next: Select a locat...
We will see how to center content based on the height of a near element. Compatibility: IE8+, all other modern browsers. HTML <div class="content"> <div class="position-container"> <div class="thumb"> <img src="http://lorempix...
The caption-side property determines the vertical positioning of the <caption> element within a table. This has no effect if such element does not exist. Below an example with two tables with different values set to the caption-side property: The table on the left has caption-side: top whi...
From the official documentation: Gradle. dependencies { compile "com.squareup.picasso:picasso:2.5.2" } Maven: <dependency> <groupId>com.squareup.picasso</groupId> <artifactId>picasso</artifactId> <version>2.5.2</version> </dep...
Picasso supports both download and error placeholders as optional features. Its also provides callbacks for handling the download result. Picasso.with(context) .load("YOUR IMAGE URL HERE") .placeholder(Your Drawable Resource) //this is optional the image to display while the url i...
Picasso.with(context) .load("YOUR IMAGE URL HERE") .placeholder(DRAWABLE RESOURCE) // optional .error(DRAWABLE RESOURCE) // optional .resize(width, height) // optional .rotate(degree) // optional .in...
people := map[string]int{ "john": 30, "jane": 29, "mark": 11, } for _, value := range people { fmt.Println("Age:", value) } Note that when iterating over a map with a range loop, the iteration order is not specified and is not guaranteed to...
Installing Visual Studio If you do not have Visual Studio installed, you can download the free Visual Studio Community Edition here. If you already have it installed, you can proceed to the next step. Creating an ASP.NET Core MVC Application. Open Visual Studio. Select File > New Project. ...
Share simple information with differents apps. Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, get...
DROP INDEX ix_cars_employee_id ON Cars; We can use command DROP to delete our index. In this example we will DROP the index called ix_cars_employee_id on the table Cars. This deletes the index entirely, and if the index is clustered, will remove any clustering. It cannot be rebuilt without rec...
Abstract factory pattern provides a way to obtain an coherent collection of objects through a collection of factories functions. As for every pattern, coupling is reduced by abstracting the way a set of objects are created, so that the user code is unaware of the many details of the objects he needs...
Factories can be used in conjunction with Inversion of Control (IoC) libraries too. The typical use case for such a factory is when we want to create an object based on parameters that are not known until run-time (such as the current User). In these cases it can be sometimes be difficult (if no...
Enumerating dictionaries allows you to run a block of code on each dictionary key-value pair using the method enumerateKeysAndObjectsUsingBlock:(void (^)(id key, id obj, BOOL *stop))block Example: NSDictionary stockSymbolsDictionary = @{ @"AAPL":...
In [1]: import numpy as np In [2]: import pandas as pd In [3]: df = pd.DataFrame({'A': list('XYZXYZXYZX'), 'B': [1, 2, 1, 3, 1, 2, 3, 3, 1, 2], 'C': [12, 14, 11, 12, 13, 14, 16, 12, 10, 19]}) In [4]: df.groupby('A')['B'].agg({'mean': np.mean, 'standard deviatio...
import pandas.io.sql import pyodbc import pandas as pd Specify the parameters # Parameters server = 'server_name' db = 'database_name' UID = 'user_id' Create the connection # Create the connection conn = pyodbc.connect('DRIVER={SQL Server};SERVER=' + server + ';DATABASE=' + db + '; UID...
Given a file file.txt with the following content: line 1 line 2 line 3 You can delete a line from file content with the d command. The pattern to match is surrounded with default / delimiter and the d command follows the pattern: sed '/line 2/d' file.txt The above command will output: l...
Whenever you declare a new rule inside another rule it is called nesting. With basic nesting, as shown below, the nested selector will be compiled as a new CSS selector with all its parents prepended, separated by a space. // SCSS .parent { margin: 1rem; .child { float: left; } ...
Nesting is a very powerful feature, but should be used with caution. It can happen quite easily and quickly, that you start nesting and carry on including all children in a nest, of a nest, of a nest. Let me demonstrate: // SCSS header { // [css-rules] .holder { // [css-rules] ...
Singletons are used to ensure that only one instance of an object is being created. The singleton allows only a single instance of itself to be created which means it controls its creation. The singleton is one of the Gang of Four design patterns and is a creational pattern. Thread-Safe Singleton ...

Page 268 of 1336