This shows you how to use Microsoft.Extensions.DependencyInjection nuget package without the use of the WebHostBuilder from kestrel (e.g. when you want to build something else then a webApp):
internal class Program
{
public static void Main(string[] args)
{
var services = new Se...
IServiceCollection
To start building an IOC container with Microsoft's DI nuget package you start with creating an IServiceCollection. You can use the already provided Collection: ServiceCollection:
var services = new ServiceCollection();
This IServiceCollection is nothing more than an implemen...
First of all you'll need to have a key pair. If you don't have one yet, take a look at the 'Generate public and private key topic'.
Your key pair is composed by a private key (id_rsa) and a public key (id_rsa.pub). All you need to do is to copy the public key to the remote host and add its contents...
The vertical layout set up the object inside it vertically.
#include "mainwindow.h"
#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication...
/*!
* \class MainMenuListView
* \brief The MainMenuListView class is a QListView with a header displayed
* on top.
*/
class MainMenuListView : public QListView
{
Q_OBJECT
/*!
* \class Header
* \brief The header class is a nested class used to display the hea...
QSize MainMenuListView::Header::sizeHint() const
{
// fontmetrics() allows to get the default font size for the widget.
return QSize(menu->headerAreaWidth(), fontMetrics().height());
}
void MainMenuListView::Header::paintEvent(QPaintEvent* event)
{
// Catches the paint event ...
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
QWidget* w = new QWidget(this);
QHBoxLayout* hbox = new QHBoxLayout();
QVBoxLayout* vBox = new QVBoxLayout();
menuA = new MainMenuListView(w, "Images");
menuB = new MainMenuListView(w, "Video...
Here is a sample output:
As you can seen above, it can be useful for creating stacked menus.
Note that this sample is trivial. The two widgets have the same size constraints.
The QTimer::singleShot is used to call a slot/lambda asynchronously after n ms.
The basic syntax is :
QTimer::singleShot(myTime, myObject, SLOT(myMethodInMyObject()));
with myTime the time in ms, myObject the object which contain the method and myMethodInMyObject the slot to call
So for exampl...
tf.gather_nd is an extension of tf.gather in the sense that it allows you to not only access the 1st dimension of a tensor, but potentially all of them.
Arguments:
params: a Tensor of rank P representing the tensor we want to index into
indices: a Tensor of rank Q representing the indices into ...
You can combine mulple layout thanks to other QWidgets in your main layout to do more specifics effects like an information field: for example:
#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
#inclu...
The grid layout is a powerful layout with which you can do an horizontal and vertical layout a once.
example:
#include "mainwindow.h"
#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
#inc...
Let's suppose we want raise x to a number y.
You'd write this as:
def raise_power(x, y):
return x**y
What if your y value can assume a finite set of values?
Let's suppose y can be one of [3,4,5] and let's say you don't want offer end user the possibility to use such function since it is v...