Tutorial by Examples

A value of a struct type can be written using a struct literal that specifies values for its fields. type Point struct { X, Y int } p := Point{1, 2} The above example specifies every field in the right order. Which is not useful, because programmers have to remember the exact fields in order. M...
PrestaShop can be download here. You can find system requirements here.
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...
The "listener" or "observer" pattern is the most common strategy for creating asynchronous callbacks in Android development. public class MyCustomObject { //1 - Define the interface public interface MyCustomObjectListener { public void onAction(String ac...
Rebasing when pulling If you are pulling in fresh commits from the remote repository and you have local changes on the current branch then git will automatically merge the remote version and your version. If you would like to reduce the number of merges on your branch you can tell git to rebase you...
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. ...
If you want to keep on-premises copy of the Gradle and let the Wrapper use it in the builds, you can set the distributionUrl pointing to your copy on the wrapper task: task wrapper(type: Wrapper) { gradleVersion = '2.0' distributionUrl = "http\://server/dadada/gradle-${gradleVersion}...
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...
Swing supports quite a few native L&Fs. You can always easily install one without calling for a specific L&F class: public class SystemLookAndFeel { public static void main ( final String[] args ) { // L&F installation should be performed within EDT (Event Dispatch ...
public class CustomLookAndFeel { public static void main ( final String[] args ) { // L&F installation should be performed within EDT (Event Dispatch Thread) // This is important to avoid any UI issues, exceptions or even deadlocks SwingUtilities.invokeLater...
Arithmetic computation can be also done without involving any other programs like this: Multiplication: echo $((5 * 2)) 10 Division: echo $((5 / 2)) 2 Modulo: echo $((5 % 2)) 1 Exponentiation: echo $((5 ** 2)) 25
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...

Page 481 of 1336