A typedef declaration has the same syntax as a variable or function declaration, but it contains the word typedef. The presence of typedef causes the declaration to declare a type instead of a variable or function.
int T; // T has type int
typedef int T; // T is an alias for int
int A[1...
$pwd
Displays the present working directory.
$who
Displays all the users logged in.
$who am i
Shows the username of the current user.
$date
Displays the current system date
$which <command>
Shows the path of the specified command.
For example "$which pwd" will sho...
The example assumes you have successfully run and fully understand the tutorial of MNIST(Deep MNIST for expert).
%matplotlib inline
import matplotlib.pyplot as plt
# con_val is a 4-d array, the first indicates the index of image, the last indicates the index of kernel
def display(con_val, kern...
Opening a stream
fopen opens a file stream handle, which can be used with various functions for reading, writing, seeking and other functions on top of it. This value is of resource type, and cannot be passed to other threads persisting its functionality.
$f = fopen("errors.log", "a...
One time definition of a generic base class with recursive type specifier. Each node has one parent and multiple children.
/// <summary>
/// Generic base class for a tree structure
/// </summary>
/// <typeparam name="T">The node type of the tree</typeparam>
pub...
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...
QtCreator is, at the moment, the best tool to create a Qt application. In this example, we will see how to create a simple Qt application which manage a button and write text.
To create a new application click on File->New File or Project:
Then choose the Projects->Application->Qt Widge...
Filename myEmail EMAIL
Subject = "My Email Subject"
From = "[email protected]"
To = '[email protected]'
CC = '[email protected]'
Type = 'Text/Plain';
Data _null_; File myEmail;
PUT "Email content";
PUT &q...
Let's first create a simple "Hello world!" MailboxProcessor which processes one type of message and prints greetings.
You'll need the message type. It can be anything, but Discriminated Unions are a natural choice here as they list all the possible cases on one place and you can easily us...
Let's consider the predicate sumDif/2, verified if the structure of a list matches several constraints. The first term represents the list to analyze and the second term another list that holds the part of the first list that is unknown to our constraints.
For the demonstration, sumDif/2 recognizes...
Install Firebase resource in the the AppScript
To do that click on Resources and then on Libraries.
Firebase has a unique project library key that need to be installed in the AppScript.
Click on Libraries
The following pop-up appears. Enter the following project key in the textbox.
MYeP8ZEE...
Simply add an attribute to the controller action
[Route("product/{productId}/customer")]
public IQueryable<Product> GetProductsByCustomer(int productId)
{
//action code goes here
}
this will be queried as /product/1/customer and productId=1 will be sent to the controll...
The yarn init command will walk you through the creation of a package.json file to configure some information about your package. This is similar to the npm init command in npm.
Create and navigate to a new directory to hold your package, and then run yarn init
mkdir my-package && cd my-pa...
Create your own WSMessageSender:
import java.io.IOException;
import java.net.HttpURLConnection;
import org.springframework.ws.transport.http.HttpUrlConnectionMessageSender;
import sun.misc.BASE64Encoder;
public class CustomWSMessageSender extends HttpUrlConnectionMessageSender{
@Ov...
There's two ways to create a ByteBuffer, where one can be subdivided again.
If you have an already existing byte[], you can "wrap" it into a ByteBuffer to simplify processing:
byte[] reqBuffer = new byte[BUFFER_SIZE];
int readBytes = socketInputStream.read(reqBuffer);
final ByteBuffer ...