Tutorial by Examples: c

You can build a JSON object tree (a JsValue) manually import play.api.libs.json._ val json = JsObject(Map( "name" -> JsString("Jsony McJsonface"), "age" -> JsNumber(18), "hobbies" -> JsArray(Seq( JsString("Fishing"), ...
Catamorphisms, or folds, model primitive recursion. cata tears down a fixpoint layer by layer, using an algebra function (or folding function) to process each layer. cata requires a Functor instance for the template type f. cata :: Functor f => (f a -> a) -> Fix f -> a cata f = f . fma...
Anamorphisms, or unfolds, model primitive corecursion. ana builds up a fixpoint layer by layer, using a coalgebra function (or unfolding function) to produce each new layer. ana requires a Functor instance for the template type f. ana :: Functor f => (a -> f a) -> a -> Fix f ana f = Fi...
CREATE TABLE table_name ( id INT NOT NULL AUTO_INCREMENT, json_col JSON, PRIMARY KEY(id) );
import os, sys from openpyxl import Workbook from datetime import datetime dt = datetime.now() list_values = [["01/01/2016", "05:00:00", 3], \ ["01/02/2016", "06:00:00", 4], \ ["01/03/2016", "07:00:00",...
Cryptography is something very hard and after spending a lot of time reading different examples and seeing how easy it is to introduce some form of vulnerability I found an answer originally written by @jbtule that I think is very good. Enjoy reading: "The general best practice for symmetric e...
do local tab = {1, 2, 3} function closure() for key, value in ipairs(tab) do print(key, "I can still see you") end end closure() --> 1 I can still see you --> 2 I can still see you --> 3 I can still see you end ...
Giving your list a type To create a list you need a type (any class, e.g. String). This is the type of your List. The List will only store objects of the specified type. For example: List<String> strings; Can store "string1", "hello world!", "goodbye", etc, b...
The List API has eight methods for positional access operations: add(T type) add(int index, T type) remove(Object o) remove(int index) get(int index) set(int index, E element) int indexOf(Object o) int lastIndexOf(Object o) So, if we have a List: List<String> strings = new ArrayL...
The implementation of INotifyPropertyChange can be error-prone, as the interface requires specifying property name as a string. In order to make the implementation more robust, an attribute CallerMemberName can be used. class C : INotifyPropertyChanged { // backing field int offset; ...
mysqladmin -u root -p'old-password' password 'new-password'
Batch execution using java.sql.PreparedStatement allows you to execute a single DML statement with multiple sets of values for its parameters. This example demonstrates how to prepare an insert statement and use it to insert multiple rows in a batch. Connection connection = ...; // obtained earl...
Batch execution using java.sql.Statement allows you to execute multiple DML statements (update, insert, delete) at once. This is achieved by creating a single statement object, adding the statements to execute, and then execute the batch as one. Connection connection = ...; // obtained earlier c...
options = { "x": ["a", "b"], "y": [10, 20, 30] } Given a dictionary such as the one shown above, where there is a list representing a set of values to explore for the corresponding key. Suppose you want to explore "x"="a" w...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <rect x="10" y="10" width="50" height="100" stroke="black" stroke-width="5" fill="none" /> </svg> R...
The width and height attributes designate the dimensions of the rectangle. These values are in pixels by default The fill value sets the color for the rectangle. If no value for fill is specified, black is used by default <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="h...
If you use a dictionary as an iterator (e.g. in a for statement), it traverses the keys of the dictionary. For example: d = {'a': 1, 'b': 2, 'c':3} for key in d: print(key, d[key]) # c 3 # b 2 # a 1 The same is true when used in a comprehension print([key for key in d]) # ['c', 'b', '...
foreach will iterate over any object of a class that implements IEnumerable (take note that IEnumerable<T> inherits from it). Such objects include some built-in ones, but not limit to: List<T>, T[] (arrays of any type), Dictionary<TKey, TSource>, as well as interfaces like IQueryab...
Detailed instructions on launching an EC2 instance.
Throughout this example it is assumed that the 'root' object that is being serialized to JSON is an instance of the following class : public class MyJson { }   Example 1 : An example of an instance of MyJson, as is: {} i.e. since the class has no fields, only curly brackets are serialized...

Page 237 of 826