Tutorial by Examples

Many people find themselves eventually supporting multiple applications, and desire to share code between apps. This leads to the concept of microservice architecture, and all-package apps. Essentially, the code from the entire classic directory structure is refactored out into packages. Even tho...
The most recent versions of Meteor ship with support for ecmascript, aka ES6 or ES2015. Instead of packages, Javascript now supports import statements and modules, which replaces the need for package-only applications. The latest directory structure is similar to the package-only structure, but us...
And, of course, you can mix these approaches, and use both packages and imports along side your application specific code. A mix-mode structure is most common in three situations: a franken-app, which is just sort of pulling a bit from here-and-there without any overall strategy; an app that's bei...
Deploy Meteor App to Ubuntu with Nginx Proxy How to Create an SSL Certificate on Nginx for Ubuntu 14 How to Deploy a Meteor JS App on Ubuntu with Nginx How to Install an SSL Certificate from a Commercial Certificate Authority NameCheap SSL Certificates
#include <iostream> #include <functional> using std::placeholders::_1; // to be used in std::bind example int stdf_foobar (int x, std::function<int(int)> moo) { return x + moo(x); // std::function moo called } int foo (int x) { return 2+x; } int foo_2 (int x, in...
One of the simplest ways to control program flow is by using if selection statements. Whether a block of code is to be executed or not to be executed can be decided by this statement. The syntax for if selection statement in C could be as follows: if(cond) { statement(s); /*to be executed, o...
While if performs an action only when its condition evaluate to true, if / else allows you to specify the different actions when the condition true and when the condition is false. Example: if (a > 1) puts("a is larger than 1"); else puts("a is not larger than 1"...
MySQL does not provide a built-in way to create pivot queries. However, these can be created using prepared statements. Assume the table tbl_values: IdNameGroupValue1PeteA102PeteB203JohnA10 Request: Create a query that shows the sum of Value for each Name; the Group must be column header and Name...
1) Create a Contract Class A contract class defines constants that help applications work with the content URIs, column names, intent actions, and other features of a content provider. Contract classes are not included automatically with a provider; the provider's developer has to define them and t...
The primary way of getting input would be from injecting the Illuminate\Http\Request into your controller, after that there are numerous ways of accessing the data, 4 of which are in the example below. <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class UserController...
globalize gem is a great solution to add translations to your ActiveRecord models. You can install it adding this to your Gemfile: gem 'globalize', '~> 5.0.0' If you're using Rails 5 you will also need to add activemodel-serializers-xml gem 'activemodel-serializers-xml' Model translations...
Due to type erasure the following will not work: public <T> void genericMethod() { T t = new T(); // Can not instantiate the type T. } The type T is erased. Since, at runtime, the JVM does not know what T originally was, it does not know which constructor to call. Workarounds ...
When an HTTP server receives a well-formed HTTP request, it must process the information that request contains and return a response to the client. A simple HTTP 1.1 response, may look like any of the following, usually followed by a number of header fields, and possibly a response body: HTTP/1.1 2...
Like an HTTP request, an HTTP response may include additional headers to modify or augment the response it provides. A full list of available headers is defined in §6.2 of the specification. The most commonly-used headers are: Server, which functions like a User-Agent request header for the serv...
As with request bodies, HTTP responses may contain a message body. This provides additional data that the client will process. Notably, 200 OK responses to a well-formed GET request should always provide a message body containing the requested data. (If there is none, 204 No Content is a more approp...
DELETE FROM `myTable` WHERE `someColumn` = 'something' The WHERE clause is optional but without it all rows are deleted.
A common problem is having a collection of items that all need to meet a certain criteria. In the example below we have collected two items for a diet plan and we want to check that the diet doesn't contain any unhealthy food. // First we create a collection $diet = collect([ ['name' => ...
You will often find yourself with a collection of data where you are only interested in parts of the data. In the example below we got a list of participants at an event and we want to provide a the tour guide with a simple list of names. // First we collect the participants $participants = colle...
Often you need to change the way a set of data is structured and manipulate certain values. In the example below we got a collection of books with an attached discount amount. But we much rather have a list of books with a price that's already discounted. $books = [ ['title' => 'The Pragma...
Collections also provide you with an easy way to do simple statistical calculations. $books = [ ['title' => 'The Pragmatic Programmer', 'price' => 20], ['title' => 'Continuous Delivery', 'price' => 30], ['title' => 'The Clean Coder', 'price' => 10], ] $min = col...

Page 398 of 1336