Tutorial by Examples: e

There are two possible ways of including LaTeX preamble commands (e.g. \usepackage) in a RMarkdown document. 1. Using the YAML option header-includes: --- title: "Including LaTeX Preample Commands in RMarkdown" header-includes: - \renewcommand{\familydefault}{cmss} - \usepacka...
A bibtex catalogue cna easily be included with the YAML option bibliography:. A certain style for the bibliography can be added with biblio-style:. The references are added at the end of the document. --- title: "Including Bibliography" author: "John Doe" output: pdf_documen...
To include a database in your app, you typically derive a class from SQLiteOpenHelper: public class HelloDBHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; private static final int DATABASE_NAME = "hello"; HelloDBHelper(Context context) {...
A simple POST request with authentication data is demonstrated below, note that the username and password field will vary depending on the website: final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"; ...
Most websites require a much more complicated process than the one demonstrated above. Common steps for logging into a website are: Get the unique cookie from the initial login form. Inspect the login form to see what the destination url is for the authentication request Parse the login form t...
page.html - source code <html> <head> <script src="loadData.js"></script> </head> <body onLoad="loadData()"> <div class="container"> <table id="data" border="1"> <...
<%@ Language="VBScript" CodePage = 65001 %> <% Option Explicit Response.Charset = "UTF-8" Response.CodePage = 65001 %> <!doctype html> <html> <head> <title>My First Classic ASP Page</title> </head> <body&gt...
For a thick arrow pointing north in a span, add classes ui-icon and ui-icon-arrowthick-1-n: <span class="ui-icon ui-icon-arrowthick-1-n"></span> For a triangle pointing south in a span, add classes ui-icon and ui-icon-triangle-1-s: <span class="ui-icon ui-icon-tria...
VB now allows string literals that split over multiple lines. Old syntax: Dim text As String = "Line1" & Environment.NewLine & "Line2" New syntax: Dim text As String = "Line 1 Line 2"
Enables a code to be statically compiled. Its bytecode will be closer to Java's, thus having better performance, though some dynamic features won't be available. @groovy.transform.CompileStatic class ListMath { def countSize(List<String> strings) { strings.collect { it.size() }...
VB.NET offers default Form instances. The developer does not need to create the instance as it is created behind the scenes. However, it is not preferable to use the default instance all but the simplest programs. Public Class Form1 Public Sub Foo() MessageBox.Show("Bar") ...
Now we want to install nginx to serve our application. sudo apt-get install nginx # on debian/ubuntu Then we create a configuration for our website cd /etc/nginx/site-available # go to the configuration for available sites # create a file flaskconfig with your favourite editor flaskconfig...
Flask has that feature which lets you stream data from a view by using generators. Let's change the app.py file add from flask import Response add from datetime import datetime add from time import sleep create a new view: @app.route("/time/") def time(): def streamer(): ...
The example in Visitor Pattern provides a compelling use-case for CRTP: struct IShape { virtual ~IShape() = default; virtual void accept(IShapeVisitor&) const = 0; }; struct Circle : IShape { // ... // Each shape has to implement this method the same way ...
A common mistake for Java beginners is to use the == operator to test if two strings are equal. For example: public class Hello { public static void main(String[] args) { if (args.length > 0) { if (args[0] == "hello") { System.out.println(&q...
System.IO.Compression.ZipFile.CreateFromDirectory("myfolder", "archive.zip") Create archive.zip file containing files which are in myfolder. In example paths are relative to program working directory. You can specify absolute paths.
System.IO.Compression.ZipFile.ExtractToDirectory("archive.zip", "myfolder") Extracts archive.zip to myfolder directory. In example paths are relative to program working directory. You can specify absolute paths.
' Create filestream to file Using fileStream = New IO.FileStream("archive.zip", IO.FileMode.Create) ' open zip archive from stream Using archive = New System.IO.Compression.ZipArchive(fileStream, IO.Compression.ZipArchiveMode.Create) ' create file_in_archive.txt in arch...
Self types can be used in traits and classes to define constraints on the concrete classes it is mixed to. It is also possible to use a different identifier for the this using this syntax (useful when outer object has to be referenced from an inner object). Assume you want to store some objects. Fo...
#!/bin/bash FILENAME="/etc/passwd" while IFS=: read -r username password userid groupid comment homedir cmdshell do echo "$username, $userid, $comment $homedir" done < $FILENAME In unix password file, user information is stored line by line, each line consisting of i...

Page 558 of 1191