Tutorial by Examples

x = [5, 5, 1, 3] y = [5, 2, 4, 3] Union (|) contains elements from both arrays, with duplicates removed: x | y => [5, 1, 3, 2, 4] Intersection (&) contains elements which are present both in first and second array: x & y => [5, 3] Difference (-) contains elements which ar...
Stability in sorting means whether a sort algorithm maintains the relative order of the equals keys of the original input in the result output. So a sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input unsorted a...
If a selection on multiple arguments for a type generic expression is wanted, and all types in question are arithmetic types, an easy way to avoid nested _Generic expressions is to use addition of the parameters in the controlling expression: int max_int(int, int); unsigned max_unsigned(unsigned, ...
Note: Before deciding which Stream to use please have a look at ParallelStream vs Sequential Stream behavior. When you want to perform Stream operations concurrently, you could use either of these ways. List<String> data = Arrays.asList("One", "Two", "Three", &q...
The FOR XML PATH can be used for concatenating values into string. The example below concatenates values into a CSV string: DECLARE @DataSource TABLE ( [rowID] TINYINT ,[FirstName] NVARCHAR(32) ); INSERT INTO @DataSource ([rowID], [FirstName]) VALUES (1, 'Alex') ,(2, 'Peter') ...
Windows PowerShell is included with the Windows Management Framework. Installation and Setup are not required on modern versions of Windows. Updates to PowerShell can be accomplished by installing a newer version of the Windows Management Framework. Other Platforms "Beta" version of P...
The easiest way to set up NumPy on Mac is with pip pip install numpy Installation using Conda. Conda available for Windows, Mac, and Linux Install Conda. There are two ways to install Conda, either with Anaconda (Full package, include numpy) or Miniconda (only Conda,Python, and the package...
Sometimes you want to iterate over a range of dates from a start date to some end date. You can do it using datetime library and timedelta object: import datetime # The size of each step in days day_delta = datetime.timedelta(days=1) start_date = datetime.date.today() end_date = start_date ...
The following examples show two main methods for installing Erlang/OTP on Ubuntu. Method 1 - Pre-built Binary Package Simply run this command and it will download and install the latest stable Erlang release from Erlang Solutions. $ sudo apt-get install erlang Method 2 - Build and Install from...
$float = 0.123; For historical reasons "double" is returned by gettype() in case of a float, and not simply "float" Floats are floating point numbers, which allow more output precision than plain integers. Floats and integers can be used together due to PHP's loose casti...
Callables are anything which can be called as a callback. Things that can be termed a "callback" are as follows: Anonymous functions Standard PHP functions (note: not language constructs) Static Classes non-static Classes (using an alternate syntax) Specific Object...
Option 1: Leiningen Requires JDK 6 or newer. The easiest way to get started with Clojure is to download and install Leiningen, the de facto standard tool to manage Clojure projects, then run lein repl to open a REPL. Linux curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/l...
Python 2.x2.7 In Python 2 there are two variants of string: those made of bytes with type (str) and those made of text with type (unicode). In Python 2, an object of type str is always a byte sequence, but is commonly used for both text and binary data. A string literal is interpreted as a byte s...
The standard division symbol (/) operates differently in Python 3 and Python 2 when applied to integers. When dividing an integer by another integer in Python 3, the division operation x / y represents a true division (uses __truediv__ method) and produces a floating point result. Meanwhile, the ...
While using scaffolding is a fast and easy if you are new to Rails or you are creating a new application, later it can be useful just to do it on your own ato avoid the need to go through the scaffold-generated code to slim it down (remove unused parts, etc.). Creating a model can be as simple as c...
Ruby on Rails provides a model generator you can use to create ActiveRecord models. Simply use rails generate model and provide the model name. $ rails g model user In addition to the model file in app/models, the generator will also create: the Test in test/models/user_test.rb the Fixtures ...
This example requires the headers <algorithm>, <locale>, and <utility>. C++11 To trim a sequence or string means to remove all leading and trailing elements (or characters) matching a certain predicate. We first trim the trailing elements, because it doesn't involve moving any el...
Step 1: Open a Workbook Step 2 Option A: Press Alt + F11 This is the standard shortcut to open the VBE. Step 2 Option B: Developer Tab --> View Code First, the Developer Tab must be added to the ribbon. Go to File -> Options -> Customize Ribbon, then check the box for developer. ...
In Python 2, reduce is available either as a built-in function or from the functools package (version 2.6 onwards), whereas in Python 3 reduce is available only from functools. However the syntax for reduce in both Python2 and Python3 is the same and is reduce(function_to_reduce, list_to_reduce). A...
Getting setup with Spring Boot for the first time is quite fast thanks to the hard work of the Spring Community. Prerequisites: Java installed Java IDE Recommended not required (Intellij, Eclipse, Netbeans, etc.) You don't need to have Maven and/or Gradle installed. The projects generate...

Page 105 of 1336