I like to wrap my OkHttp into a class called HttpClient for example, and in this class I have methods for each of the major HTTP verbs, post, get, put and delete, most commonly. (I usually include an interface, in order to keep for it to implement, in order to be able to easily change to a different...
There are three types of code swaps that Instant run enables to support faster debugging and running app from your code in Android Studio.
Hot Swap
Warm Swap
Cold Swap
When are each of these swaps triggered?
HOT SWAP is triggered when an existing method's implementation is changed.
WARM SW...
There are a few changes where instant won't do its trick and a full build and reinstall fo your app will happen just like it used to happen before Instant Run was born.
Change the app manifest
Change resources referenced by the app manifest
Change an Android widget UI element (requires a Clean ...
Coroutines can yield inside themselves, and wait for other coroutines.
So, you can chain sequences - "one after the other".
This is very easy, and is a basic, core, technique in Unity.
It's absolutely natural in games that certain things have to happen "in order". Almost every...
We have a C library named my_random that produces random numbers from a custom distribution. It provides two functions that we want to use: set_seed(long seed) and rand() (and many more we do not need). In order to use them in Cython we need to
define an interface in the .pxd file and
call the f...
On of the overloads of the Select extension methods also passes the index of the current item in the collection being selected. These are a few uses of it.
Get the "row number" of the items
var rowNumbers = collection.OrderBy(item => item.Property1)
.ThenBy...
TakeWhile returns elements from a sequence as long as the condition is true
int[] list = { 1, 10, 40, 50, 44, 70, 4 };
var result = list.TakeWhile(item => item < 50).ToList();
// result = { 1, 10, 40 }
DataTables has the capability to enable or disable a number of its features, such as paging or searching. To choose these options, simply select them in your initialization:
$(document).ready(function() {
$('#tableid').DataTable( {
"paging": false, //Turn off paging, all r...
DataTables comes with an extensive API which is used to manipulate or obtain information about the DataTables on a page.
The API can be accessed in 3 ways:
var table = $('#tableid').DataTable(); //DataTable() returns an API instance immediately
var table = $('#tableid').dataTable().api(); //dataT...
Lambdas are meant to provide inline implementation code for single method interfaces and the ability to pass them around as we have been doing with normal variables. We call them Functional Interface.
For example, writing a Runnable in anonymous class and starting a Thread looks like:
//Old way
n...
There are many different variants of the ARM architecture and implementations that have evolved over time. The notation can be confusing. For instance, arm7 and armv7, are completely different. The first is a CPU implementation; the second is a CPU architecture. The architecture, also called a f...
1.8
Run:
$ git mv old/path/to/module new/path/to/module
1.8
Edit .gitmodules and change the path of the submodule appropriately, and put it in the index with git add .gitmodules.
If needed, create the parent directory of the new location of the submodule (mkdir -p new/path/to).
M...
Since Ionic 2 is getting better and better every day, please always check the official documentation to keep track of the latest changes and improvements.
Prerequisites:
You will need NodeJS in order to build Ionic 2 projects. You can download and install node here and learn more about npm and the...
One way to calculate the Big-O value of a procedure you've written is to determine which line of code runs the most times in your function, given your input size n. Once you have that number, take out all but the fastest-growing terms and get rid of the coefficents - that is the Big-O notation of yo...
Categories provide the ability to add some extra functionality to an object without subclassing or changing the actual object.
For example we want to set some custom fonts.
Lets create a category that add functionality to UIFont class. Open your Xcode project, click on File -> New -> File an...
Canvas is the simplest of panels. It places items at the specified Top/Left coordinates.
<Canvas>
<TextBlock
Canvas.Top="50"
Canvas.Left="50"
Text="This is located at 50, 50"/>
<TextBlock
Canvas.Top="100"
Canv...