Tutorial by Examples: c

Since Groovy 1.8 a convenient memoize() method is added on closures: // normal closure def sum = { int x, int y -> println "sum ${x} + ${y}" return x + y } sum(3, 4) sum(3, 4) // prints // sum 3 + 4 // sum 3 + 4 // memoized closure def sumMemoize = sum.memoize() ...
A Sample class diagram based on which we will see JPA implementation. @Entity @Table(name = "VEHICLE") @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "VEHICLE_TYPE") public abstract class Vehicle { @TableGenerator(name = "VEHICLE_GE...
public ActionResult Details( string product) { .... if (productNotFound) { // http://www.eidias.com/blog/2014/7/2/mvc-custom-error-pages Response.Clear(); Response.TrySkipIisCustomErrors = true; Response.Write(product + " product not exists"); ...
Show all available databases: show dbs; Select a particular database to access, e.g. mydb. This will create mydb if it does not already exist: use mydb; Show all collections in the database (be sure to select one first, see above): show collections; Show all functions that can be used w...
const r = require("rethinkdb"); r.connect({host: 'localhost', port: 28015}, (conn) => console.log(conn)) // Or as a promise let rdb_conn; r.connect({host: 'localhost', port: 28015}).then((conn) => { rdb_conn = conn; }).then(() => { // Continue to use rdb_conn }); ...
r.connect({host: 'localhost', port: 28015}) .then((conn) => { return r.dbCreate("stackoverflow").run(conn); }).then((result) => { console.log(result); });
r.connect({host: 'localhost', port: 28015}) .then((conn) => { return r.db("stackoverflow").tableCreate("examples").run(conn); }).then((result) => { console.log(result); });
r.connect({host: 'localhost', port: 28015}) .then((conn) => { return r.db("stackoverflow").table("examples") .insert({ // If `id` is not set, will automatically generate a UUID id: 1, name: 'Thinker', // Wi...
r.connect({host: 'localhost', port: 28015}) .then((conn) => { // Can also use .get({id: 1}) return r.db("stackoverflow").table("examples").get(1).run(conn) }).then((result) => { console.log(result); })
A quick read of most developer sites will reveal that WinForms is considered inferior to WPF. One of the most often cited reasons is the supposed difficulty in making application wide changes to the "look-and-feel" of an entire application. In fact it is surprisingly easy to produce an a...
import pygame background_colour = (255,255,255) # For the background color of your window (width, height) = (300, 200) # Dimension of the window screen = pygame.display.set_mode((width, height)) # Making of the screen pygame.display.set_caption('Tutorial 1') # Name for the window screen.fil...
Here is our function to create a simple ajax call written in vanilla javascript (not es2015): function ajax(url, callback) { var xhr; if(typeof XMLHttpRequest !== 'undefined') xhr = new XMLHttpRequest(); else { var versions = ["MSXML2.XmlHttp.5.0", ...
The following code can be found in a demo here: https://ellie-app.com/mbFwJT9jD3/0 import Html exposing (..) import Json.Decode exposing (Decoder) payload = """ [{ "id": 0, "name": "Adam Carter", "work": "Uni...
To make an app more cohesive, we often need to keep user's personal settings and preferences consistent across multiple devices that have been logged in with one Microsoft account. In this sample, we use roaming data to store and to load UI settings, game process and user info. But the roaming data ...
The not very secure way (because docker inspect will show it) is to pass an environment variable to docker run such as docker run -e password=abc or in a file docker run --env-file myfile where myfile can contain password1=abc password2=def it is also possible to put them in a volume dock...
How to implement FirebaseRealTime database in android application. Following is the steps for do it. First install firebase sdk, If you dont know how to install then following is the URL for help. Install Firebase SDK After thet register your project in firbase console, URL of the firbas...
By using the Grid.RowSpan and Grid.ColumnSpan attached properties, children of a Grid can span multiple rows or columns. In the following example the second TextBlock will span the second and third column of the Grid. <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/&...
The row heigths or column widths of multiple Grids can be synchronized by setting a common SharedSizeGroup on the rows or columns to synchronize. Then a parent control somewhere up in the tree above the Grids needs to have the attached property Grid.IsSharedSizeScope set to True. <StackPanel Gri...
Create an HTML file with the following content: <!DOCTYPE html> <html> <head> <title>Angular Interceptor Sample</title> <script src="https://code.angularjs.org/1.5.8/angular.min.js"></script> <script src="app.js"></sc...

Page 551 of 826