Lets say we want to build a paginated list of products, where the number of the page is passed as a query string parameter. For instance, to fetch the 3rd page, you'd go to:
http://example.com/products?page=3
The raw HTTP request would look something like this:
GET /products?page=3 HTTP/1.1
Ho...
PHP exposes a number of so-called global variables which contain information about the HTTP request, such as $_POST, $_GET, $_FILES, $_SESSION, etc. The Request class contains a static createFromGlobals() method in order to instantiate a request object based on these variables:
use Symfony\Componen...
Installation or Setup Slim framework
Install Composer
Open cmd
Go to Root directory of your Project Folder and Run Following Command.
composer require slim/slim "^3.0"
Now you will have vendor directory in your project
Next Create Index.php in root folder and add following co...
Launch screen is a screen which appears while launching app and lasts till first screen of app appears.
Learn more about Launch Screen and guidelines here.
Similar to AppIcons we have to mention in project settings about using image assets for launch screen image.
By default project settings are ...
In swift we can use both print() and NSLog() functions to print something on Xcode console.
But there are lot of differences in print() and NSLog() functions, such as:
1 TimeStamp: NSLog() will print timestamp along with the string we passed to it, but print() will not print timestamp.
e.g.
let ...
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require 'vendor/autoload.php';
$app = new \Slim\App;
$app->get('/employee/view', function ($req, $res) {
$con = new mysqli('localhost','USERNAME','PASSWORD','DATABASE');
...
Sympy is made for symbolic math, so let's have a look at some basic integration and differentiation.
from sympy import symbols, sqrt, exp, diff, integrate, pprint
x, y = symbols(...
There are various types of inheritance and code reuse in Twig:
Include
The main goal is code reuse. Consider using header.html.twig & footer.html.twig inside base.html.twig as an example.
header.html.twig
<nav>
<div>Homepage</div>
<div>About</div>
</...
Using the command git tag lists out all available tags:
$ git tag
<output follows>
v0.1
v1.3
Note: the tags are output in an alphabetical order.
One may also search for available tags:
$ git tag -l "v1.8.5*"
<output follows>
v1.8.5
v1.8.5-rc0
v1.8.5-rc1
v1.8.5...
The ternary operator (?:)
Support for the extended ternary operator was added in Twig 1.12.0.
{{ foo ? 'yes' : 'no' }}
Evaluates:
if foo echo yes else echo no
{{ foo ?: 'no' }}
or
{{ foo ? foo : 'no' }}
Evaluates:
if foo echo it, else echo no
{{ foo ? 'yes' }}
or
{{ f...
This example assume that a solution with an application named MyApp already exists.
Add a new project to the solution:
In the Setup project, add a new reference to MyApp from the Projects tab:
In the Product.wxs file, valorize the Manufacturer attribute of the Product node with Hell...
Kotlin does not need ; to end statements
Kotlin is null-safe
Kotlin is 100% Java interoperable
Kotlin has no primitives (but optimizes their object counterparts for the JVM, if possible)
Kotlin classes have properties, not fields
Kotlin offers data classes with auto-generated equals/hashCode ...
Kotlin uses == for equality (that is, calls equals internally) and === for referential identity.
JavaKotlina.equals(b);a == ba == b;a === ba != b;a !== b
See: https://kotlinlang.org/docs/reference/equality.html
You can use django rest framework permission classes to check request headers and authenticate user requests
Define your secret_key on project settings
API_KEY_SECRET = 'secret_value'
note: a good practice is to use environment variables to store this secret value.
Define a permission ...
Prior to iOS 7 when you want to scan a QR code, we might need to rely on third party frameworks or libraries like zBar or zXing. But Apple introduced AVCaptureMetaDataOutput from iOS 7 for reading barcodes.
To read QR code using AVFoundation we need to setup/create AVCaptureSession and use captureO...
in Startup.cs
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
var controllerActivator = new CompositionRoot();
services...