Tutorial by Examples: 2

// assigning a signed short to its minimum value short s = -32768; // assigning a signed short to its maximum value short s = 32767; // assigning a signed int to its minimum value int i = -2147483648; // assigning a signed int to its maximum value int i = 2147483647; // assigning a s...
// assigning an unsigned short to its minimum value ushort s = 0; // assigning an unsigned short to its maximum value ushort s = 65535; // assigning an unsigned int to its minimum value uint i = 0; // assigning an unsigned int to its maximum value uint i = 4294967295; // assigning an...
The ConfigurationManager class supports the AppSettings property, which allows you to continue reading settings from the appSettings section of a configuration file the same way as .NET 1.x supported. app.config <?xml version="1.0" encoding="utf-8"?> <configuration&gt...
This is placed in a Windows Forms event handler var nameList = new BindingList<string>(); ComboBox1.DataSource = nameList; for(long i = 0; i < 10000; i++ ) { nameList.AddRange(new [] {"Alice", "Bob", "Carol" }); } This takes a long time to execute,...
from itertools import imap from future_builtins import map as fmap # Different name to highlight differences image = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] list(map(None, *image)) # Out: [(1, 4, 7), (2, 5, 8), (3, 6, 9)] list(fmap(None, *image)) # Out: [(1, 4, 7), (2, 5, 8),...
Abbreviated from https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/: Step 1: Begin authorization Send the user to this web page, with your values filled in: https://www.dropbox.com/oauth2/authorize?client_id=<app key>&response_type=code&redirect_uri=<...
The second step to creating a subscription for a user is to create and execute a billing agreement, based on an existing activated billing plan. This example assumes that you have already gone through and activated a billing plan in the previous example, and have an ID for that billing plan to refer...
These are all equivalent, the code inside the blocks will run when the document is ready: $(function() { // code }); $().ready(function() { // code }); $(document).ready(function() { // code }); Because these are equivalent the first is the recommended form, the following is a ...
// Java: Stream.of("a1", "a2", "a3") .findFirst() .ifPresent(System.out::println); // Kotlin: sequenceOf("a1", "a2", "a3").firstOrNull()?.apply(::println)
// Convert string to ArrayBuffer. This step is only necessary if you wish to hash a string, not if you aready got an ArrayBuffer such as an Uint8Array. var input = new TextEncoder('utf-8').encode('Hello world!'); // Calculate the SHA-256 digest crypto.subtle.digest('SHA-256', input) // Wait fo...
First we need to install composer. Steps to install composer Install Composer. curl -sS https://getcomposer.org/installer | php Now change directory: sudo mv composer.phar /usr/local/bin/composer Check composer working composer Now Composer installed. There two ways to install Yii2 adv...
Following is an implementation that demonstrates how an object can be serialized into its corresponding JSON string. class Test { private int idx; private String name; public int getIdx() { return idx; } public void setIdx(int idx) { this.idx = idx; ...
This example is a quick setup of Angular 2 and how to generate a quick example project. Prerequisites: Node.js v4 or greater. npm v3 or greater or yarn. Open a terminal and run the commands one by one: npm install -g @angular/cli or yarn global add @angular/cli depending on your choi...
Few people have issue regarding error message not displaying if existing value is being entered in textbox. So, For Example I'm not allowing user to enter existing email. signup.php (Page where you wanted to sign up new user without existing email id) Remove use yii\bootstrap\ActiveForm; (if p...
Introduction SharePoint 2016 is the version 16 release of the SharePoint product family. It was released on May 4, 2016. This example covers the installation of SharePoint 2016 using the Single Server Farm configuration. This configuration covers the basics of setting up a SharePoint farm without t...
Enums have been backported from Python 3.4 to Python 2.4 through Python 3.3. You can get this the enum34 backport from PyPI. pip install enum34 Creation of an enum is identical to how it works in Python 3.4+ from enum import Enum class Color(Enum): red = 1 green = 2 blue = 3 ...
In Python 2, when a property raise a error, hasattr will ignore this property, returning False. class A(object): @property def get(self): raise IOError class B(object): @property def get(self): return 'get in b' a = A() b = B() print 'a hasattr get:...
A one-liner that helps granting or revoking vulnerable permissions. granting adb shell pm grant <sample.package.id> android.permission.<PERMISSION_NAME> revoking adb shell pm revoke <sample.package.id> android.permission.<PERMISSION_NAME> Granting all run...
Retrofit requests can be logged using an intercepter. There are several levels of detail available: NONE, BASIC, HEADERS, BODY. See Github project here. Add dependency to build.gradle: compile 'com.squareup.okhttp3:logging-interceptor:3.8.1' Add logging interceptor when creating Retrofit:...
Filters can either be defined in a method and then added to Jinja's filters dictionary, or defined in a method decorated with Flask.template_filter. Defining and registering later: def format_datetime(value, format="%d %b %Y %I:%M %p"): """Format a date time to (Defau...

Page 1 of 21