Tutorial by Examples: l

HTML also provides the tables with the <thead>, <tbody>, <tfoot>, and <caption> elements. These additional elements are useful for adding semantic value to your tables and for providing a place for separate CSS styling. When printing out a table that doesn't fit onto one (pa...
' This method is useful for iterating Enum values ' Enum Animal Dog = 1 Cat = 2 Frog = 4 End Enum Dim Animals = [Enum].GetValues(GetType(Animal)) For Each animal in Animals Console.WriteLine(animal) Next Prints: 1 2 4
using (new Sitecore.SecurityModel.SecurityDisabler()) { var item = Sitecore.Context.Database.GetItem("/sitecore/content/home"); }
NSError *e = nil; NSString *jsonString = @"[{\"id\": \"1\", \"name\":\"sam\"}]"; NSData *data = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData: data options: NSJSONReadingMutabl...
Just like in case of the function arguments, template parameters can have their default values. All template parameters with a default value have to be declared at the end of the template parameter list. The basic idea is that the template parameters with default value can be omitted while template ...
Useful if your program is outputting web pages along the way. from http.server import HTTPServer, CGIHTTPRequestHandler import webbrowser import threading def start_server(path, port=8000): '''Start a simple webserver serving path on port''' os.chdir(path) httpd = HTTPServer((''...
When you create an argparse ArgumentParser() and run your program with '-h' you get an automated usage message explaining what arguments you can run your software with. By default, positional arguments and conditional arguments are separated into two categories, for example, here is a small script ...
The main app file loads the routes file where routes are defined. app.js var express = require('express'); var app = express(); app.use('/', require('./routes')); app.listen('3000'); routes.js var router = require('express').Router(); router.get('/', function(req, res) { res.sen...
Middleware is executed prior to the route execution and can decide whether to execute the router according to the URL. var router = require('express').Router(); router.use(function (req, res, next) { var weekDay = new Date().getDay(); if (weekDay === 0) { res.send('Web is clos...
Say you have implemented some logic to detect attempts to modify an object in the database while the client that submitted changes didn't have the latest modifications. If such case happens, you raise a custom exception ConfictError(detailed_message). Now you want to return an HTTP 409 (Confict) st...
Use the maxlen parameter while creating a deque to limit the size of the deque: from collections import deque d = deque(maxlen=3) # only holds 3 items d.append(1) # deque([1]) d.append(2) # deque([1, 2]) d.append(3) # deque([1, 2, 3]) d.append(4) # deque([2, 3, 4]) (1 is removed because i...
Creating empty deque: dl = deque() # deque([]) creating empty deque Creating deque with some elements: dl = deque([1, 2, 3, 4]) # deque([1, 2, 3, 4]) Adding element to deque: dl.append(5) # deque([1, 2, 3, 4, 5]) Adding element left side of deque: dl.appendleft(0) # deque([0, 1, 2, ...
Often times you will see an exception Anti forgery token is meant for user "" but the current user is "username" This is because the Anti-Forgery token is also linked to the current logged-in user. This error appears when a user logs in but their token is still linked to bein...
String to a primitive numeric type or a numeric wrapper type: Each numeric wrapper class provides a parseXxx method that converts a String to the corresponding primitive type. The following code converts a String to an int using the Integer.parseInt method: String string = "59"; int p...
Haxe is available on Windows, Linux, and OS X. It is distributed in two forms: as an installer, providing an optional Neko VM dependency and configuring haxe and haxelib environment variables; as binaries, providing only the Haxe compiler and package manager. Windows Installer and binaries a...
The tile pane layout is similar to the FlowPane layout. TilePane places all of the nodes in a grid in which each cell, or tile, is the same size. It arranges nodes in neat rows and columns, either horizontally or vertically. import javafx.application.Application; import javafx.scene.Scene;...
The effect of using the * operator on an argument when calling a function is that of unpacking the list or a tuple argument def print_args(arg1, arg2): print(str(arg1) + str(arg2)) a = [1,2] b = tuple([3,4]) print_args(*a) # 12 print_args(*b) # 34 Note that the length of the starr...
CSS ul { list-style: none; counter-reset: list-item-number; /* self nesting counter as name is same for all levels */ } li { counter-increment: list-item-number; } li:before { content: counters(list-item-number, ".") " "; /* usage of counters() function means val...
In the example of a message bubble illustrated below: the corners of the image should remain unchanged which is specified by UIEdgeInsets, but the borders and center of the image should expand to cover the new size. let insets = UIEdgeInsetsMake(12.0, 20.0, 22.0, 12.0) let image = UIImage(na...
<div tabindex="0">Some button</div> Note: Try to use a native HTML button or an a tag where appropriate.

Page 203 of 861