Tutorial by Examples

The simplest way to concatenate list1 and list2: merged = list1 + list2 zip returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables: alist = ['a1', 'a2', 'a3'] blist = ['b1', 'b2', 'b3'] for a, b in zip(alist, blist):...
from container to host docker cp CONTAINER_NAME:PATH_IN_CONTAINER PATH_IN_HOST from host to container docker cp PATH_IN_HOST CONTAINER_NAME:PATH_IN_CONTAINER If I use jess/transmission from https://hub.docker.com/r/jess/transmission/builds/bsn7eqxrkzrhxazcuytbmzp/ , the files in the contai...
Represents a thread-safe collection of key/value pairs that can be accessed by multiple threads concurrently. Creating an instance Creating an instance works pretty much the same way as with Dictionary<TKey, TValue>, e.g.: var dict = new ConcurrentDictionary<int, string>(); Ad...
prepend() - Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. 1. prepend( content [, content ] ) // with html string jQuery('#parent').prepend('<span>child</span>'); // or you can use jQuery object jQuery('#parent').prepend(...
Defining a method in Ruby 2.x returns a symbol representing the name: class Example puts def hello end end #=> :hello This allows for interesting metaprogramming techniques. For instance, methods can be wrapped by other methods: class Class def logged(name) original_method...
One of the more popular .NET providers for Postgresql is Npgsql, which is ADO.NET compatible and is used nearly identically as other .NET database providers. A typical query is performed by creating a command, binding parameters, and then executing the command. In C#: var connString = "Host=m...
You can use a For Each...Next loop to iterate through any IEnumerable type. This includes arrays, lists, and anything else that may be of type IEnumerable or returns an IEnumerable. An example of looping through a DataTable's Rows property would look like this: For Each row As DataRow In DataTable...
The following example shows how you can use Json.Net to serialize the data in an C# Object's instance, to JSON string. using System; using System.Collections.Generic; using Newtonsoft.Json; public class Employee { public string FirstName { get; set; } public string LastName { get; s...
The following example shows how you can deserialize a JSON string containing into an Object (i.e. into an instance of a class). using System; using System.Collections.Generic; using Newtonsoft.Json; public class Program { public class Employee { public s...
Customizing a UITableViewCell can allow for very powerful, dynamic, and responsive interfaces. With extensive customization and in combination with other techniques you can do things like: update specific properties or interface elements as they change, animate or draw things in the cell, efficientl...
Bitwise operators can be used to perform bit level operation on variables. Below is a list of all six bitwise operators supported in C: SymbolOperator&bitwise AND|bitwise inclusive OR^bitwise exclusive OR (XOR)~bitwise not (one's complement)<<logical left shift>>logical right shift...
Syntactically, a tuple is a comma-separated list of values: t = 'a', 'b', 'c', 'd', 'e' Although not necessary, it is common to enclose tuples in parentheses: t = ('a', 'b', 'c', 'd', 'e') Create an empty tuple with parentheses: t0 = () type(t0) # <type 'tuple'> To crea...
svc public class WCFRestfulService : IWCFRestfulService { public string GetServiceName(int Id) { return "This is a WCF Restful Service"; } } Interface [ServiceContract(Name = "WCRestfulService ")] public interface IWCFRestf...
Dependencies npm i -D webpack babel-loader webpack.config.js const path = require('path'); module.exports = { entry: { app: ['babel-polyfill', './src/'], }, output: { path: __dirname, filename: './dist/[name].js', }, resolve: { extensions: ['', '.js'], }...
Required modules npm install --save-dev webpack extract-text-webpack-plugin file-loader css-loader style-loader Folder structure . └── assets    ├── css     ├── images    └── js webpack.config.js const webpack = require('webpack'); const ExtractTextPlugin = require('extract-text-webp...
$customer = Customer::findOne(10); or $customer = Customer::find()->where(['id' => 10])->one(); or $customer = Customer::find()->select('name,age')->where(['id' => 10])->one(); or $customer = Customer::findOne(['age' => 30, 'status' => 1]); or $customer = C...
Detailed instructions on getting database set up or installed.
In this example, we modify the "Simple class" example to allow access to the speed property. Typescript accessors allow us to add additional code in getters or setters. class Car { public position: number = 0; private _speed: number = 42; private _MAX_SPEED = 100 ...
If you want to import a module that doesn't already exist as a built-in module in the Python Standard Library nor as a side-package, you can do this by adding the path to the directory where your module is found to sys.path. This may be useful where multiple python environments exist on a host. im...
Creating a Custom Element with bindable properties is a snap. If you want to create an element that accepts one or more values which the plugin can use, the @bindable decorator and syntax is what you are looking for. Below, we are creating a custom element that accepts an array of fruits and displa...

Page 248 of 1336