Tutorial by Examples: di

C++14 It is often useful to define classes or structures that have a variable number and type of data members which are defined at compile time. The canonical example is std::tuple, but sometimes is it is necessary to define your own custom structures. Here is an example that defines the structure ...
Resource with same path and name may exist in more than one JAR file on the classpath. Common cases are resources following a convention or that are part of a packaging specification. Examples for such resources are META-INF/MANIFEST.MF META-INF/beans.xml (CDI Spec) ServiceLoader properties con...
Often when building a Docker image, the Dockerfile contains instructions that runs programs to fetch resources from the Internet (wget for example to pull a program binary build on GitHub for example). It is possible to instruct Docker to pass set set environment variables so that such programs per...
The received bytes have to be decoded with the correct character encoding to be interpreted as text: Python 3.x3.0 import urllib.request response = urllib.request.urlopen("http://stackoverflow.com/") data = response.read() encoding = response.info().get_content_charset() html = d...
Puppet is a configuration management solution. Users describe the desired state of a server or software and configuration management achieves this state. This brings following advantages: Configurations can be reproduced exactly the same every time, as many times as necessary Configurations for ...
In Smalltalk almost everything you do is sending messages to objects (referred as calling methods in other languages). There are three types of messages: Unary messages: #(1 2 3) size "This sends the #size message to the #(1 2 3) array. #size is a unary message, because it takes no argumen...
You can create extension methods to improve usability for nested collections like a Dictionary with a List<T> value. Consider the following extension methods: public static class DictListExtensions { public static void Add<TKey, TValue, TCollection>(this Dictionary<TKey, TColl...
private final Logger logger = Logger.getLogger(getClass().getCanonicalName()); WebView webView = new WebView(); webEngine = webView.getEngine(); webEngine.setOnAlert(event -> logger.warning(() -> "JS alert: " + event.getData()));
With AspNetCore you can develop the application on any platform including Mac,Linux,Window and Docker. Installation and SetUp Install visual Studio Code from here Add C# extesnion Install dot net core sdk. You can install from here Now you have all the tools available. To develop the applic...
JavaFX provides an easy way to internationalize your user interfaces. While creating a view from an FXML file you can provide the FXMLLoader with a resource bundle: Locale locale = new Locale("en", "UK"); ResourceBundle bundle = ResourceBundle.getBundle("strings", loc...
You might want to import and export your database for bacukups for example. Dont forget about the permissions. public void exportDatabase(){ try { File sd = Environment.getExternalStorageDirectory(); File data = Environment.getDataDirectory(); String currentD...
If you have multiple libraries in the same solution, you can add local (project) references between them: { "dependencies": { "NETStandard.Library": "1.6.0", "MyOtherLibrary": { "target": "project" } }...
Create an empty directory somewhere ... mkdir HelloWorld cd HelloWorld Then use the built in scaffolding technology to create a Hello World sample dotnet new console -o This command creates two files: HelloWorld.csproj describes the project dependencies, settings, and Target Framework ...
You can add hours, minutes, seconds and nanoseconds: LocalTime time = LocalTime.now(); LocalTime addHours = time.plusHours(5); // Add 5 hours LocaLTime addMinutes = time.plusMinutes(15) // Add 15 minutes LocalTime addSeconds = time.plusSeconds(30) // Add 30 seconds LocalTime addNanoseconds = ti...
To use additional packages within the Rcpp ecosystem, the correct header file may not be Rcpp.h but Rcpp<PACKAGE>.h (as e.g. for RcppArmadillo). It typically needs to be imported and then the dependency is stated within // [[Rcpp::depends(Rcpp<PACKAGE>)]] Examples: // Use the RcppAr...
The CLOS MOP provides the hook slot-value-using-class, that is called when a slot is value is accessed, read or modified. Because we only care for modifications in this case we define a method for (setf slot-value-using-class). (defclass document () ((id :reader id :documentation "A hash co...
A SELECT query is executed like any other statement. To read the returned data, call sqlite3_step() in a loop. It returns: SQLITE_ROW: if the data for the next row is available, or SQLITE_DONE: if there are no more rows, or any error code. If a query does not return any rows, the very first...
Standalone Common Lisp binaries can be built with buildapp. Before we can use it to generate binaries, we need to install and build it. The easiest way I know how is using quicklisp and a Common Lisp (this example uses [sbcl], but it shouldn't make a difference which one you've got). $ sbcl Thi...
HTML Form Use a file type input and the browser will provide a field that lets the user select a file to upload. Only forms with the post method can send file data. Make sure to set the form's enctype=multipart/form-data attribute. Otherwise the file's name will be sent but not the file's data...
CROSS APPLY enables you to "join" rows from a table with collection of JSON objects stored in a column. Imagine that you have a Company table with a column that contains an array of products (ProductList column) formatted as JSON array. OPENJSON table value function can parse these values...

Page 95 of 164