enum ReadResult{
case Successful
case Failed
case Pending
}
struct OutpuData {
var data = Data()
var result: ReadResult
var error: Error?
}
func readData(from url: String, completion: @escaping (OutpuData) -> Void) {
var _data = OutpuData(data: Data(), ...
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 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...
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...
To set up a simple hibernate project using XML for the configurations you need 3 files, hibernate.cfg.xml, a POJO for each entity, and a EntityName.hbm.xml for each entity. Here is an example of each using MySQL:
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
&...
This is an example of how you would do a one to many mapping using XML. We will use Author and Book as our example and assume an author may have written many books, but each book will only have one author.
Author class:
public class Author {
private int id;
private String firstName;
...
If you want System.out.println(); but don't want to type the whole thing out you can just type syso and hit Ctrl + Spacebar. It will type the rest and set the cursor between the parenthesis.
You can include HTML comments in JSPs as well. You use the basic html comment syntax:
<!--Comment goes here-->
The difference between using JSP style comments and HTML style comments is the JSP ones will not be included when the HTML is generated and the HTML style comments will be. So it ...
As this is an audio, we don't need a QVideoWidget. So we can do:
_player = new QMediaPlayer(this);
QUrl file = QUrl::fromLocalFile(QFileDialog::getOpenFileName(this, tr("Open Music"), "", tr("")));
if (file.url() == "")
return ;
_player->setMedia(f...