Tutorial by Examples: a

Example Controller action use Symfony\Component\HttpFoundation\Request; public function exampleAction(Request $request) { /* * First you need object ready for validation. * You can create new object or load it from database. * You need to add some constraints for this obj...
Usually we are not using second parameter in select([$select = '*'[, $escape = NULL]]) in CodeIgniter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names. In the following example, we are going to select the datetime type field by formatting it using sql query an...
Warning message: typings WARN deprecated 10/25/2016: "registry:dt/jasmine#2.5.0+20161003201800" is deprecated (updated, replaced or removed) Update the reference with: npm run typings -- install dt~jasmine --save --global Replace [jazmine] for any library that is throwing warning
The syntactic sugar Most of the getting started examples of ExpressJs include this piece of code var express = require('express'); var app = express(); ... app.listen(1337); Well, app.listen is just a shortcut for: var express = require('express'); var app = express(); var http = require(...
A basic middleware is a function that takes 3 arguments request, response and next. Then by app.use, a middleware is mounted to the Express App Middlewares Stack. Request and response are manipulated in each middleware then piped to the next one through the call of next(). For example, the below c...
LibGDX is a free, open-source game-development library developed in Java. It's goals are to allow users to develop cross-platform games that run on desktop, Android, iOS, and web browsers. Write code once, deploy it to any of the major platforms.
Installing Gulp and His Tasks $ npm install gulp --save-dev $ npm install gulp-sass --save-dev $ npm install gulp-uglify --save-dev $ npm install gulp-imagemin --save-dev Determining Folder Structure In this structure, we will use the app folder for development purposes, while the dist folde...
import pandas as pd df = pd.DataFrame([{'var1': 'a,b,c', 'var2': 1, 'var3': 'XX'}, {'var1': 'd,e,f,x,y', 'var2': 2, 'var3': 'ZZ'}]) print(df) reshaped = \ (df.set_index(df.columns.drop('var1',1).tolist()) .var1.str.split(',', expand=True) .stack() .reset_ind...
#ifndef MYCOMPAREFILEDIALOG_H #define MYCOMPAREFILEDIALOG_H #include <QtWidgets/QDialog> class MyCompareFileDialog : public QDialog { Q_OBJECT public: MyCompareFileDialog(QWidget *parent = 0); ~MyCompareFileDialog(); }; #endif // MYCOMPAREFILEDIALOG_H
#include "MyCompareFileDialog.h" #include <QLabel> MyCompareFileDialog::MyCompareFileDialog(QWidget *parent) : QDialog(parent) { setWindowTitle("Compare Files"); setWindowFlags(Qt::Dialog); setWindowModality(Qt::WindowModal); resize(300, 100); ...
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MyCompareFileDialog; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui...
#include "mainwindow.h" #include "ui_mainwindow.h" #include "mycomparefiledialog.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); myDialog = new MyCompareFileDialog(this); ...
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x...
Liferay exposes many default and custom services available to other systems via JSON. To explore services on a particular liferay instance, use a given URL - A local instance in this case: http://localhost:8080/api/jsonws/ Select the required service, consume the service with the given syntax ...
To create \DateTimeImmutable in PHP 5.6+ use: \DateTimeImmutable::createFromMutable($concrete); Prior PHP 5.6 you can use: \DateTimeImmutable::createFromFormat(\DateTime::ISO8601, $mutable->format(\DateTime::ISO8601), $mutable->getTimezone());
var JSONObject = { stringProp: 'stringProp', booleanProp: false, intProp: 8 } var JSONString = JSON.stringify(JSONObject, null, 2); console.log(JSONString); /* output: * { * "stringProp": "stringProp", * "booleanProp": false, * "...
Loading from string Use simplexml_load_string to create a SimpleXMLElement from a string: $xmlString = "<?xml version='1.0' encoding='UTF-8'?>"; $xml = simplexml_load_string($xmlString) or die("Error: Cannot create object"); Note that or not || must be used here becau...
Despite you can write a binary number in C++14 like: int number =0b0001'0101; // ==21 here comes a famous example with a self-made implementation for binary numbers: Note: The whole template expanding program is running at compile time. template< char FIRST, char... REST > struct binary {...
Usually you'll end up creating models which will contain a state, and that state will be changing during the lifespan of the object. AASM is a finite state machine enabler library that can help you out with dealing with having an easy passing through the process design of your objects. Having some...

Page 836 of 1099