Tutorial by Examples

NOTES: We are going to install Magento 2 on fresh Ubuntu Server 16.04 LTS with PHP 7.0, MySQL 5.6 and Apache 2.4. 1. Setup Requirements Apache 2.2 or 2.4 with mod_rewrite module (or) Nginx >= 1.8. PHP 5.5 or later version. PHP 7.0 also supported. Required PHP-Modules – PDO/MySQL, mbstring, ...
Generators are fast coded and in many cases a slim alternative to heavy iterator-implementations. With the fast implementation comes a little lack of control when a generator should stop generating or if it should generate something else. However this can be achieved with the usage of the send() fu...
For giving short names to a data type Instead of: long long int foo; struct mystructure object; one can use /* write once */ typedef long long ll; typedef struct mystructure mystruct; /* use whenever needed */ ll foo; mystruct object; This reduces the amount of typing needed if the ...
In the following example we will be creating a table called Membership using the AWS Java SDK for DynamoDB. The table will consist of items that represent team assignments. The table will be partitioned by TeamID. Each team will have multiple members, identified by the MemberID (as a sort key). AWS...
There are several considerations when implementing Regular Expressions in Swift. let letters = "abcdefg" let pattern = "[a,b,c]" let regEx = try NSRegularExpression(pattern: pattern, options: []) let nsString = letters as NSString let matches = regEx.matches(in: letters, opt...
Patterns can be used to replace part of an input string. The example below replaces the cent symbol with the dollar symbol. var money = "¢¥€£$¥€£¢" let pattern = "¢" do { let regEx = try NSRegularExpression (pattern: pattern, options: []) let nsString = money as NSS...
To match special characters Double Backslash should be used \. becomes \\. Characters you'll have to escape include (){}[]/\+*$>.|^? The below example get three kinds of opening brackets let specials = "(){}[]" let pattern = "(\\(|\\{|\\[)" do { let regEx = try N...
Regular expressions can be used to validate inputs by counting the number of matches. var validDate = false let numbers = "35/12/2016" let usPattern = "^(0[1-9]|1[012])[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19|20)\\d\\d$" let ukPattern = "^(0[1-9]|[12][0-9]|3[01])[-/](0[1...
Switches can switch on tuples: public typealias mdyTuple = (month: Int, day: Int, year: Int) let fredsBirthday = (month: 4, day: 3, year: 1973) switch theMDY { //You can match on a literal tuple: case (fredsBirthday): message = "\(date) \(prefix) the day Fred was born"...
Underscore is an open source functional programming utility library for JavaScript. Underscore provides many useful functions for working with arrays or collections of JavaScript objects, including filtering, sorting and querying. Node.js Make sure you have node and npm installed then type the fol...
Create a simple servlet: package web.example; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse...
Player player; //The player you want to award your achievement with Achievement achievement; //The achievement you want to award your player player.awardAchievement(achievement); //Awarding the achievement Checking if player has achievement: Player player; Achievement achievement...
First, you need to install pry-byebug gem. Run this command: $ gem install pry-byebug Add this line at the top of your .rb file: require 'pry-byebug' Then insert this line wherever you want a breakpoint: binding.pry A hello.rb example: require 'pry-byebug' def hello_world puts &qu...
Place the following code into a file name helloworld.js console.log("Hello World"); Save the file, and execute it through Node.js: node helloworld.js
Prerequisites: Install Firefox Install Selenium IDE addon (https://addons.mozilla.org/fr/firefox/addon/selenium-ide/) Open the plugin. A button displaying a red circle must be shown. If it's pressed, it means you can start your scenario. The plugin is recording everything you do within this F...
public class BucketSort { public static void SortBucket(ref int[] input) { int minValue = input[0]; int maxValue = input[0]; int k = 0; for (int i = input.Length - 1; i >= 1; i--) { if (input[i] > maxValue) maxValue = input...

map

The .map function accepts an array and an iteratee function, the iteratee produces a transformed copy of each array object. The iteratee function provides 3 arguments item - The current iterated object i - The index of the iterated object list - A reference to the original array/list The ne...
Install a Common Lisp implementation on the server. (E.g. sbcl, clisp, etc...) Install quicklisp on the server. Load SWANK with (ql:quickload :swank) Start the server with (swank:create-server). The default port is 4005. [On your local machine] Create a SSH tunnel with ssh -L4005:127.0.0.1:400...
The _.each function accepts an array or an object, an iteratee function and an optional context object, the iteratee function is invoked once and in order for each array item The iteratee function provides 3 arguments item - The current iterated object (or value if an object was passed) i - The i...
If you are tired of using long commands in bash you can create your own command alias. The best way to do this is to modify (or create if it does not exist) a file called .bash_aliases in your home folder. The general syntax is: alias command_alias='actual_command' where actual_command is the c...

Page 1013 of 1336