Tutorial by Examples

Save data to and from file import pickle def save(filename,object): file=open(filename,'wb') pickle.dump(object,file) file.close() def load(filename): file=open(filename,'rb') object=pickle.load(file) file.close() return object >>>list_object=[1,...
Unity is an xUnit-style test framework for unit testing C. It is written completely in C and is portable, quick, simple, expressive and extensible. It is designed to especially be also useful for unit testing for embedded systems. A simple test case that checks the return value of a function, might...
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...
A function is a unit of code that represents a sequence of statements. Functions can accept arguments or values and return a single value (or not). To use a function, a function call is used on argument values and the use of the function call itself is replaced with its return value. Every functio...
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 ...
import SELECT a,b,c INTO OUTFILE 'result.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM table; Export LOAD DATA INFILE 'result.txt' INTO TABLE table;
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());

Page 1022 of 1336